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)

Function approximation

Copyright © 2004-2008  DigiArea Group . All rights reserved.

Description:

This worksheet illustrates  LdeApprox  package capability of doing polynomial approximation of a given function. This method can be used if one knows an LDE which the function satisfies. First of all we load LdeApprox package and define a function to approximate and corresponding LDE. Then we use ApproxSol procedure to find 3-rd degree polynomial approximation for the LDE solution on interval x=[-h,h]. Finally we compare the function and corresponding polynomial approximation using Maple™ procedure plot3d .
It should be pointed out that this method of approximation can be used even if the corresponding LDE has non polynomial coefficients. In this case one can use the package procedure
ToRatCoeffs  first to get new LDE with polynomial coefficients and then apply the method (see example with non polynomial coefficients).

This loads the package.

restart:
with(LdeApprox):

Examples:

Let us try to find polynomial approximation of simple function:

fun:=y(x)=exp(-n*x);

fun := y(x) = exp(-n*x)

It is obvious that the function satisfies the following initial value problem:

ivp:={diff(y(x),x)+n*y(x)=0,y(0)=1};

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

Finding 3-rd degree polynomial approximation of the IVP solution on interval [-h, h].

apr:=ApproxSol(ivp, y(x), x=-h..h,3);

apr := y(x) = -16*(-12+n^2*h^2)/(192+n^4*h^4-16*n^2*h^2)+16*n*(-12+n^2*h^2)/(192+n^4*h^4-16*n^2*h^2)*x+96*n^2/(192+n^4*h^4-16*n^2*h^2)*x^2-32*n^3/(192+n^4*h^4-16*n^2*h^2)*x^3
apr := y(x) = -16*(-12+n^2*h^2)/(192+n^4*h^4-16*n^2*h^2)+16*n*(-12+n^2*h^2)/(192+n^4*h^4-16*n^2*h^2)*x+96*n^2/(192+n^4*h^4-16*n^2*h^2)*x^2-32*n^3/(192+n^4*h^4-16*n^2*h^2)*x^3

Comparing exact and approximate results for h = 1 and n = 1/4

plot(subs({h=1,n=1/4},subs(fun,y(x))-subs(apr,y(x))),x=-1..1);

[Maple Plot]

Comparing exact and approximate results for h = 1/2 and n = -3..3  using Maple™  function plot3d

plot3d(subs({h=1/2},subs(fun,y(x))-subs(apr,y(x))),n=-3..3,x=-1/2..1/2,axes=boxed);

[Maple Plot]

Comparing exact and approximate results for n = 1/2 and h = -2..2  using Maple™  function plot3d .

plot3d(subs({n=1/2},subs(fun,y(x))-subs(apr,y(x))),x=-h..h,h=-2..2,axes=boxed);

[Maple Plot]

Not bad for 3-rd degree polynomial approximation, isn't it?