Вы находитесь на странице: 1из 4

Applied research series Book

10-06-2018

Subject: “Fortran-77/MATLAB Codes for Numerical Integration”: Part-02 to Part-07

I am appending “Fortran Codes for Numerical Integration”, based on the Simpson’s 1/3rd formula.
These source codes have been developed by me. I am appending PDF file showing relevant
functions up to “7-dimension definite Integral”.

FORTRAN 77 codes have successively been run up to 7-dimension. The execution completes in few
seconds and accuracy of results has been excellent. Necessary conditions can be inserted in the
program according to complexity of function.

The above codes could easily be converted, by users, for MATLAB or any other language.

Now, MATLAB codes are also available with author (tested up to 10-dimension definite integral).

Research process can also be shared during deal. Interested parties may send me a request for
commercial dealings.

Thanks,

N.T.Dadlani

nanak.dadlani@gmail.com

TOC:
chapter-01: Research process - Not included for commercial reasons
chapter-02: 2-dimension definite integral : pp-002
chapter-03: not included : -
chapter-04: 4-dimension definite integral : pp-005
chapter-05: 5-dimension definite integral : pp-010
chapter-06: 6-dimension definite integral : pp-019
chapter-07: 7-dimension definite integral : pp-040
chapter-08: not included for commercial reasons : pp-095 to 248
chapter-09: -do-
chapter-10: -do-
chapter-11: -do-
Fortran codes for Numerical Integration
Chapter-02 Edition-1, 2018

Applied research series


Based on Simpson’s 1/3rd formula: Definite Integral
- double integration … 9 functions
- triple integration … 27 –do-
- 4 -dimension integration … 81 –do-
- 5 -dimension integration … 243 –do-
- 6 -dimension integration … 729 –do-
- 7 -dimension integration … 2187 –do-
- 8 -dimension integration … 6561 –do-

N. T. Dadlani
nanak.dadlani@gmail.com

10-06-2018
INTEG2A
C INTEG2.FOR (18-04-2016)
C
C Ref:- Numerical methods in Fortran
C J.M.McCormick and M.G.Salvadori
C
C DOUBLE INTEGRAL
C
DIMENSION SUMM(10)
C WRITE(*,*)'NUMX,NUMY,XA ,XB ,YA , YB '
C WRITE(*,*)' 1 , 1 ,0 , 1 , 0 , 2'
C WRITE(*,*)
C1 READ (*,*) NUMX,NUMY,XA,XB,YA,YB
C WRITE(*,*)
C
NUMX=1
NUMY=1
XA=0.
XB=1.
YA=0.
YB=1.
C
PRINT 998, NUMX,NUMY,XA,XB,YA,YB
C
DO 200 K=1,4
NUMMX=NUMX*K
NUMMY=NUMY*K
C
XSTRIP=2.*NUMMX
YSTRIP=2.*NUMMY
C
C
XH=(XB-XA)/XSTRIP
YH=(YB-YA)/YSTRIP
C
C
SUM=0.0
C
X1=XA
X2=X1+XH
X3=X2+XH
C
DO 100 I=1,NUMMX
Y1=YA
Y2=Y1+YH
Y3=Y2+YH
C
DO 90 M=1,NUMMY
C
F1=F(X1,Y1)
F2=F(X2,Y1)
F3=F(X3,Y1)
C
F4 =F(X1,Y2)
F5 =F(X2,Y2)
F6 =F(X3,Y2)
C
F7 =F(X1,Y3)
F8 =F(X2,Y3)
F9 =F(X3,Y3)
C
FF1=F1+F3+F7+F9
FF2=F2+F4+F6+F8
FF3=F5
C
SUM=SUM+(XH*YH/9.)*(FF1 +4.*FF2 +16.*FF3)
C
Y1=Y3
Y2=Y1+YH
90 Y3=Y2+YH
C
Page 1
INTEG2A
X1=X3
X2=X1+XH
100 X3=X2+XH
C
PRINT 997,K,XH,YH,SUM
C
200 SUMM(K)=SUM
C INTRODUCE STATEMENT "GO TO 1" TO SEE VARIOUS OUTPUTS BY
C CHANGING INPUT VALUES
C
C GO TO 1
C
997 FORMAT (I18,2F10.5,E17.7)
998 FORMAT (//23X,26HRESULTS FROM PROGRAM 9.9A
$ //25X,21HLIMITS OF INTEGRATION
$ / 16X,7HNUMX = ,I4,4X,7HNUMY = ,I4
$ /16X,4HXA = ,E14.7,4X,4HXB = ,E14.7 / 16X,4HYA = ,E14.7,
$ 4X,4HYB = ,E14.7/
$ //17X,1HK ,6X,2HXH ,8X,2HYH ,8X,8HINTEGRAL)
C
C
END
C EX1
C LIMITS XA=0,XB=1
C YA=0,YB=2
C NUMX=1,NUMY=1
C I=3.684 MATHCAD (PROGRAM ..I=3.6834)
C
C FUNCTION F(X,Y)
C F=EXP(X*Y)
C RETURN
C END
C
C Ex-5
C Limits: XA=0, XB=1., YA=0 ,YB=1.
C NUMX=1, NUMY=1
C I= 1.167 ..Mathcad (I= ,K=4)
FUNCTION F(X,Y)
F=(X+Y)**2
RETURN
END
C
C

Page 2

Вам также может понравиться