0% found this document useful (0 votes)
62 views10 pages

Fortran Code For 8-Dimension Definite Integral (F-77)

The code has been compiled and linked with Intel classic compiler. The input file has 6561 coefficients for 8-dim problem. The execution takes hardly one second and result is perfectly ok. This technique can also be used to find differential coefficients for higher order partial differential equations. This will benefit applied researchers. Research process for obtaining coefficients is to be understood. Audience may request for input file on given e-mail address. [email protected] Interest: applied research for expansion of application.

Uploaded by

N. T. Dadlani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views10 pages

Fortran Code For 8-Dimension Definite Integral (F-77)

The code has been compiled and linked with Intel classic compiler. The input file has 6561 coefficients for 8-dim problem. The execution takes hardly one second and result is perfectly ok. This technique can also be used to find differential coefficients for higher order partial differential equations. This will benefit applied researchers. Research process for obtaining coefficients is to be understood. Audience may request for input file on given e-mail address. [email protected] Interest: applied research for expansion of application.

Uploaded by

N. T. Dadlani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Applied research in mathema cs 17-11-2024

Fortran code for 8-dimension definite integral


Abstract

It was a challenge to extend the triple integral formula[2] , based on Simpson’s 1/3rd formula, to higher
dimension. Deriva ons were done from 2 to 8-dimension definite integral. I am sharing an F-77 code
for the benefit of the society and applied researchers. The formula on can be converted to MATLAB
or any other programming language. The input file for 8-dimension integral is having 6561
coefficients. The speed and accuracy of results are mee ng the requirements.

Key words

Simpson’s 1/3rd integra on formula, integra on coefficients, code, execu on me, accuracy of results

N.T.Dadlani

Applied researcher

[email protected]

Introduc on
I was curious to know what is the link between two successive integra on formula [1,2]. It led me to
this development. Now, I can even write code for 20-dimension definite integral. Since, coefficients are
stored in a file, the execu on of main file hardly takes one second. I am appending code and its output.
Many applica ons may be tackled now.

Execu on
Code has been wri en in Fortran-77 and proper loops have been provided for itera on. The
coefficients have been derived ,as below, for various dimensions of definite integral:

2-dimension: 9 coefficients

3-dimension: 27 coefficients

4-dimension: 81 -do-

5-dimension: 243 -do-

6-dimension: 729 -do-

7-dimension: 2187 -do-

8-dimension: 6561 -do

9-dimension: 19683 -do-

10-dimension: 59049 -do-

Conclusion:
The code has been successfully compiled and linked with INTEL classic compiler and checked the
output for 8-dimension integral. The execu on was done in less than one second. The results are
perfectly ok.
Applied research in mathema cs 17-11-2024

The above technique can be used for numerical differen a on to find out the coefficients of
differen a on.

Bibliography
1 [J. M. McCormick & M. G. Salvadori] Numerical Methods in Fortran,

Pren ce Hall

[Mathew N.O. Sadiku] Computa onal electromagne c with MATLAB, 4e


2

Annexures

- Example (8-dimension definite integral)


- Fortran code in F77
- Output sheet
17-11-2024

Numerical Integration from 2 to 8 dimensions 17-11-2024

XA := 0 XB := 1 YA := 0 YB := 1

1 1
  2 7
  ( x + y) dx dy =
  6
0 0

================================
XA := 0 XB := 1 YA := 0 YB := 1 ZA := 0 ZB := 1

1 1 1
   2 5
   ( x + y + z ) dx dy dz =
   2
0 0 0

============================================================

XA := 0 XB := 1 YA := 0 YB := 1 ZA := 0 ZB := 1

WA := 0 WB := 1

1 1 1 1
    2 13
    ( x + y + z + w) dx dy dz dw =
    3
0 0 0 0
=======================================================

XA := 0 XB := 1 YA := 0 YB := 1 ZA := 0 ZB := 1

WA := 0 WB := 1 VA := 0 VB := 1

1 1 1 1 1
     2 20
     ( x + y + z + w + v) dx dy dz dw dv = = 6.667
     3
0 0 0 0 0
========================================================

XA := 0 XB := 1 YA := 0 YB := 1 ZA := 0 ZB := 1

WA := 0 WB := 1 VA := 0 VB := 1 UA := 0 UB := 1

1 1 1 1 1 1
      2 19
      ( x + y + z + w + v + u ) dx dy dz dw dv du = 9.5
      2
0 0 0 0 0 0
========================================================

num_intg8.xmcd 1
17-11-2024

XA := 0 XB := 1 YA := 0 YB := 1 ZA := 0 ZB := 1

WA := 0 WB := 1 VA := 0 VB := 1 UA := 0 UB := 1

SA := 0 SB := 1

1 1 1 1 1 1 1
       2 77
       ( x + y + z + w + v + u + s) dx dy dz dw dv du ds = = 12.833
       6
0 0 0 0 0 0 0

===========================================================

XA := 0 XB := 1 YA := 0 YB := 1 ZA := 0 ZB := 1

WA := 0 WB := 1 VA := 0 VB := 1 UA := 0 UB := 1

SA := 0 SB := 1 RA := 0 RB := 1

1 1 1 1 1 1 1 1
        2 50
        ( x + y + z + w + v + u + s + r) dx dy dz dw dv du ds dr =
        3
0 0 0 0 0 0 0 0
Present case
==================================================================

XA := 0 XB := 1 YA := 0 YB := 1 ZA := 0 ZB := 1

WA := 0 WB := 1 VA := 0 VB := 1 UA := 0 UB := 1

SA := 0 SB := 1 RA := 0 RB := 1 QA := 0 QB := 1

PA := 0 PB := 1

1 1 1 1 1 1 1 1 1 1
          2
           x + y + z ...  dx dy dz dw dv du ds dr dq dp = 22.44
           + w + v + u ...
           + s + r + q ... 
          + p 
         
0 0 0 0 0 0 0 0 0 0

num_intg8.xmcd 2
17-11-2024

C INTEG8.FOR (20-02-2017)
C Ref:- Numerical methods in Fortran
C J.M.McCormick and M.G.Salvadori
C Program no.9.9a/Page 316
C Theory on page 121
C
C 8-Dimension Definite Integral, TERMS=3^8=6561, SUMM(K), K=4
C
DIMENSION CO (6561),FZ(6561),SUMM(4),X(3),Y(3),Z(3),
1 W(3),V(3),U(3),S(3),R(3)
C
NI=50
NO=66
C
OPEN (UNIT=50,FILE='INTEG8.TXT')
OPEN (UNIT=66,FILE='INTEG8.OP')
C
DO 20 N=1,6561
READ(NI,*) CO(N)
WRITE (NO,010) CO(N)
010 FORMAT (16X,8HCO(N) = ,E)
20 CONTINUE
C
C WRITE(*,*)'NUMX,NUMY,...,XA ,XB ,YA , YB... '

C WRITE(*,*)' 1 , 1 ,...,0 , 1 , 0 , 1... '


C WRITE(*,*)
C1 READ (*,*) NUMX,NUMY,....XA,XB,YA,YB,....
C WRITE(*,*)
C Limits:
NUMX=1
NUMY=1
NUMZ=1
NUMW=1
NUMV=1
NUMU=1
NUMS=1
NUMR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 J4=1,3
DO 115 J5=1,3
DO 116 J6=1,3
DO 117 J7=1,3
DO 118 J8=1,3
KOUNT=KOUNT+1
FN=F(X(J1),Y(J2),Z(J3),W(J4),V(J5),U(J6),S(J7),R(J8))
FZ(KOUNT)=FN
SUM=SUM+(XH*YH*ZH*WH*VH*UH*SH*Rh/6561)*FZ(KOUNT)*CO(KOUNT)
118 CONTINUE
117 CONTINUE
116 CONTINUE
115 CONTINUE
114 CONTINUE
113 CONTINUE
112 CONTINUE
111 CONTINUE
C
C DO 301 KOUNT=1,6561
C301 PRINT 300,FZ(KOUNT)
C300 FORMAT (16X,F10.5)
C
R(1)=R(3)
R(2)=R(1)+RH
30 R(3)=R(2)+RH
C
S(1)=S(3)
S(2)=S(1)+SH
40 S(3)=S(2)+SH
C
U(1)=U(3)
U(2)=U(1)+UH
50 U(3)=U(2)+UH
C
V(1)=V(3)
V(2)=V(1)+VH
60 V(3)=V(2)+VH
C
W(1)=W(3)
W(2)=W(1)+WH
70 W(3)=W(2)+WH
C
Z(1)=Z(3)
Z(2)=Z(1)+ZH
80 Z(3)=Z(2)+ZH
C
Y(1)=Y(3)
Y(2)=Y(1)+YH
90 Y(3)=Y(2)+YH
C
X(1)=X(3)
X(2)=X(1)+XH
100 X(3)=X(2)+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 Ex-1
C Limits: XA=0, XB=1., YA=0 ,YB=1.,ZA=0., ZB=1.,WA=0, WB=1.
C VA=0.,VB=1., UA=0.,UB=1.,SA=0., SB=1.,RA=0.,RB=1.
C NUMX=1, NUMY=1, NUMZ=1, NUMW=1....
C I= 16.667 ..MATLAB (I=16.667,@ K= 1)
FUNCTION F(X,Y,Z,W,V,U,S,R)
F=(X+Y+Z+W+V+U+S+R)**2
RETURN
END
INTEG8_OP1

17-11-2024

RESULTS FROM PROGRAM 9.9A

LIMITS OF INTEGRATION
NUMX = 1 NUMY = 1
XA = 0.0000000E+00 XB = 0.1000000E+01
YA = 0.0000000E+00 YB = 0.1000000E+01

K XH YH INTEGRAL
1 0.50000 0.50000 0.1666689E+02
2 0.25000 0.25000 0.1667004E+02

You might also like