Math-Lsoda
view release on metacpan or search on metacpan
C Store coefficients in ELCO and TESCO. --------------------------------
ELCO(1,NQ) = PINT*RQ1FAC
ELCO(2,NQ) = 1.0D0
DO 130 I = 2,NQ
130 ELCO(I+1,NQ) = RQ1FAC*PC(I)/I
AGAMQ = RQFAC*XPIN
RAGQ = 1.0D0/AGAMQ
TESCO(2,NQ) = RAGQ
IF (NQ .LT. 12) TESCO(1,NQP1) = RAGQ*RQFAC/NQP1
TESCO(3,NQM1) = RAGQ
140 CONTINUE
RETURN
C
200 PC(1) = 1.0D0
RQ1FAC = 1.0D0
DO 230 NQ = 1,5
C-----------------------------------------------------------------------
C The PC array will contain the coefficients of the polynomial
C p(x) = (x+1)*(x+2)*...*(x+nq).
C Initially, p(x) = 1.
C-----------------------------------------------------------------------
FNQ = NQ
NQP1 = NQ + 1
C Form coefficients of p(x)*(x+nq). ------------------------------------
PC(NQP1) = 0.0D0
DO 210 IB = 1,NQ
I = NQ + 2 - IB
210 PC(I) = PC(I-1) + FNQ*PC(I)
PC(1) = FNQ*PC(1)
C Store coefficients in ELCO and TESCO. --------------------------------
DO 220 I = 1,NQP1
220 ELCO(I,NQ) = PC(I)/PC(2)
ELCO(2,NQ) = 1.0D0
TESCO(1,NQ) = RQ1FAC
TESCO(2,NQ) = NQP1/ELCO(1,NQ)
TESCO(3,NQ) = (NQ+2)/ELCO(1,NQ)
RQ1FAC = RQ1FAC/FNQ
230 CONTINUE
RETURN
C----------------------- END OF SUBROUTINE DCFODE ----------------------
END
*DECK DINTDY
SUBROUTINE DINTDY (T, K, YH, NYH, DKY, IFLAG)
C***BEGIN PROLOGUE DINTDY
C***SUBSIDIARY
C***PURPOSE Interpolate solution derivatives.
C***TYPE DOUBLE PRECISION (SINTDY-S, DINTDY-D)
C***AUTHOR Hindmarsh, Alan C., (LLNL)
C***DESCRIPTION
C
C DINTDY computes interpolated values of the K-th derivative of the
C dependent variable vector y, and stores it in DKY. This routine
C is called within the package with K = 0 and T = TOUT, but may
C also be called by the user for any K up to the current order.
C (See detailed instructions in the usage documentation.)
C
C The computed values in DKY are gotten by interpolation using the
C Nordsieck history array YH. This array corresponds uniquely to a
C vector-valued polynomial of degree NQCUR or less, and DKY is set
C to the K-th derivative of this polynomial at T.
C The formula for DKY is:
C q
C DKY(i) = sum c(j,K) * (T - tn)**(j-K) * h**(-j) * YH(i,j+1)
C j=K
C where c(j,K) = j*(j-1)*...*(j-K+1), q = NQCUR, tn = TCUR, h = HCUR.
C The quantities nq = NQCUR, l = nq+1, N = NEQ, tn, and h are
C communicated by COMMON. The above sum is done in reverse order.
C IFLAG is returned negative if either K or T is out of bounds.
C
C***SEE ALSO DLSODE
C***ROUTINES CALLED XERRWD
C***COMMON BLOCKS DLS001
C***REVISION HISTORY (YYMMDD)
C 791129 DATE WRITTEN
C 890501 Modified prologue to SLATEC/LDOC format. (FNF)
C 890503 Minor cosmetic changes. (FNF)
C 930809 Renamed to allow single/double precision versions. (ACH)
C 010418 Reduced size of Common block /DLS001/. (ACH)
C 031105 Restored 'own' variables to Common block /DLS001/, to
C enable interrupt/restart feature. (ACH)
C 050427 Corrected roundoff decrement in TP. (ACH)
C***END PROLOGUE DINTDY
C**End
INTEGER K, NYH, IFLAG
DOUBLE PRECISION T, YH, DKY
DIMENSION YH(NYH,*), DKY(*)
INTEGER IOWND, IOWNS,
1 ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L,
2 LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER,
3 MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU
DOUBLE PRECISION ROWNS,
1 CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND
COMMON /DLS001/ ROWNS(209),
1 CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND,
2 IOWND(6), IOWNS(6),
3 ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L,
4 LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER,
5 MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU
INTEGER I, IC, J, JB, JB2, JJ, JJ1, JP1
DOUBLE PRECISION C, R, S, TP
CHARACTER*80 MSG
C
C***FIRST EXECUTABLE STATEMENT DINTDY
IFLAG = 0
IF (K .LT. 0 .OR. K .GT. NQ) GO TO 80
TP = TN - HU - 100.0D0*UROUND*SIGN(ABS(TN) + ABS(HU), HU)
IF ((T-TP)*(T-TN) .GT. 0.0D0) GO TO 90
C
S = (T - TN)/H
IC = 1
IF (K .EQ. 0) GO TO 15
JJ1 = L - K
DO 10 JJ = JJ1,NQ
10 IC = IC*JJ
15 C = IC
DO 20 I = 1,N
20 DKY(I) = C*YH(I,L)
IF (K .EQ. NQ) GO TO 55
JB2 = NQ - K
DO 50 JB = 1,JB2
J = NQ - JB
( run in 0.753 second using v1.01-cache-2.11-cpan-39bf76dae61 )