XLPack 7.0
XLPack Numerical Library (Excel VBA) Reference Manual
Loading...
Searching...
No Matches

◆ Ylag()

Function Ylag ( I As  Long,
T As  Double,
Phi As  LongPtr,
RCont As  Double,
ICont As  Long 
)

Initial value problem of delay differential equations (5(4)-th order Dorman-Prince method) (Interpolation for back-values of solution)

NOTE - THIS PROGRAM IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION.

Purpose
This routine is the support routine which computes the back-values of the solution by interpolation for solving an initial value problem of the delay differential equations and dense output by Retard.
This routine can be used in the subroutine F which defines the differential equations and in the subroutine Solout for the dense output.
Returns
Double
Interpolated solution Y(I) at T.
Parameters
[in]IElement number of solution to be interpolated. (0 <= I <= N - 1)
[in]TT at which the interpolated solution is computed.
T must be in the interval of the available back steps. Otherwise. 0 will be returned and Retard will be terminated with Info = 14. The number of back steps available through this routine depends on the allocated working memory, and it can be specified by the parameter Mxst of Retard.
[in]PhiUsed defined function which is called when an initial value is required. It must be defined as follows.
Function Phi(I As Long, T As Double) As Double
Phi = the function value Y(I) of component I at T (I = 0 to N - 1) where t0 - τ <= T <= t0.
End Function
where t0 is the initial value of t, and τ is the value of lag. That is, the function value at up to τ before t0 must be defined by Phi. For the components which do not need retarded argument in the definition of differential equations, Phi will not be called, i.e. the value needs not be defined for such element numbers in Phi.
[in]RContControl information for dense output.
Enter parameter value of F or Solout without change.
[in]IContInteger control information for dense output.
Enter parameter value of F or Solout without change.
Reference
E. Hairer, S.P. Norsett and G. Wanner, "Solving Ordinary Differential Equations. Nonstiff Problems. 2nd edition", Springer Series in Computational Mathematics, Springer-Verlag (1993)
Example Program
Define the following delay differential equation.
y'(t) = -y(t-1), where t0 = 0, y(t) = 1 (-1 <= t <= 0)
Sub F(N As Long, T As Double, Y() As Double, Yp() As Double, RCont As Double, ICont As Long)
Yp(0) = -Ylag(0, T-1, AddressOf Phi, RCont, ICont)
End Sub
Function Phi(I As Long, X As Double) As Double
If I = 0 And X >= -1 And X <= 0 Then Phi = 1
End Function
Function Ylag(I As Long, T As Double, Phi As LongPtr, RCont As Double, ICont As Long) As Double
Initial value problem of delay differential equations (5(4)-th order Dorman-Prince method) (Interpola...