| 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]](prod/LdeApproxMaple/help/images/ApproxSol1.gif)
Example 1 This declares an LDE without any condition: ivp:={diff(y(x),x,x,x)*(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); 
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}; 
x0 = 0 is the middle point of the interval x = -1..1 apr:=ApproxSol(ivp,y(x),x=-1..1,3); 
x0 = 0 is the left point of the interval x = 0..1 apr:=ApproxSol(ivp,y(x),x=0..1,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}; 
x0 = 0 and x1 = 1 then x = 0..1 apr:=ApproxSol(bvp,y(x),x=0..1,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}; 
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); 
Modified a-method: apr1:=ApproxSol(ivp,y(x),x=-1..1,5,method = modified(2)); 
Exact solution: sol:=dsolve(ivp,y(x)); 
Comparing results for classic a-method: plot(subs(sol,y(x))-subs(apr0,y(x)),x=-1..1); ![[Maple Plot]](prod/LdeApproxMaple/help/images/ApproxSol14.gif)
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]](prod/LdeApproxMaple/help/images/ApproxSol15.gif)
Example 5 This declares a homogeneous BVP: bvp:={diff(y(x),x,x) + lambda*y(x) = 0, y(0)=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^(...](prod/LdeApproxMaple/help/images/ApproxSol22.gif)
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...](prod/LdeApproxMaple/help/images/ApproxSol27.gif)
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...](prod/LdeApproxMaple/help/images/ApproxSol32.gif)
Example 6
This declares a simple LDE with polynomial coefficients: 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: apr:=ApproxSol({lde,y(0)=0,D(y)(0)=1}, y(x), x=-1..1, 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)); 
Now one can compare the results using Maple function plot . plot(subs(sol,y(x))-subs(apr,y(x)),x=-1..1); ![[Maple Plot]](prod/LdeApproxMaple/help/images/ApproxSol38.gif)
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); 
Comparing the results: plot(subs(sol,y(x))-subs(apr1,y(x)),x=-1..1); ![[Maple Plot]](prod/LdeApproxMaple/help/images/ApproxSol44.gif)
See Also: LdeApprox |