Numerical Analysis Programs Using Fortran 90 - University of ...
Numerical Analysis Programs Using Fortran 90 - University of ...
Numerical Analysis Programs Using Fortran 90 - University of ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Problem: Write a program to find the roots <strong>of</strong> the equation<br />
x<br />
f ( x)<br />
= 3x<br />
+ sin x − e using Secant method in the interval [ 0,1]<br />
,<br />
4<br />
within the tolerance 10 − .<br />
f(x)=3*x+sin(x)-exp(x)<br />
tol=.00001<br />
x1=0<br />
x2=1<br />
10 x3=(x1*f(x2)-x2*f(x1))/(f(x2)-f(x1))<br />
print*,x1,x2,x3<br />
x1=x2<br />
x2=x3<br />
if (abs (x1-x2).lt.tol) goto 20<br />
goto 10<br />
20 print*,'The Root is',x3<br />
end<br />
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br />
0.000000 1.000000 4.709896E-01<br />
1.000000 4.709896E-01 3.075085E-01<br />
4.709896E-01 3.075085E-01 3.626132E-01<br />
3.075085E-01 3.626132E-01 3.604615E-01<br />
3.626132E-01 3.604615E-01 3.604217E-01<br />
3.604615E-01 3.604217E-01 3.604217E-01<br />
The Root is 3.604217E-01<br />
4