blatt05.mw

Blatt 5 und Vorlesung Kapitel 14.4 Taylor-Formel 2. Ordnung

> restart:

> with(plots):with(linalg):with(VectorCalculus):

Warning, the name changecoords has been redefined

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

Warning, the name Wronskian has been rebound

Warning, the assigned names `<,>` and `<|>` now have a global binding

Warning, these protected names have been redefined and unprotected: `*`, `+`, `.`, D, Vector, diff, int, limit, series

> f:=sin(x^2+y^2)+x;

f := sin(x^2+y^2)+x

> f:=unapply(f,x,y); f1:=D[1](f); f2:=D[2](f);

f := proc (x, y) options operator, arrow; sin(x^2+y^2)+x end proc

f1 := proc (x, y) options operator, arrow; 2*cos(x^2+y^2)*x+1 end proc

f2 := proc (x, y) options operator, arrow; 2*cos(x^2+y^2)*y end proc

> x0:=0; y0:=0;

x0 := 0

y0 := 0

> g:=(x,y)->[f1(x,y),f2(x,y)]; "grad f(x0,y0)"=g(x0,y0);

g := proc (x, y) options operator, arrow; [f1(x, y), f2(x, y)] end proc

> H:=Hessian(f(x,y),[x,y]);

H := Matrix([[-4*sin(x^2+y^2)*x^2+2*cos(x^2+y^2), -4*sin(x^2+y^2)*y*x], [-4*sin(x^2+y^2)*y*x, -4*sin(x^2+y^2)*y^2+2*cos(x^2+y^2)]])

> H := unapply( H, [x,y] ):
H( x0, y0 );

Matrix([[2, 0], [0, 2]])

> q1:=mtaylor(f(x,y), [x=x0,y=y0], 3);

q1 := x+x^2+y^2

> p:=plot3d(f(x,y),x=-2..2,y=-2..2,view=-3..3,axes=boxed,style=hidden, grid=[30,30],transparency=0.7):

> Q1:=plot3d(q1,x=-1.2..1.2,y=-sqrt(1.44-x^2)..sqrt(1.44-x^2),view=-1..3,axes=normal, grid=[20,20]):

> Stelle:=spacecurve([x0+0.02*cos(t),y0+0.02*sin(t),f(x0,y0)],t=0..2*Pi,thickness=5,color=red):

> display(p,Q1,Stelle);

[Plot]

> restart:with(plots):with(linalg):

Warning, the name changecoords has been redefined

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

T17 Tangente an implizit gegebene Kurve:

> f:=3*y^2-x^3-x^2; f:=unapply(f,[x,y]);

f := 3*y^2-x^3-x^2

> t:=-0.2; x0:=3*t^2-1; y0:=t*x0; "f(x0,y0)"=f(x0,y0);

t := -.2

x0 := -.88

y0 := .176

> g:=grad(f(x,y),[x,y]);

g := vector([-3*x^2-2*x, 6*y])

> g1:=unapply(g[1],x,y); g2:=unapply(g[2],x,y);

g1 := proc (x, y) options operator, arrow; -3*x^2-2*x end proc

g2 := proc (x, y) options operator, arrow; 6*y end proc

> T:=g1(x0,y0)*(x-x0)+g2(x0,y0)*(y-y0);

T := -.5632*x-.681472+1.056*y

> q1:=mtaylor(f(x,y), [x=0,y=0], 3);

q1 := 3*y^2-x^2

> p:=implicitplot( f(x,y)=0,x=-1..1,y=-1..1,grid=[50,50],thickness=3,color=red,scaling=constrained):

> q:=implicitplot( T=0,x=-1.2..-0.5,y=-1..1,grid=[50,50],thickness=2,color=blue):

> n1:=plot([x0+s*g1(x0,y0),y0+s*g2(x0,y0), s=0..0.5], thickness=2, color=green):

> Stelle:=plot([x0+0.02*cos(s),y0+0.02*sin(s),s=0..2*Pi],thickness=2,color=black):

> o:=implicitplot( q1=0,x=-0.5..0.5,y=-0.5..0.5,grid=[50,50],thickness=2,color=blue):

> display(p,q,n1,Stelle,o);

[Plot]

H09 Lemniskate

> f:=(x^2+y^2)^2-2*(x^2-y^2); f:=unapply(f,[x,y]);

f := (x^2+y^2)^2-2*x^2+2*y^2

f := proc (x, y) options operator, arrow; (x^2+y^2)^2-2*x^2+2*y^2 end proc

> x0:=1; solve(f(x0,y)=0);

x0 := 1

-(-2+5^(1/2))^(1/2), (-2+5^(1/2))^(1/2), -(-2-5^(1/2))^(1/2), (-2-5^(1/2))^(1/2)

> y0:=(-2+5^(1/2))^(1/2);

y0 := (-2+5^(1/2))^(1/2)

> g:=grad(f(x,y),[x,y]);

g := vector([4*(x^2+y^2)*x-4*x, 4*(x^2+y^2)*y+4*y])

> g1:=unapply(g[1],x,y); g2:=unapply(g[2],x,y);

g1 := proc (x, y) options operator, arrow; 4*(x^2+y^2)*x-4*x end proc

g2 := proc (x, y) options operator, arrow; 4*(x^2+y^2)*y+4*y end proc

> T:=simplify(g1(x0,y0)*(x-x0)+g2(x0,y0)*(y-y0));

T := 4*5^(1/2)*x+4*5^(1/2)-8*x-12+4*(-2+5^(1/2))^(1/2)*5^(1/2)*y

> evalf(solve({f(x,y)=0,g1(x,y)=0}));

{x = 0., y = 0.}, {x = 0., y = 0.}, {x = 0., y = 1.414213562*I}, {y = .5000000000, x = .8660254040}, {x = .8660254040, y = -.5000000000}

> q1:=mtaylor(f(x,y), [x=0,y=0], 3);

q1 := -2*x^2+2*y^2

> p:=implicitplot( f(x,y)=0,x=-1.5..1.5,y=-1..1,grid=[50,50],thickness=3,color=red,scaling=constrained):

> q:=implicitplot( T=0,x=-1.5..1.5,y=-1..1,grid=[50,50],thickness=2,color=blue):

> n1:=plot([x0+s*g1(x0,y0),y0+s*g2(x0,y0), s=0..0.1], thickness=2, color=green):

> Stelle:=plot([x0+0.02*cos(s),y0+0.02*sin(s),s=0..2*Pi],thickness=2,color=black):

> o:=implicitplot( q1=0,x=-0.5..0.5,y=-0.5..0.5,grid=[50,50],thickness=2,color=blue):

> display(p,q,n1,Stelle,o);

[Plot]

E05 Schiefer Kreiskegel

> f:=(x^2+y^2)/(2*x);

f := 1/2*(x^2+y^2)/x

> f:=unapply(f,[x,y]);

f := proc (x, y) options operator, arrow; 1/2*(x^2+y^2)/x end proc

> p:=plot3d(f(x,y),x=0.0001..4,y=-2..2,view=0..2, axes=normal, grid=[100,100],contours=21, style=patchcontour, scaling=constrained):

> q1:=spacecurve([t,t,f(t,t)], t=0.0001..2, thickness=3, color=red):

> q2:=spacecurve([2*cos(t),2-2*sin(t),f(2*cos(t),2-2*sin(t))], t=0..Pi/2-0.001, thickness=3, color=green):

>

> display(p,q1,q2);

[Plot]

>