Numerical Analysis Programs Using Fortran 90 - University of ...
Numerical Analysis Programs Using Fortran 90 - University of ... Numerical Analysis Programs Using Fortran 90 - University of ...
Problem: Write a Fortran program to find first derivation from the following data at x = 0. 1 using derivation of Lagrange polynomial. x 0.1 0.2 0.3 0.4 y 0.01 0.04 0.09 0.16 ! Derivation using Lagrange Formula dimension x(40),y(40) n=4 xx=0.1 data (x(i), i=1,4)/.1,.2,.3,.4/ data (y(i), i=1,4)/.01,.04,.09,.16/ d=0 do i=1,n s=0 do j=1,n if (j.eq.i) goto 10 p=1 do k=1,n if ((k.eq.j).or.(k.eq.i)) goto 20 p=p*(xx-x(k))/(x(i)-x(k)) 20 enddo s=s+p/(x(i)-x(j)) 10 enddo d=d+s*y(i) enddo print*,'The First Derivation=',d end ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The First Derivation= 2.000000E-01 48
Problem: Write a Fortran program to find first derivation of the function 2 3 f ( x) = ln(5x ) + 8x −8 at x =1. 1 using derivation of Lagrange polynomial. ! Derivation using Lagrange Formula f(x)=log(5*x**2)+8*x**3-8 n=4 xo=1.1 h=.1 d=0 do i=1,n s=0 do j=1,n if (j.eq.i) goto 10 p=1 do k=1,n if ((k.eq.j).or.(k.eq.i)) goto 20 p=p*(1-k)/(i-k) 20 enddo s=s+p/((i-j)*h) 10 enddo d=d+s*f(xo+h*(i-1)) enddo print*,'The First Derivation=',d end ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The First Derivation= 30.856790 49
- Page 1 and 2: Kurdistan Region-Iraq Sulaimani Uni
- Page 3 and 4: Problem: Write a program to find th
- Page 5 and 6: Problem: Write a program to find th
- Page 7 and 8: Problem: Write a program to determi
- Page 9 and 10: Problem: Write a program to determi
- Page 11 and 12: Problem: Write a program to determi
- Page 13 and 14: Problem: Write a program to find th
- Page 15 and 16: Problem: Write a program to find th
- Page 17 and 18: Problem: Write a program to find th
- Page 19 and 20: Problem: Write a program to find th
- Page 21 and 22: Problem: Write a program to find th
- Page 23 and 24: Problem: Write a program to determi
- Page 25 and 26: Problem: Write a program to determi
- Page 27 and 28: Problem: Write a program to determi
- Page 29 and 30: Problem: Write a program to determi
- Page 31 and 32: Problem: Write a program to determi
- Page 33 and 34: Problem: Write a Fortran program to
- Page 35 and 36: Problem: Write a Fortran program to
- Page 37 and 38: Problem: Write a Fortran program to
- Page 39 and 40: Problem: Write a Fortran program to
- Page 41 and 42: Problem: Write a Fortran program to
- Page 43 and 44: Problem: Write a Fortran program to
- Page 45 and 46: Problem: Write a Fortran program to
- Page 47: Problem: Write a Fortran program to
- Page 51 and 52: Problem: Write a Fortran program to
- Page 53 and 54: 0 1.000000 E-01 0.1 1.800000 E-01 0
- Page 55 and 56: 0 1.000000 E-01 0.1 1.637440 E-01 0
Problem: Write a <strong>Fortran</strong> program to find first derivation from the<br />
following data at x = 0. 1 using derivation <strong>of</strong> Lagrange<br />
polynomial.<br />
x 0.1 0.2 0.3 0.4<br />
y 0.01 0.04 0.09 0.16<br />
! Derivation using Lagrange Formula<br />
dimension x(40),y(40)<br />
n=4<br />
xx=0.1<br />
data (x(i), i=1,4)/.1,.2,.3,.4/<br />
data (y(i), i=1,4)/.01,.04,.09,.16/<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*(xx-x(k))/(x(i)-x(k))<br />
20 enddo<br />
s=s+p/(x(i)-x(j))<br />
10 enddo<br />
d=d+s*y(i)<br />
enddo<br />
print*,'The First Derivation=',d<br />
end<br />
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br />
The First Derivation= 2.000000E-01<br />
48