- #1

- 10

- 0

Method1

Fortran:

```
REAL::DT,DT1,DK1,DK2
INTEGER::IM,I,IL
REAL,DIMENSION(30,50000)::AN,BN,AN1,BN1
REAL,DIMENSION(30)::XA,XB
DO I=1,30 ! NO. OF LINES TO READ PARAMETERS USED IN SUBROUTINES
IM=1 !INITIALISE
AN(I,IM)=0.0
BN(I,IM)=0.0
DT=0.1
DT1=0.001
DO WHILE(DK1<=100) !TIME STEP FOR INTEGRATION
DO WHILE(DK2<=1000) !CALCULATE MATRIX
CALL XAA(AN(I,IM),BN(I,IM),XA)
CALL XBB(AN(I,IM),BN(I,IM),XB)
AN(I,IM+1)=AN(I,IM)+XA(I)*DT1
AB(I,IM+1)=AB(I,IM)+XB(I)*DT1
AN1(I,IL)=AN(I,IM+1) !INTERCHANGE TO REDUCE MEMORY STORAGE & ITERATE
BN1(I,IL)=BN(I,IM+1)
AN(I,IM)=AN1(I,IL)
BN(I,IM)=BN1(I,IL)
DK2=DK2+DT1
ENDDO
AN(I,INT(DK1))=AN(I,IM)
BN(I,INT(DK1))=BN(I,IM)
WRITE(*,*)I,AN(I,INT(DK1)),BN(I,INT(DK1))
DK1=DK1+DT
ENDDO
ENDDO
```

Method2

Fortran:

```
REAL::DT,DT1,DK2
INTEGER::IM,I,E,IL,DK1
REAL,DIMENSION(30,50000)::AN,BN,AN1,BN1
REAL,DIMENSION(30)::XA,XB
DO I=1,30 ! NO. OF LINES TO READ PARAMETERS USED IN SUBROUTINES
IM=1 !INITIALISE
AN(I,IM)=0.0
BN(I,IM)=0.0
DT=0.1
DT1=0.001
DO DK1=1,100 !TIME STEP FOR INTEGRATION
E=REAL(DK1)*0.1
DO WHILE(DK2<=1000) !CALCULATE MATRIX
CALL XAA(AN(I,IM),BN(I,IM),XA)
CALL XBB(AN(I,IM),BN(I,IM),XB)
AN(I,IM+1)=AN(I,IM)+XA(I)*DT1
AB(I,IM+1)=AB(I,IM)+XB(I)*DT1
AN1(I,IL)=AN(I,IM+1) !INTERCHANGE TO REDUCE MEMORY STORAGE & ITERATE
BN1(I,IL)=BN(I,IM+1)
AN(I,IM)=AN1(I,IL)
BN(I,IM)=BN1(I,IL)
DK2=DK2+DT1
ENDDO
AN(I,E)=AN(I,IM)
BN(I,E)=BN(I,IM)
WRITE(*,*)I,AN(I,E),BN(I,E)
ENDDO
ENDDO
```