23.10.2014 Views

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

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

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

SHOW MORE
SHOW LESS

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 first derivation <strong>of</strong> the function<br />

2 3<br />

f ( x)<br />

= ln(5x<br />

) + 8x<br />

−8<br />

at x =1. 1 using derivation <strong>of</strong> Lagrange polynomial.<br />

! Derivation using Lagrange Formula<br />

f(x)=log(5*x**2)+8*x**3-8<br />

n=4<br />

xo=1.1<br />

h=.1<br />

d=0<br />

do i=1,n<br />

s=0<br />

do j=1,n<br />

if (j.eq.i) goto 10<br />

p=1<br />

do k=1,n<br />

if ((k.eq.j).or.(k.eq.i)) goto 20<br />

p=p*(-h*(k-1))/(h*(i-1)-h*(k-1))<br />

20 enddo<br />

s=s+p/(h*(i-1)-h*(j-1))<br />

10 enddo<br />

d=d+s*f(xo+h*(i-1))<br />

enddo<br />

print*,'The First Derivation=',d<br />

end<br />

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

The First Derivation= 30.8567<strong>90</strong><br />

50

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

Saved successfully!

Ooh no, something went wrong!