1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| implicit none
double precision X,Z,Y,AA,B,H,AN,AE,AO,YA,YB,HX,BN,BE
double precision BO,A1,AC,C,D
integer N1,M1,I1,J2,MM,NN
! External F45 enleve par SB
!two positive integers N1, M1. There will be 2M subintervals for the !outer integral and 2N subintervals for the inner integral
!lower limit of integration AA and upper limit of integration separated B
AA=0
b=5
N1=1000
M1=1000
NN=2*N1+1
MM=2*M1-1
H=(B-AA)/(2*N1)
AN=0
AE=0
AO=0
DO I1=1,NN
y=AA+(I1-1)*H
YA = y
yB=2
HX=(YB-YA)/(2*M1)
BN=F45(y,YA)+F45(y,YB)
BE=0
BO=0
DO J2=1.0,MM
x=YA+(J2-1)*HX
Z=F45(y,x)
IF(J2.EQ.2*(J2/2.0)) THEN
BE=BE+Z
ELSE
BO=BO+Z
END IF
end do
A1=(BN+2*BE+4*BO)*HX/3.0
IF( I1.EQ.1 .OR. I1.EQ.NN ) THEN
AN=AN+A1
ELSE
IF(I1.EQ.2*(I1/2)) THEN
AO=AO+A1
ELSE
AE=AE+A1
END IF
END IF
end do
AC=(AN+2*AE+4*AO)*H/3
Print*, AC
! end enleve par SB
contains ! ajoute par SB
! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
! Fonction à intégrer
DOUBLE PRECISION FUNCTION F45(y,x)
implicit none
double precision x,y
F45=x*y
RETURN
END function ! function ajoute par SB
end program ! ajoute par SB |
Partager