__ Multivariable Taylor Series__

**Summary**

**This worksheet
shows how to compute Taylor series in Maple.
compares the function 1/(x+y^2) with various
asociated Taylor polynomials.
shows how maximum errors tend to depend on the size of the region
being evaluated.
shows how to use estimates on the size of appropriate
partial derivatives to bound the maximal error in using the
Taylor polynomial. (These size estimates are generated by graphs
of the partial derivatives.)**

`> `
**with(plots): with(plottools):**

Warning, the name changecoords has been redefined

Warning, the name arrow has been redefined

We need to load the mtaylor function before doing any multivariable Taylor series.

`> `
**readlib(mtaylor);**

**A Basic Example**

(It is worth noting here how the quality of approximation relates to singularities of the function.)

`> `
**expn := 1/(x+y^2);**

Compute the Taylor series to order 2 (one less than the argument 3) for expn

with respect to the variables x and y about the point (1,1).

`> `
**poly2 :=mtaylor(expn,[x=1,y=1],3);**

Convert all the coefficients to floating point numbers.

`> `
**poly2n := map(evalf,poly2);**

`> `
**gr2 := plot3d(poly2n,x=.5 .. 1.5,y= .5 .. 1.5,color=red):**

`> `
**gr3 := plot3d(expn,x= .5 .. 1.5,y= .5 .. 1.5,color=blue):**

Display both the original function (blue) and the second order Taylor Series (red).

These are tangent to second order at (1,1).

`> `
**display3d({gr3,gr2},axes=framed);**

`> `
**display3d(gr3,axes=framed);**

`> `
**display3d(gr2,axes=framed);**

`> `
**gr4 := plot3d(expn - poly2n,x=.5 .. 1.5,y= .5 .. 1.5):**

Graphin
g the difference makes clear how much error shows up in replacing the

its second order Taylor series.

`> `
**display3d(gr4,axes=framed,shading=zhue);**

Reducing the size of the rectangle by 1/2 appears to reduce the maximum error by around a factor of 10.

Generally, the upper bound on the error would be reduced by at least a factor of 2^3=8.

`> `
**gr5 := plot3d(expn - poly2n,x=0.75.. 1.25,y= 0.75 .. 1.25):**

`> `
**display3d(gr5,axes=framed,shading=zhue);**

By the time we reach points as far out as (3,3), the Taylor series is no longer

converging to the function and the error is large compared to the function.

`> `
**plot3d(expn - poly2n,x=0.5.. 3.0,y= 0.5 .. 3.0,axes=framed,shading=zhue);
**

**Estimating the Error For the
Taylor Series of Order 1:**

Plot the second partial with respect to x and find that it appears to be bounded by 5

in absolute value for the rectangle|x-1| < .5, |y-1|<.5.

`> `
** plot3d(diff(expn,x,x),x=0.5.. 1.5,y= 0.5 .. 1.5,axes=framed,shading=zhue);**

Plot the second mixed partial and find that it also appears to be bounded by 5

in absolute value.

`> `
** plot3d(diff(expn,x,y),x=0.5.. 1.5,y= 0.5 .. 1.5,axes=framed,shading=zhue);
**

Plot the second partial with respect to y and find that it appears to be bounded by 3

in absolute value for the rectangle|x-1| < .5, |y-1|<.5.

`> `
** plot3d(diff(expn,y,y),x=0.5.. 1.5,y= 0.5 .. 1.5,axes=framed,shading=zhue);
**

Using the formula involving derivatives at an unknown point for the the error in the

linear approximation , we estimate that the error should be at most:

`> `
**(1/2) * ( 5* (.5)^2 + 2*5 * (.5)^2 + 3* (.5)^2);**

The actual error appears to be quite a bit smaller than this maximum bound.

(The partials were mostly just big near (.5,.5) so it is not surprising

that the actual errrors never got as big as the conservative estimate above.)

`> `
**plot3d(expn-mtaylor(expn,{x=1,y=1},2),x= .5 .. 1.5,y=.5 ..1.5,axes=framed,shading=zhue);**

Checking the resemblance of the graphs of the second mixed partial and the second partial

with respect to x:

`> `
**diff(expn,x,x) -diff(expn,x,y);**

`> `

`> `

`> `