Digi Area Group - Math Tools for Professionals
   Maple and Mathematica packages - math tools for professionals

LdeApprox™  - analytical approximation methods for Maple™

> Features List & Examples
> Screenshots
> Documentation & Downloads
> License & Pricing
> Buy Online

 
 
 
 
Google

Description  |  Features List & Examples  |  Introduction  |  Analitical approximations  |  Ref. Manual PDF (2M)

LdeApprox[ApproxSol]  - find polynomial approximation for solutions of an LDE with polynomial coefficients

Calling Sequence:

     ApproxSol( {lde, cond}, y(x), x = a..b, n, opt)

Parameters:

     lde - an LDE with polynomial coefficients

      y(x) - any indeterminate function of one variable

     n - degree of the polynomial approximation
     x = a..b - interval of the approximation (a, b can be symbolic or numeric)

     cond - (optional)  initial or boundary conditions

      opt - (optional) options

Description:

  • ApproxSol  procedure find polynomial approximation for solutions of an LDE with polynomial coefficients using a-method .
  • The approximation problem can be treated as initial value problem (IVP) or boundary value problem (BVP) with regular singular points (RSP) or without them. The treatment is as follows.
  • If no condition (cond) presented the problem treated as IVP and the initial point of the approximation is the middle point of the giving interval: x0=(a+b)/2 (see Example 1 ).
  • If condition (cond) is one point condition (for instance cond is y(x0)=0, D(y)(x0)=1, ... with one point x0) then  the problem treated as IVP and x0 must be the middle point or the left point of the approximation interval, thus  x0 = (a+b)/2 or x0 = a (see Example 2 ).
  •  If condition (cond) is two points condition (for instance cond is y(x0)=0, D(y)(x1)=1, ... with two points x0 and x1) then the problem is treated as BVP and it must be x0 = a and x1 = b or x0 = b and x1 = a (see Example 3 ).
  • If an LDE has an RSP then it must be the left point of the interval of approximation (see RSP examples ).
  • The options available are (with default values):
    method = classic  - method of approximation (see Example 4 );
    exact = true
    - mode of calculation (makes effect for homogeneous BVP only; see also LdeApprox[Normalize] ) , if exact = true then the procedure uses exact arithmetic to calculate corresponding eigenvalues (see Example 5 );
    eigenvalue = NULL
     - eigenvalue variable name (makes effect for homogeneous BVP only; see also LdeApprox[Normalize] ), if not specified the procedure assumes that any indeterminate in lde  and cond  can be taken as an eigenvalue variable and  makes calculation for each indeterminate in turn (see Example 5 ) .
  • The a-method  is fast saturated and gives uniform approximation (see Example 6 ).

Examples:

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

[ApproxSol, Normalize, ToRatCoeffs]

Example 1

This declares an LDE without any condition:
ivp:={diff(y(x),x,x,x)*(1+x^2) = 1};

ivp := {diff(y(x),`$`(x,3))*(1+x^2) = 1}

As no condition presented  the approximation has been done in the middle of the given interval: x=0..1, so x0=1/2
apr:=ApproxSol(ivp,y(x),x=0..1,3);

apr := y(x) = y(1/2)+1/4920+(13/24600+D(y)(1/2))*(x-1/2)+(-397/61500+1/2*`@@`(D,2)(y)(1/2))*(x-1/2)^2+16/123*(x-1/2)^3
apr := y(x) = y(1/2)+1/4920+(13/24600+D(y)(1/2))*(x-1/2)+(-397/61500+1/2*`@@`(D,2)(y)(1/2))*(x-1/2)^2+16/123*(x-1/2)^3

Example 2

This declares an IVP with one point condition:
ivp:={diff(y(x),x,x,x)*(1+x^2) = 1, y(0)=A, D(y)(0)=B};

ivp := {diff(y(x),`$`(x,3))*(1+x^2) = 1, y(0) = A, D(y)(0) = B}

x0 = 0 is the middle point of the interval x = -1..1
apr:=ApproxSol(ivp,y(x),x=-1..1,3);

apr := y(x) = A+(B+1/216)*x+1/2*`@@`(D,2)(y)(0)*x^2+4/27*x^3

x0 = 0 is the left point of the interval x = 0..1
apr:=ApproxSol(ivp,y(x),x=0..1,3);

apr := y(x) = A+3/13120+(B-9/1312)*x+(397/13120+1/2*`@@`(D,2)(y)(0))*x^2+16/123*x^3

error otherwise
apr:=ApproxSol(ivp,y(x),x=-1..2,3);


Error, (in ApproxSol) initial conditions {y(0) = A, D(y)(0) = B} are not set properly on interval [-1, 2]



Example 3

This declares a BVP with two point condition:
bvp:={diff(y(x),x,x,x)*(1+x^2) = 1, y(0)=A, y(1)+D(y)(0)=B,`@@`(D,2)(y)(0)=C};

bvp := {diff(y(x),`$`(x,3))*(1+x^2) = 1, y(1)+D(y)(0) = B, y(0) = A, `@@`(D,2)(y)(0) = C}

x0 = 0 and x1 = 1 then x = 0..1
apr:=ApproxSol(bvp,y(x),x=0..1,3);

apr := y(x) = A+3/13120+(-13169/157440+1/2*B-1/2*A-1/4*C)*x+(397/13120+1/2*C)*x^2+16/123*x^3

error otherwise
apr:=ApproxSol(bvp,y(x),x=-1..1,3);


Error, (in ApproxSol) boundary conditions {y(1)+D(y)(0) = B, y(0) = A, @@(D,2)(y)(0) = C} are not set properly on interval [-1, 1]



Example 4

This declares a simple IVP:
ivp:={diff(y(x),x)*(1+x^2) = 1,y(0)=0};

ivp := {y(0) = 0, diff(y(x),x)*(1+x^2) = 1}

Now one can use ApproxSol function to find polynomial approximation of solution of the IVP by classic or modified a-method

Classic a-method:
apr0:=ApproxSol(ivp,y(x),x=-1..1,5,method = classic);

apr0 := y(x) = 168/169*x-48/169*x^3+64/845*x^5

Modified a-method:
apr1:=ApproxSol(ivp,y(x),x=-1..1,5,method = modified(2));

apr1 := y(x) = (-815/82+317/41*2^(1/2))*x+(-686/123+460/123*2^(1/2))*x^3+(3976/205-560/41*2^(1/2))*x^5

Exact solution:
sol:=dsolve(ivp,y(x));

sol := y(x) = arctan(x)

Comparing results for classic a-method:
plot(subs(sol,y(x))-subs(apr0,y(x)),x=-1..1);

[Maple Plot]

Comparing results for modified a-method (more uniform and precise approximation):
plot(subs(sol,y(x))-subs(apr1,y(x)),x=-1..1);

[Maple Plot]

Example 5

This declares a homogeneous BVP:
bvp:={diff(y(x),x,x) + lambda*y(x) = 0, y(0)=0, y(Pi)=0};

bvp := {y(0) = 0, diff(y(x),`$`(x,2))+lambda*y(x) = 0, y(Pi) = 0}

exact = true - slow mode of calculation (egenvalue is not specified)
apr:=ApproxSol(bvp,y(x),x=0..Pi,3);


Warning, No eigenvalue variable specified. Trying to determine ...



Warning, lambda - is the eigenvalue variable.


apr := [[lambda = 16/Pi^4*(10*Pi^2+2*22^(1/2)*Pi^2), y(x) = _C1*(5/48*Pi^2+1/48*22^(1/2)*Pi^2-Pi*x+x^2)], [lambda = 16/Pi^4*(10*Pi^2-2*22^(1/2)*Pi^2), y(x) = _C1*(1-16/Pi*(5+22^(1/2))*x+16/Pi^2*(5+22^(...
apr := [[lambda = 16/Pi^4*(10*Pi^2+2*22^(1/2)*Pi^2), y(x) = _C1*(5/48*Pi^2+1/48*22^(1/2)*Pi^2-Pi*x+x^2)], [lambda = 16/Pi^4*(10*Pi^2-2*22^(1/2)*Pi^2), y(x) = _C1*(1-16/Pi*(5+22^(1/2))*x+16/Pi^2*(5+22^(...
apr := [[lambda = 16/Pi^4*(10*Pi^2+2*22^(1/2)*Pi^2), y(x) = _C1*(5/48*Pi^2+1/48*22^(1/2)*Pi^2-Pi*x+x^2)], [lambda = 16/Pi^4*(10*Pi^2-2*22^(1/2)*Pi^2), y(x) = _C1*(1-16/Pi*(5+22^(1/2))*x+16/Pi^2*(5+22^(...
apr := [[lambda = 16/Pi^4*(10*Pi^2+2*22^(1/2)*Pi^2), y(x) = _C1*(5/48*Pi^2+1/48*22^(1/2)*Pi^2-Pi*x+x^2)], [lambda = 16/Pi^4*(10*Pi^2-2*22^(1/2)*Pi^2), y(x) = _C1*(1-16/Pi*(5+22^(1/2))*x+16/Pi^2*(5+22^(...
apr := [[lambda = 16/Pi^4*(10*Pi^2+2*22^(1/2)*Pi^2), y(x) = _C1*(5/48*Pi^2+1/48*22^(1/2)*Pi^2-Pi*x+x^2)], [lambda = 16/Pi^4*(10*Pi^2-2*22^(1/2)*Pi^2), y(x) = _C1*(1-16/Pi*(5+22^(1/2))*x+16/Pi^2*(5+22^(...
apr := [[lambda = 16/Pi^4*(10*Pi^2+2*22^(1/2)*Pi^2), y(x) = _C1*(5/48*Pi^2+1/48*22^(1/2)*Pi^2-Pi*x+x^2)], [lambda = 16/Pi^4*(10*Pi^2-2*22^(1/2)*Pi^2), y(x) = _C1*(1-16/Pi*(5+22^(1/2))*x+16/Pi^2*(5+22^(...

exact = false - fast mode of calculation (egenvalue is not specified)
apr:=ApproxSol(bvp,y(x),x=0..Pi,3,exact=false);


Warning, No eigenvalue variable specified. Trying to determine ...



Warning, lambda - is the eigenvalue variable.


apr := [[lambda = 1.003758132, y(x) = _C1*(-.1539637776e-1+.7598556186*x-.2418695552*x^2-.6769077006e-10*x^3)], [lambda = 4.097906880, y(x) = _C1*(-.1611511607e-1+.6596284448*x-.6201019531*x^2+.1315897...
apr := [[lambda = 1.003758132, y(x) = _C1*(-.1539637776e-1+.7598556186*x-.2418695552*x^2-.6769077006e-10*x^3)], [lambda = 4.097906880, y(x) = _C1*(-.1611511607e-1+.6596284448*x-.6201019531*x^2+.1315897...
apr := [[lambda = 1.003758132, y(x) = _C1*(-.1539637776e-1+.7598556186*x-.2418695552*x^2-.6769077006e-10*x^3)], [lambda = 4.097906880, y(x) = _C1*(-.1611511607e-1+.6596284448*x-.6201019531*x^2+.1315897...
apr := [[lambda = 1.003758132, y(x) = _C1*(-.1539637776e-1+.7598556186*x-.2418695552*x^2-.6769077006e-10*x^3)], [lambda = 4.097906880, y(x) = _C1*(-.1611511607e-1+.6596284448*x-.6201019531*x^2+.1315897...
apr := [[lambda = 1.003758132, y(x) = _C1*(-.1539637776e-1+.7598556186*x-.2418695552*x^2-.6769077006e-10*x^3)], [lambda = 4.097906880, y(x) = _C1*(-.1611511607e-1+.6596284448*x-.6201019531*x^2+.1315897...

declare egenvalue = lambda and exact = false mode of calculation
apr:=ApproxSol(bvp,y(x),x=0..Pi,3,exact=false,eigenvalue=lambda);

apr := [[lambda = 1.003758132, y(x) = _C1*(-.1539637776e-1+.7598556186*x-.2418695552*x^2-.6769077006e-10*x^3)], [lambda = 4.097906880, y(x) = _C1*(-.1611511607e-1+.6596284448*x-.6201019531*x^2+.1315897...
apr := [[lambda = 1.003758132, y(x) = _C1*(-.1539637776e-1+.7598556186*x-.2418695552*x^2-.6769077006e-10*x^3)], [lambda = 4.097906880, y(x) = _C1*(-.1611511607e-1+.6596284448*x-.6201019531*x^2+.1315897...
apr := [[lambda = 1.003758132, y(x) = _C1*(-.1539637776e-1+.7598556186*x-.2418695552*x^2-.6769077006e-10*x^3)], [lambda = 4.097906880, y(x) = _C1*(-.1611511607e-1+.6596284448*x-.6201019531*x^2+.1315897...
apr := [[lambda = 1.003758132, y(x) = _C1*(-.1539637776e-1+.7598556186*x-.2418695552*x^2-.6769077006e-10*x^3)], [lambda = 4.097906880, y(x) = _C1*(-.1611511607e-1+.6596284448*x-.6201019531*x^2+.1315897...
apr := [[lambda = 1.003758132, y(x) = _C1*(-.1539637776e-1+.7598556186*x-.2418695552*x^2-.6769077006e-10*x^3)], [lambda = 4.097906880, y(x) = _C1*(-.1611511607e-1+.6596284448*x-.6201019531*x^2+.1315897...


Example 6

This declares a simple LDE with polynomial coefficients:
lde := diff(y(x),`$`(x,2))-x*y(x)=0;

lde := diff(y(x),`$`(x,2))-x*y(x) = 0

Now one can use ApproxSol function to find polynomial approximation of solution of the following IVP:
{diff(y(x),`$`(x,2))-x*y(x), y(0) = 0, D(y)(0) = 1}
apr:=ApproxSol({lde,y(0)=0,D(y)(0)=1}, y(x), x=-1..1, 5);

apr := y(x) = 143376/90608760661+90628433408/90608760661*x-5898560/271826281983*x^2-157358080/90608760661*x^3+7554334848/90608760661*x^4+943996928/271826281983*x^5
apr := y(x) = 143376/90608760661+90628433408/90608760661*x-5898560/271826281983*x^2-157358080/90608760661*x^3+7554334848/90608760661*x^4+943996928/271826281983*x^5

Using Maple™ function dsolve  to get the exact solution of the IVP.
sol:=dsolve({lde,y(0)=0,D(y)(0)=1},y(x));

sol := y(x) = -1/3*Pi/GAMMA(2/3)*3^(5/6)*AiryAi(x)+1/3*Pi/GAMMA(2/3)*3^(1/3)*AiryBi(x)

Now one can compare the results using Maple™ function plot .
plot(subs(sol,y(x))-subs(apr,y(x)),x=-1..1);

[Maple Plot]

The a-method  is fast saturated. To see this one can try to calculate the approximation polynomial of 9-degree or higher.
apr1:=ApproxSol({lde,y(0)=0,D(y)(0)=1}, y(x), x=-1..1, 9);

apr1 := y(x) = 67659191912680/1571053795006622303469+14139484231168032264448/14139484155059600731221*x-91337464726325440/42418452465178802193663*x^2-1420679842795520/14139484155059600731221*x^3+3928446...
apr1 := y(x) = 67659191912680/1571053795006622303469+14139484231168032264448/14139484155059600731221*x-91337464726325440/42418452465178802193663*x^2-1420679842795520/14139484155059600731221*x^3+3928446...
apr1 := y(x) = 67659191912680/1571053795006622303469+14139484231168032264448/14139484155059600731221*x-91337464726325440/42418452465178802193663*x^2-1420679842795520/14139484155059600731221*x^3+3928446...
apr1 := y(x) = 67659191912680/1571053795006622303469+14139484231168032264448/14139484155059600731221*x-91337464726325440/42418452465178802193663*x^2-1420679842795520/14139484155059600731221*x^3+3928446...
apr1 := y(x) = 67659191912680/1571053795006622303469+14139484231168032264448/14139484155059600731221*x-91337464726325440/42418452465178802193663*x^2-1420679842795520/14139484155059600731221*x^3+3928446...

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

[Maple Plot]

See Also:

LdeApprox