Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Finite
Program Finite_diffenence_method Implicit None Real::aa=0.0,bb=atan(1.0),h,w(0:15),p,q,r,x,ex,& a(15),b(15),d(15),l(15),u(15),z(15),c(15) Real::u1(100,0:100),v(100,0:100),w1(100,0:100),k(4,2),g(4,2) integer::n=13,i h=(bb-aa)/(n+1) CALL FDM(x,w) Write(*,*)" x exact finite " Write(*,*)"_______________________________" Do i=0,n+1 x=aa+i*h Write(*,22)x,ex(x),w(i) end do 22 FORMAT(4(2X,f13.6)) End Program Subroutine FDM(x,w) Implicit none Real::aa=0.0,bb=atan(1.0),h,w(0:15),p,q,r,x,ex,& a(15),b(15),d(15),l(15),u(15),z(15),c(15) integer::n=13,i w(0)=1.0 w(n+1)=2.0 h=(bb-aa)/(n+1) x=aa+h a(1)=2+(h**2)*q(x) b(1)=-1+(h/2.)*p(x) d(1)=-(h**2)*r(x)+(1+(h/2.)*p(x))*w(0) do i=2,n-1 x=aa+i*h a(i)=2+(h**2*q(x)) b(i)=-1+(h/2.)*p(x) c(i)=-1-(h/2.)*p(x) d(i)=-(h**2)*r(x) end do x=bb-h a(n)=2+(h**2)*q(x) c(n)=-1-(h/2.)*p(x) d(n)=-(h**2)*r(x)+(1-(h/2.)*p(x)) *w(n+1) l(1)=a(1) u(1)=b(1)/a(1) z(1)=d(1)/l(1) do i=2,n-1 l(i)=a(i)-c(i)*u(i-1) u(i)=b(i)/l(i) z(i)=(d(i)-c(i)*z(i-1))/l(i) end do l(n)=a(n)-c(n)*u(n-1) z(n)=(d(n)-c(n)*z(n-1))/l(n) w(n)=z(n) do i=n-1,1,-1 w(i)=z(i)-u(i)*w(i+1) end do End Subroutine Real function p(x) implicit none real::x p=-2.0/x return end function p Real function q(x) implicit none real::x q=2.0/(X**2.0) return end function q Real function r(x) implicit none real::x r=SIN(LOG(x))/(x**2.0) return end function r Real function ex(x) implicit none real::x ex=-0.03920701320*x+(1.1392070132)*(1.0/x**2.0)-(3.0/10.0)*(SIN(LOG(x)))-(1.0/10.0)*(COS(LOG(x))) return end function ex
run
|
edit
|
history
|
help
0
Practice 3
A_02 GUASSIAN ELIMINATION METHOD
Matrix 3×3
Gauss backward elimination
A_04 GUASSIAN QUADRATURE METHOD FOR 3(I) AND 3(II)
Sudoku
problem_4
Chebyshev practice
underoverflow
Practice 4 I