Linear Approximation

Version .92 for MapleVR7


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

> 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]);

[Maple Plot]

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]);

[Maple Plot]


Load the packages.

Load transformation functions.
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);


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

(x,y) -> [exp(x)*cos(y),exp(x)*sin(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:


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


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)];

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

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

[Maple Plot]

Plot Transformation by Linear Approximation.

Compute the jacobian.

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

F_deriv := matrix([[cos(y), -x*sin(y)], [sin(y), x*...

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

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

eval_fcn := proc (a) options operator, arrow; evalf...

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

> L := map(eval_fcn,F_deriv);

L := matrix([[.6216099683, -.7049942186], [.7833269...

> val := eval_fcn(F);

val := [.5594489715, .7049942186]

Linear approximation.

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

L_expn := vector([.6216099683*x+.6344947967-.704994...

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 Plot]

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);

aa := [x*y+Pi, x*y+1/4*Pi, x*y+1/9*Pi]

[x*y+3.141592654, x*y+.7853981635, x*y+.3490658504]...

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);

[u*v*(u+v)+Pi, u*v*(u+v)+1/4*Pi, u*v*(u+v)+1/9*Pi]

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

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

[(x*y+3.141592654)^2, (x*y+.7853981635)^2, (x*y+.34...

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];

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);

val := [.5594489715, .7049942186]

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

L := matrix([[.6216099683, -.7049942186], [.7833269...

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

L_expn := vector([.6216099683*x+.6344947967-.704994...


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_param := [cos(t), sin(t), 1/20*t]

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

helix_point := [1/2*sqrt(2), 1/2*sqrt(2), 1/80*Pi]

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

helix_tan_vec := [-1/2*sqrt(2), 1/2*sqrt(2), 1/20]

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

> display({helix_tan,helix_gr});

[Maple Plot]

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];

F2 := proc (x, y, z) options operator, arrow; [z*x,...

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

im_helix_param := [1/20*t*cos(t), 1/20*t*sin(t), 1/...

> 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_point := [1/160*Pi*sqrt(2), 1/160*Pi*sqrt(...

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

im_helix_tan_vec := [1/40*sqrt(2)-1/160*Pi*sqrt(2),...

> 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);

[Maple Plot]