Changes between Version 5 and Version 6 of fortran
- Timestamp:
- Oct 18, 2016, 9:01:47 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
fortran
v5 v6 2 2 = FORTRAN 95 examples = 3 3 4 == Console1.f90==4 == Integral function calculation using trapeze, rectangle and Simson method == 5 5 {{{ 6 6 #!fortran … … 15 15 S3=0 16 16 do i=0,n 17 S1=S1+(f(i*dx+a)+f((i+1)*dx+a))/2*dx 18 S2=S2+ f(i*dx+a)*dx 17 S1=S1+(f(i*dx+a)+f((i+1)*dx+a))/2*dx !integral which is calculate by trapeze method 18 S2=S2+ f(i*dx+a)*dx !integral which is calculate with rectangle method 19 19 if(mod(i,2)==0) then 20 S3=S3+dx/3*2*f(i*dx+a) 20 S3=S3+dx/3*2*f(i*dx+a) !integral which is calculate by Simson method 21 21 else 22 22 S3=S3+dx/3*4*f(i*dx+a) … … 30 30 31 31 function f(x) 32 f=1/sqrt(1-x**2) 32 f=1/sqrt(1-x**2) !integral function 33 33 end function f 34 34 end 35 35 }}} 36 36 37 == Console2.f90==37 == == 38 38 {{{ 39 39 #!fortran … … 90 90 do i=1,n 91 91 write(1,*) i*dx + a, sin(i*dx+a)*sin(2*i*dx+a)*sin(3*i*dx+a) 92 end do 92 end domethod of 93 93 end 94 94 }}} … … 129 129 130 130 end function 131 print *, s 131 print *, smethod of 132 132 end program 133 133 }}} … … 2945 2945 17 AUX(4,I)=Y(I) 2946 2946 ITEST=1 2947 ISTEP=ISTEP+ISTEP-2 2947 ISTEP=ISTEP+ISTEP-2 Console2.f90 2948 2948 18 IHLF=IHLF+1 2949 2949 X=X-H