__ Linear Approximation__

Version .92 for MapleVR7

**Summary**

** This worksheet covers some examples of:
tangent planes.
tangent lines.
efficient generation of the linear approximation at a point to a
function using Maple.
comparison of a function from R^2 to R^2 with its linear
approximation.**

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

Warning, the name changecoords has been redefined

`> `
**setoptions3d(axes=framed);**

**A Parabloid.**

`> `
**graph1 := plot3d(x^2+y^2,x=-2..2,y=-2..2,view= -3..3,style=patchcontour):**

The tangent plane through (1,1,2).

`> `
**graph2 := plot3d(2*x+2*y-2,x=-2..2,y=-2..2,grid=[5,5],style=wireframe):**

`> `
**point1 := polyhedraplot([1,1,2],polyscale=.1,polytype=hexahedron,color=red):**

`> `
**display3d({point1,graph1,graph2},axes=framed,orientation=[52,18]);**

**A Saddle.**

`> `
**graph3 := plot3d(x^2-y^2,x=-2..2,y=-2..2,view = -2..2,style=patchcontour):**

The tangent plane through (-1,0,1).

`> `
**graph4 := plot3d(-2*x-1,x=-2..2,y=-2..2,grid=[10,10],style=wireframe):**

`> `
**point2 := polyhedraplot([-1,0,1],polyscale=.1,polytype=hexahedron,color=red):**

`> `
**display3d({point2,graph3,graph4},axes=framed,orientation=[73,60]);**

**Transformations.**

**Load the packages.**

Load transformation functions.

Change
**Pacific**
below to the
** name of your machine**
:

`> `
**read `/othermaple/transform_plots.txt` ;**

Plot Transformation Package Version 1.0

This set of functions aids in transforming two dimensional

plots by functions from R^2 to R^2.

Basic examples include:

P1 := plot(x^2,x=-1..1);

transform_plot(P1,[exp(x)*cos(y),exp(x)*sin(y)],[x,y]);

to transform the graph of the parabola y = x^2 by the map

(x,y) -> [exp(x)*cos(y),exp(x)*sin(y)].

and

transform_rect([2.,2.],[1.,1.],[x^2-y^2,2*x*y],[x,y]);

to display the rectangle with corners [1,1] and [2,2]

together with the image of its boundary under the map

(x,y) -> [x^2-y^2,2*x*y].

Other routines are:

rect_plot([2,4],[3,1]);

to display the rectangle with corners [2,4] and [3,1] and

help_transform_plots();

to display this message.

Load linear algebra package.

`> `
**with(linalg):**

Warning, the protected names norm and trace have been redefined and unprotected

**Plot Transformation by Function.**

Enter an R^2 valued expression as a list.

`> `
**F := [x*cos(y),x*sin(y)]; **

`> `
**transform_rect([.9,.9],[1,1],F,[x,y]); **

**Plot Transformation by Linear Approximation.**

Compute the jacobian.

`> `
**F_deriv := jacobian(F,[x,y]); **

A helper function to evaluate at (.9,.9).

`> `
**eval_fcn := a -> evalf(subs(x=.9,y=.9,a));**

E valuate each entry of F_deriv at the point (.9,.9).

`> `
**L := map(eval_fcn,F_deriv);**

`> `
**val := eval_fcn(F);**

Linear approximation.

`> `
**L_expn :=evalm(L &* vector([x-.9,y-.9])+ val); **

Note the similarity of the image under the linear transformation to the

image under the original function.

`> `
** transform_rect([.9,.9],[1,1],L_expn,[x,y]); **

**Maple Syntax: An aside on map and map2:**

If you want to apply the same function to each entry of a compount object

such as a list, vector, or matrix, then you need to explictly tell Maple

this, using the functions map or map2.

Map applies its first entry (a function) to each operant of its second

argument (e.g. a matrix) and tacks on any additional arguments to each

function call. For example:

`> `
**aa := [seq(x*y+ Pi/i^2,i=1..3)];**

`> `
**map(evalf,aa);**

Map2 is like map except that it applies its first argument (a function like

the substitution function subs) to each operand of its third argument

(e.g. the list) using map2's second argument (e.g. a set of substitutions}

as the first argument of each function call.

Thus the example below substitutes x=u*v and y = u+v in each entry of

the list aa.

`> `
**map2(subs,{x=u*v,y=u+v},aa);**

You can also use functions defined on the fly with map or map2.

`> `
**map(t ->evalf(t^2),aa);**

**Maple Syntax: Another Way to Compute the Linear Approximation:**

This way is easier, but perhaps more demanding of

comfort with programming.

Specify the point where evaluation will happen.

`> `
**pt := [.9,.9];**

The @ sign below is composition, so that each entry will be converted to a decimal.

`> `
**val := map2(evalf@subs,{x=pt[1],y=pt[2]},F);**

`> `
**L := map2(evalf@subs,{x=pt[1],y=pt[2]},F_deriv);**

`> `
**L_expn :=evalm(L &* vector([x-.9,y-.9])+ val); **

`> `

**Images of Tangents to Curves under Transformations.**

Under a function , the tangent line to a curve gets mapped by the derivative to the tangent line of the image curve.

Here's an illustration:

First the helix t-> (cos(t),sin(t),t/20) with a tangent at t= Pi/4:

**Details of drawing the helix with its tangent line.
**

`> `
**helix_param := [cos(t),sin(t),t/20];**

`> `
**helix_gr := spacecurve(helix_param,t = 0 ..20,thickness=3):**

`> `
**helix_point := map(simplify,(map2(subs,t=Pi/4,helix_param)));**

`> `
**helix_tan_vec := map(simplify,(map2(subs,t=Pi/4,map(diff,helix_param,t))));**

`> `
**helix_tan := spacecurve(evalm(helix_point+t*helix_tan_vec),t=-1..1,color=red,thickness=3):**

`> `
**display({helix_tan,helix_gr});**

Now the image of the helix under the map (x,y,z) -> (zx, zy,z).

**Details of drawing the image of the helix with its tangent line.**

`> `

`> `
**F2 := (x,y,z) -> [z*x, z*y, z];**

`> `
**im_helix_param := F2(op(helix_param));**

`> `
**im_helix_gr := spacecurve(im_helix_param,t = 0 ..20,thickness=3):**

`> `
**im_helix_point := map(simplify,(map2(subs,t=Pi/4,im_helix_param)));**

`> `
**im_helix_tan_vec := map(simplify,(map2(subs,t=Pi/4,map(diff,im_helix_param,t))));**

`> `
**im_helix_tan := spacecurve(evalm(im_helix_point+t*im_helix_tan_vec),t=-1..1,color=red,thickness=3):**

`> `
**display({im_helix_gr,im_helix_tan},axes=boxed);**

`> `