Numerical Analysis Programs Using Fortran 90 - University of ...

Numerical Analysis Programs Using Fortran 90 - University of ... Numerical Analysis Programs Using Fortran 90 - University of ...

23.10.2014 Views

1.048701 1.019178 1.011646 1.009753 +++++++++++++++++++++ 1.048701 -------------------------------------- 1.019178 1.009338 -------------------------------------- 1.011646 1.009135 1.009122 -------------------------------------- 1.009753 1.009122 1.009121 1.009121 -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 42

Problem: Write a Fortran program to find the value of the integral ∫ 0. 8 0 e t 2 dt with error of order using Simpson’s 1/3 rule and Romberg integration 8 h . dimension y(20),simps(20),romb(20,20) f(t)=exp(t**2) a=0; b=0.8; m=4 do k=1,m n=2**k h=(b-a)/n do i=1,n+1 x=a+h*(i-1) y(i)=f(x) enddo s=0 do i=1,n,2 s=s+(h/3)*(y(i)+4*y(i+1)+y(i+2)) enddo simps(k)=s print*,s enddo print*,'---------------------------' fact=2**2 do k=1,m-1 fact=fact**k do j=1,m-k simps(j)=(fact*simps(j+1)-simps(j))/(fact-1) romb(k,j)=simps(j) print*,romb(k,j) enddo print*,'---------------------------' enddo end ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 43

1.048701<br />

1.019178<br />

1.011646<br />

1.009753<br />

+++++++++++++++++++++<br />

1.048701<br />

--------------------------------------<br />

1.019178<br />

1.009338<br />

--------------------------------------<br />

1.011646<br />

1.009135<br />

1.009122<br />

--------------------------------------<br />

1.009753<br />

1.009122<br />

1.009121<br />

1.009121<br />

--------------------------------------<br />

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br />

42

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!