Experiments3.mws

Experiments on Limits and Linear Approximation

Version .7 Maple VR7

These packages need to be loaded first.

> with(plots): with(linalg): with(plottools):

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

Warning, the name arrow has been redefined

Limits and Graphs in R^3

Look at the graph below. Perhaps try changing the value of eps and rotating the graph.

What does this say about the limit as (x,y) approaches (0,0) of sin((x-y)^2)/(x^2+y^2) ?

> eps:=.5;

> plot3d(sin((x-y)^2)/(x^2+y^2),x=-eps..eps,y=-eps..eps,axes=framed);

eps := .5

[Maple Plot]

The animation below shows the y= kx sections of this graph for various values of k.

To play the animation, click on the graph and then choose play from the animation menu.

Why does the animation tell you something about the above limit?

> animate(subs(y=k*x,sin((x-y)^2)/(x^2+y^2)),x=-eps..eps,k=-3..3);

[Maple Plot]

Some Linear Approximations for a function F: R^2 -> R^2 .

Try changing the scale below - at least for the values scale =.1,.5 and 1.
(You need to re-execute the lines which follow after you change scale.)

The pictures compare the image of a certain square under the function F with

the image of the square under the linear approximation obtained at the center of

the square.
Compare the accuracy of linear approximation as a function of the size of the rectangle.

Defining F: R^2 -> R^2 by F(x,y) = (exp(x)+y, exp(y)+x) . DF is its derivative at the point (x,y).

> F:=(x,y)->[1-exp(x)-y,1-exp(y)-x]; DF:=jacobian(F(x,y),[x,y]);

F := proc (x, y) options operator, arrow; [1-exp(x)...

DF := matrix([[-exp(x), -1], [-1, -exp(y)]])

We will be linearizing F at the point p0. And scale controls the size of the rectangle we work with.

> scale:=1;
p0:=[.5*scale,.5*scale];

scale := 1

p0 := [.5, .5]

An easy way to draw a square with corner (0,0) and (scale,scale).

> gr1:=conformal(z,z=0..scale*(1+I)):
gr1a:=conformal(z,z=0..scale*(1+I),color=magenta):

This picture shows the original rectangle together with its image under F.

> F_gr:=transform(F):
display([gr1,F_gr(gr1)],title=`Image of Rectangle under F`);

[Maple Plot]

Below is the corresponding picture under the linearization of F at p0.
Don't worry necessarily about the Maple code, but

F0= the image of the point p0 under F.
L=derivative DF at p0 (a 2 by 2 matrix)

L1=the linear approximation of F at p0

L2=a different form of L1 for Maple syntax reasons

> F0:=F(op(p0));
L:=map(evalf,subs({x=p0[1],y=p0[2]},eval(DF)));
L1:=convert(evalm(L &*vector([x-p0[1],y-p0[2]])+F0),list);
L2:=unapply(L1,[x,y]);
L2_gr:=transform(L2):
display([gr1a,L2_gr(gr1a)],title=`Image of Rectangle under Linear Approximation`);

F0 := [-1.148721271, -1.148721271]

L := matrix([[-1.648721271, -1.], [-1., -1.64872127...

L1 := [-1.648721271*x+.175639365-1.*y, -1.*x+.17563...

L2 := proc (x, y) options operator, arrow; [-1.6487...

[Maple Plot]

Linearization at the Origin.

Try changing the scale below - at least for the values scale =.1,.5 and 1.

Why do the linearized pictures look the way they do?

Defining F: R^2 -> R^2 by F(x,y) = (exp(x)+y, exp(y)+x) . DF is its derivative at the point (x,y).

> F:=(x,y)->[1-exp(x)-y,1-exp(y)-x]; DF:=jacobian(F(x,y),[x,y]);

F := proc (x, y) options operator, arrow; [1-exp(x)...

DF := matrix([[-exp(x), -1], [-1, -exp(y)]])

We will be linearizing F at the point p0. And scale controls the size of the rectangle we work with.

> scale:=0.1;
p0:=[0,0];

scale := .1

p0 := [0, 0]

An easy way to draw a square with corner (0,0) and (scale,scale).

> gr1:=conformal(z,z=0..scale*(1+I)):
gr1a:=conformal(z,z=0..scale*(1+I),color=magenta):

This picture shows the original rectangle together with its image under F.

> F_gr:=transform(F):
display([gr1,F_gr(gr1)],title=`Image of Rectangle under F`);

[Maple Plot]

Below is the corresponding picture under the linearization of F at p0.
Don't worry necessarily about the Maple code, but

F0= the image of the point p0 under F.
L=derivative DF at p0 (a 2 by 2 matrix)

L1=the linear approximation of F at p0

L2=a different form of L1 for Maple syntax reasons

> F0:=F(op(p0));
L:=map(evalf,subs({x=p0[1],y=p0[2]},eval(DF)));
L1:=convert(evalm(L &*vector([x-p0[1],y-p0[2]])+F0),list);
L2:=unapply(L1,[x,y]);
L2_gr:=transform(L2):
display([gr1a,L2_gr(gr1a)],title=`Image of Rectangle under Linear Approximation`);

F0 := [0, 0]

L := matrix([[-1., -1.], [-1., -1.]])

L1 := [-1.*x-1.*y, -1.*x-1.*y]

L2 := proc (x, y) options operator, arrow; [-1.*x-1...

[Maple Plot]

Another function F: R^2 -> R^2 .

Try changing the scale below - at least for the values scale =1, .5, .1, .01.
(You need to re-execute the lines which follow after you change scale.)

The pictures compare the image of a certain square under the function F with

the image of the square under the linear approximation obtained at the center of

the square.
Compare the accuracy of linear approximation as a function of the size of the rectangle.

>

> F:=(x,y)->[x^2-y^2,2*x*y]; DF:=jacobian(F(x,y),[x,y]);

F := proc (x, y) options operator, arrow; [x^2-y^2,...

DF := matrix([[2*x, -2*y], [2*y, 2*x]])

We will be linearizing F at the point p0. And scale controls the size of the rectangle we work with.

> scale:=1;
p0:=[.5*scale,.5*scale];

scale := 1

p0 := [.5, .5]

An easy way to draw a square with corner (0,0) and (-scale,-scale).

> gr1:=conformal(z,z=0..scale*(-1-I)):
gr1a:=conformal(z,z=0..scale*(-1-I),color=magenta):

This picture shows the original rectangle together with its image under F.

> F_gr:=transform(F):
display([gr1,F_gr(gr1)],title=`Image of Rectangle under F`);

[Maple Plot]

Below is the corresponding picture under the linearization of F at p0.
Don't worry necessarily about the Maple code, but

F0= the image of the point p0 under F.
L=derivative DF at p0 (a 2 by 2 matrix)

L1=the linear approximation of F at p0

L2=a different form of L1 for Maple syntax reasons

> F0:=F(op(p0));
L:=map(evalf,subs({x=p0[1],y=p0[2]},eval(DF)));
L1:=convert(evalm(L &*vector([x-p0[1],y-p0[2]])+F0),list);
L2:=unapply(L1,[x,y]);
L2_gr:=transform(L2):
display([gr1a,L2_gr(gr1a)],title=`Image of Rectangle under Linear Approximation`);

F0 := [0., .50]

L := matrix([[1.0, -1.0], [1.0, 1.0]])

L1 := [1.0*x-1.0*y, 1.0*x-.50+1.0*y]

L2 := proc (x, y) options operator, arrow; [1.0*x-1...

[Maple Plot]

>

Some Linear Approximations for a function F: R^2 -> R^3 .

The pictures compare the image of a certain square under the function F with

the image of the square under the linear approximation obtained at the center of

the square.

Try changing the scale below - at least for the values scale =2, 1, .5, .25, and .1.

Compare the accuracy of linear approximation as a function of the size of the rectangle.

> F:=(x,y)->[sin(x)*cos(y),sin(x)*sin(y),cos(x)]; DF:=jacobian(F(x,y),[x,y]);

F := proc (x, y) options operator, arrow; [sin(x)*c...

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

We will be linearizing F at the point p0. And scale controls the size of the rectangle we work with.

> scale:=1;
p0:=[.5*scale,.5*scale];

scale := 1

p0 := [.5, .5]

An easy way to draw a square with corner (0,0) and (scale,scale).

> gr1:=conformal(z,z=0..scale*(1+I)):
gr1a:=conformal(z,z=0..scale*(+1+I),color=magenta):
display(gr1);

[Maple Plot]

This picture shows the image under F.

The option scaling=constrained means to choose the same scale along all three axes.

> F_gr:=transform(F):
display(F_gr(gr1),title=`Image of Rectangle under F`,axes=framed,scaling=constrained);

[Maple Plot]

Below is the picture of the image of the rectangle under the linearization of F at p0 together with the actual image.

Don't worry necessarily about the Maple code, but

F0= the image of the point p0 under F.
L=derivative DF at p0 (a 2 by 2 matrix)

L1=the linear approximation of F at p0

L2=a different form of L1 for Maple syntax reasons

> F0:=F(op(p0));
L:=map(evalf,subs({x=p0[1],y=p0[2]},eval(DF)));
L1:=convert(evalm(L &*vector([x-p0[1],y-p0[2]])+F0),list);
L2:=unapply(L1,[x,y]);
L2_gr:=transform(L2):
display([F_gr(gr1),L2_gr(gr1a)],title=`Image and its Linear Approximation`,axes=framed,scaling=constrained);

F0 := [.4207354924, .2298488471, .8775825619]

L := matrix([[.7701511530, -.2298488471], [.4207354...

L1 := [.7701511530*x+.1505843395-.2298488471*y, .42...
L1 := [.7701511530*x+.1505843395-.2298488471*y, .42...

L2 := proc (x, y) options operator, arrow; [.770151...
L2 := proc (x, y) options operator, arrow; [.770151...

[Maple Plot]

You could also try the above without the scaling=constrained option.

Can you explain what happens then?

>

>