Created
September 9, 2014 22:39
-
-
Save dyjjones/4147a15b54becf863fe4 to your computer and use it in GitHub Desktop.
j
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program hw2 | |
implicit none | |
real x | |
double precision y | |
double precision z | |
integer i | |
double precision h | |
double precision q | |
h=1.0 | |
x=0.5 | |
do i=0,10 | |
y=x+h | |
z=x-h | |
q=(f(y)-f(z))/(2.0*h) | |
write(*,*) h,q | |
h=h*0.1 | |
end do | |
contains | |
function f(y) | |
double precision y, f | |
f=-0.1*y**4-0.15*y**3-0.5*y**2-0.25*y+1.2 | |
return | |
end function f | |
end program hw2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment