Numerical Analysis Programs Using Fortran 90 - University of ...
Numerical Analysis Programs Using Fortran 90 - University of ...
Numerical Analysis Programs Using Fortran 90 - University of ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Problem: Write a <strong>Fortran</strong> program to find the value <strong>of</strong> the integral<br />
1 dt<br />
∫<br />
using Simpson’s 1/3 rule with n = 6<br />
0 2<br />
2<br />
( t + 1) (3t<br />
+ 4)<br />
! program Simpson's 1/3 Rule<br />
dimension y(20)<br />
f(t)=1/((t**2+1)*(3*t**2+4))**.5<br />
a=0<br />
b=1<br />
n=6<br />
h=(b-a)/n<br />
s=0<br />
do i=1,n+1<br />
x=a+h*(i-1)<br />
y(i)=f(x)<br />
enddo<br />
do i=1,n,2<br />
s=s+(h/3)*(y(i)+4*y(i+1)+y(i+2))<br />
enddo<br />
print*,'Integration by Simpsons 1/3 Rule=',s<br />
end<br />
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br />
Integration by Simpson's 1/3 rule= 4.021834 E-01<br />
36