LdeApprox[ToRatCoeffs]  - gives rational approximation of LDE coefficients over given interval

Calling Sequence:

     ToRatCoeffs(lde, x = a..b, [m, n])

Parameters:

     lde       - linear differential equation

      x          - independent variable

      a, b     - numerical values specifying the interval of approximation    

      m        - integer specifying the desired degree of the numerator

      n        - integer specifying the desired degree of the denominator

Description:

  • If the given LDE has non-polynomial coefficients one can use the package procedure ToRatCoeffs  which gives a rational approximation of the coefficients. This procedure applies numapprox[minimax]  procedure to each non-polynomial coefficient of the LDE.
  • It should be pointed out that the coefficients can not involve indeterminate variables except independent one. This is a restriction of numapprox  package methods as pure numerical ones.

Examples:

This loads the package.
restart:
with(LdeApprox):

This is a simple LDE with some non-polynomial coefficients.
lde:=diff(y(x),x)+erf(x)*y(x)=0;

lde := diff(y(x),x)+erf(x)*y(x) = 0

Trying to find approximate solution of the IVP: {diff(y(x),x)+erf(x)*y(x) = 0, y(0) = 1}  .
apr = ApproxSol({lde, y(0) = 1}, y(x), x=-1..1, 9);


Error, (in LdeApprox/ivp) erf(x) is not a polynomial on x


Using ToRatCoeffs to convert the LDE into approximate one with polynomial coefficients on the given interval.
lde1 := ToRatCoeffs(lde, y(x), x=-1..1, 9);

lde1 := (-.1801193855e-10+(1.128373221+(.936614810e-10+(-.3760042623+(-.6043134633e-9+(.1121314427+(.1645036543e-8+(-.2517224681e-1+(-.1160467510e-8+.3373170972e-2*x)*x)*x)*x)*x)*x)*x)*x)*x)*y(x)+diff(...
lde1 := (-.1801193855e-10+(1.128373221+(.936614810e-10+(-.3760042623+(-.6043134633e-9+(.1121314427+(.1645036543e-8+(-.2517224681e-1+(-.1160467510e-8+.3373170972e-2*x)*x)*x)*x)*x)*x)*x)*x)*x)*y(x)+diff(...
lde1 := (-.1801193855e-10+(1.128373221+(.936614810e-10+(-.3760042623+(-.6043134633e-9+(.1121314427+(.1645036543e-8+(-.2517224681e-1+(-.1160467510e-8+.3373170972e-2*x)*x)*x)*x)*x)*x)*x)*x)*x)*y(x)+diff(...
lde1 := (-.1801193855e-10+(1.128373221+(.936614810e-10+(-.3760042623+(-.6043134633e-9+(.1121314427+(.1645036543e-8+(-.2517224681e-1+(-.1160467510e-8+.3373170972e-2*x)*x)*x)*x)*x)*x)*x)*x)*x)*y(x)+diff(...

Trying ApproxSol for the new approximate LDE.
apr := ApproxSol({lde1, y(0) = 1}, y(x), x=-1..1, 9);

apr := y(x) = .9999890597+.1751989801e-10*x-.5636204260*x^2-.3094800123e-10*x^3+.2483516267*x^4+.7957121989e-10*x^5-.8692165164e-1*x^6-.1471441464e-9*x^7+.1725316267e-1*x^8+.8201657434e-10*x^9
apr := y(x) = .9999890597+.1751989801e-10*x-.5636204260*x^2-.3094800123e-10*x^3+.2483516267*x^4+.7957121989e-10*x^5-.8692165164e-1*x^6-.1471441464e-9*x^7+.1725316267e-1*x^8+.8201657434e-10*x^9
apr := y(x) = .9999890597+.1751989801e-10*x-.5636204260*x^2-.3094800123e-10*x^3+.2483516267*x^4+.7957121989e-10*x^5-.8692165164e-1*x^6-.1471441464e-9*x^7+.1725316267e-1*x^8+.8201657434e-10*x^9

The exact solution of the IVP is as follows:
sol:=dsolve({lde, y(0) = 1},y(x));

sol := y(x) = exp(1/(Pi^(1/2)))*exp(-(x*erf(x)*Pi^(1/2)+exp(-x^2))/Pi^(1/2))

Comparing the results.
plot(subs(sol,y(x))-subs(apr,y(x)),x=-1..1);

[Maple Plot]

See Also:

LdeApprox