blatt06.mw

Blatt 6 und Vorlesung Kapitel 14.5 Extremalstellen

und 14.6 Extremalstellen mit Nebenbedingung

> 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

Staatsexamen F2001

> f:=x^3+x*y-y^3;

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

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

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

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

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

> sols:=solve({f1(x,y)=0,f2(x,y)=0});

sols := {y = 0, x = 0}, {y = (-1)/3, x = 1/3}, {y = 1/3*RootOf(_Z^2-_Z+1, label = _L3), x = -1/3+1/3*RootOf(_Z^2-_Z+1, label = _L3)}

Wähle Nummer i der Lösung sols[i]:

> sol:=sols[2];
unassign('x0'): unassign('y0') :

sol0:=
subs({x=x0,y=y0},sol) : # sol0:=
map(evalf,sol0) :
assign(
sol0): "[x0,y0]"=[x0,y0];

sol := {y = (-1)/3, x = 1/3}

> 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

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

H1 := Matrix([[6*x, 1], [1, -6*y]])

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

Matrix([[2, 1], [1, 2]])

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

q1 := -1/27+(x-1/3)^2+(x-1/3)*(y+1/3)+(y+1/3)^2

> p:=plot3d(f(x,y),x=-1..2,y=-2..1,view=-1..1,axes=normal, grid=[20,20]):

> Q1:=plot3d(q1,x=-1..2,y=-2..1,view=-1..1,axes=normal, grid=[20,20],transparency=0.7):

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

Staatsexamen F2001 mit Rand 0<=x<=1, -1<=y<=1 :

> p:=plot3d(f(x,y),x=0..1,y=-1..1,view=-1..1.5,axes=normal, grid=[20,20]):

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

> display(p,Stelle);

[Plot]

Staatsexamen F2001 mit Rand x^2+y^2=1/9:

> F(t):=f(1/3*cos(t),1/3*sin(t));

F(t) := 1/27*cos(t)^3+1/9*sin(t)*cos(t)-1/27*sin(t)^3

> p:=plot3d(f(x,y),x=-0.4..0.4,y=-0.4..0.4,view=-0.2..0.2,axes=boxed, grid=[20,20]):

> q:=spacecurve([1/3*cos(t),1/3*sin(t),F(t)],t=-0..2*Pi,thickness=3,axes=normal,color=red):

> k:=spacecurve([1/3*cos(t),1/3*sin(t),0],t=-0..2*Pi,thickness=3,axes=normal,color=blue):

> display(p,q,k);

[Plot]

> dF(t):=simplify(diff(F(t),t));
plot(dF(t), t=-0..2*Pi);

dF(t) := -1/9*cos(t)^2*sin(t)+2/9*cos(t)^2-1/9-1/9*cos(t)+1/9*cos(t)^3

[Plot]

> evalf(solve(diff(F(t),t)=0,t));

-.7853981635, 2.356194490, .4881468025, 2.356194490-1.128383963*I, -2.058943129, 2.356194490+1.128383963*I

Beispiel zur Methode von Lagrange

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

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

> p0(x,y):=x^2+2*y-11;

p0(x, y) := x^2+2*y-11

> L0:=f(x,y)+lambda*p0(x,y); L:=unapply(L0,[x,y,lambda]);

L0 := x^2+y^2+lambda*(x^2+2*y-11)

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

> f1:=D[1](L); f2:=D[2](L); f3:=D[3](L);
solve({f1(x,y,lambda)=0, f2(x,y,lambda)=0, f3(x,y,lambda)=0});

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

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

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

{x = 0, y = 11/2, lambda = (-11)/2}, {lambda = -1, x = 3, y = 1}, {lambda = -1, x = -3, y = 1}

> pp:=plot(11/2-x^2/2, x=-5.5..5.5, y=-2..6, thickness=3, color=blue, scaling=constrained):

> pf1:=contourplot( f(x,y) , x=-5.5..5.5,y=-2..6,contours=[1,4,9,10,16,25,121/4,36], color=red):

> pf2:=contourplot( f(x,y) , x=-5.5..5.5,y=-2..6,contours=[10,121/4], thickness=2, color=red):

> Stelle1:=plot([0.05*cos(t),11/2+0.05*sin(t),t=0..2*Pi], thickness=3, color=black):

> Stelle2:=plot([3+0.05*cos(t),1+0.05*sin(t),t=0..2*Pi], thickness=3, color=black):

> Stelle3:=plot([-3+0.05*cos(t),1+0.05*sin(t),t=0..2*Pi], thickness=3, color=black):

> display(pp,pf1,pf2,Stelle1,Stelle2,Stelle3);

[Plot]

> f1:=unapply(f(x,y),[x,y]); F0:=simplify(f1(x,11/2-x^2/2)); F:=unapply(F0,x);

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

F0 := 1/4*x^4-9/2*x^2+121/4

F := proc (x) options operator, arrow; 1/4*x^4-9/2*x^2+121/4 end proc

> dF(x):=diff(F(x),x); solve(dF(x)=0,x);

dF(x) := x^3-9*x

0, 3, -3

> p3d:=plot3d(f(x,y),x=-6..6,y=-6..6,view=-0.5..36,axes=normal, grid=[20,20], style=patchcontour):

> q:=spacecurve([t,11/2-t^2/2, F(t)],t=-4.5..4.5,thickness=3,color=blue):

> Stelle1:=spacecurve([0+0.07*cos(t),5.5+0.07*sin(t),f1(0,5.5)],t=0..2*Pi,thickness=5,color=black):

> Stelle2:=spacecurve([3+0.07*cos(t),1+0.07*sin(t),f1(3,1)],t=0..2*Pi,thickness=5,color=black):

> Stelle3:=spacecurve([-3+0.07*cos(t),1+0.07*sin(t),f1(-3,1)],t=0..2*Pi,thickness=5,color=black):

> display(p3d,q,Stelle1,Stelle2,Stelle3);

[Plot]

Zusätzliches Beispiel aus dem Skritp von Prof. Koch

> f:=(4*x^2+y^2)*exp(-x^2-4*y^2);

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

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

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

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

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

> sols:=solve({f1(x,y)=0,f2(x,y)=0},{x,y});

sols := {y = 0, x = 0}, {x = 0, y = 1/2}, {y = (-1)/2, x = 0}, {y = 0, x = 1}, {y = 0, x = -1}

Wähle Nummer i der Lösung sols[i]:

> sol:=sols[1]; unassign('x0'); unassign('y0');
sol0:=
subs({x=x0,y=y0},sol) : # sol0:=
map(evalf,sol0) :
assign(
sol0): "[x0,y0]"=[x0,y0];  

sol := {y = 0, x = 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

> Hessian(f(x,y),[x,y]);

Matrix([[8*exp(-x^2-4*y^2)-32*x^2*exp(-x^2-4*y^2)-2*(4*x^2+y^2)*exp(-x^2-4*y^2)+4*(4*x^2+y^2)*x^2*exp(-x^2-4*y^2), -68*x*y*exp(-x^2-4*y^2)+16*(4*x^2+y^2)*x*y*exp(-x^2-4*y^2)], [-68*x*y*exp(-x^2-4*y^2)...

> H := unapply( %, [x,y] ):

> H( x0, y0 );

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

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

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

> p:=plot3d(f(x,y),x=-2.5..2.5,y=-1.5..1.5,view=-0.5..2,axes=normal, grid=[20,20]):

> Q1:=plot3d(q1,x=-2..2,y=-1.5..1.5,view=-0.5..2,axes=normal, grid=[20,20],transparency=0.7):

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

Blatt 06 Aufgabe T 18

> f:=exp(x*sin(y));

f := exp(x*sin(y))

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

f := proc (x, y) options operator, arrow; exp(x*sin(y)) end proc

f1 := proc (x, y) options operator, arrow; sin(y)*exp(x*sin(y)) end proc

f2 := proc (x, y) options operator, arrow; x*cos(y)*exp(x*sin(y)) end proc

Lösungen x0=0 und y0=k*Pi:

> x0:=0; y0:=0*Pi; "[x0,y0]"=[x0,y0];  

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

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

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

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

Matrix([[0, 1], [1, 0]])

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

q1 := 1+x*y

> p:=plot3d(f(x,y),x=-2..2,y=-Pi..2*Pi,view=0..12, grid=[20,20], style=patchcontour ,axes=normal, tickmarks=[0,0,0]):

> Q1:=plot3d(q1,x=-1.5..1.5,y=(y0-2)..(y0+2),view=-3..3, grid=[20,20],transparency=0.7):

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

Blatt 06 Aufgabe T 19

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

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

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

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

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

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

> sols:=solve({f1(x,y)=0,f2(x,y)=0});

sols := {y = 0, x = 0}, {y = 0, x = 0}, {x = 0, y = 3}, {y = 2, x = 2}, {y = 2, x = -2}

Wähle Nummer i der Lösung sols[i]:

> sol:=sols[4];
unassign('x0'): unassign('y0') :

sol0:=
subs({x=x0,y=y0},sol) : # sol0:=
map(evalf,sol0) :
assign(
sol0): "[x0,y0]"=[x0,y0];

sol := {y = 2, x = 2}

> 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

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

H1 := Matrix([[2*x, 3*y^2-6*y], [3*y^2-6*y, (6*y-6)*x]])

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

Matrix([[4, 0], [0, 12]])

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

q1 := -16/3+6*(y-2)^2+2*(x-2)^2

> p:=plot3d(f(x,y),x=-3..4,y=-4..4,view=-10..15, grid=[20,20], style=patchcontour ,axes=normal, tickmarks=[0,0,0]):

> Q1:=plot3d(q1,x=(x0-2)..(x0+2),y=(y0-2)..(y0+2),view=-5..5, grid=[20,20],transparency=0.7):

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

> p:=plot3d(f(x,y),x=0..3,y=0..3,view=-8..10, grid=[20,20], style=patchcontour ,axes=normal, tickmarks=[0,0,0]):

> r1:=spacecurve([0,t,f(0,t)],t=0..3,thickness=3,color=blue):

> r2:=spacecurve([t,0,f(t,0)],t=0..3,thickness=3,color=blue):

> r3:=spacecurve([3,t,f(3,t)],t=0..3,thickness=3,color=blue):

> r4:=spacecurve([t,3,f(t,3)],t=0..3,thickness=3,color=blue):

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

> display(p,r1,r2,r3,r4,Stelle);

[Plot]

Blatt 06 Aufgabe H 10

> f:=y^4-3*x*y^2+x^3;

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

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

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

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

f2 := proc (x, y) options operator, arrow; 4*y^3-6*y*x end proc

> sols:=solve({f1(x,y)=0,f2(x,y)=0});

sols := {y = 0, x = 0}, {y = 0, x = 0}, {y = 3/2, x = 3/2}, {y = (-3)/2, x = 3/2}

Wähle Nummer i der Lösung sols[i]:

> sol:=sols[3];
unassign('x0'): unassign('y0') :

sol0:=
subs({x=x0,y=y0},sol) : # sol0:=
map(evalf,sol0) :
assign(
sol0): "[x0,y0]"=[x0,y0];

sol := {y = 3/2, x = 3/2}

> 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

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

H1 := Matrix([[6*x, -6*y], [-6*y, 12*y^2-6*x]])

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

Matrix([[9, -9], [-9, 18]])

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

q1 := -27/16+9*(y-3/2)^2-9*(x-3/2)*(y-3/2)+9/2*(x-3/2)^2

> p:=plot3d(f(x,y),x=-3..4,y=-4..4,view=-10..15, grid=[20,20], style=patchcontour ,axes=normal, tickmarks=[0,0,0]):

> Q1:=plot3d(q1,x=(x0-2)..(x0+2),y=(y0-2)..(y0+2),view=-5..5, grid=[20,20],transparency=0.7):

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

> p:=plot3d(f(x,y),x=-2.5..2.5,y=-2..2,view=-17..40, grid=[40,40], style=patchcontour ,axes=normal, tickmarks=[0,0,0]):

> r1:=spacecurve([-2.5,t,f(-2.5,t)],t=-2..2,thickness=3,color=blue):

> r2:=spacecurve([t,-2,f(t,-2)],t=-2.5..2.5,thickness=3,color=blue):

> r3:=spacecurve([2.5,t,f(2.5,t)],t=-2..2,thickness=3,color=blue):

> r4:=spacecurve([t,2,f(t,2)],t=-2.5..2.5,thickness=3,color=blue):

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

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

> Stelle3:=spacecurve([1.5+0.02*cos(t),-1.5+0.02*sin(t),f(1.5,-1.5)+0.05],t=0..2*Pi,thickness=5,color=red):

> display(p,r1,r2,r3,r4,Stelle1,Stelle2,Stelle3);

[Plot]

Blatt06 Aufgabe H11

> a:=3; W:=x^2*(a-x)*t^2*exp(-t);

a := 3

W := x^2*(-x+3)*t^2*exp(-t)

> W:=unapply(W,x,t); W1:=D[1](W); W2:=D[2](W);

W := proc (x, t) options operator, arrow; x^2*(-x+3)*t^2*exp(-t) end proc

W1 := proc (x, t) options operator, arrow; 2*x*(-x+3)*t^2*exp(-t)-x^2*t^2*exp(-t) end proc

W2 := proc (x, t) options operator, arrow; 2*x^2*(-x+3)*t*exp(-t)-x^2*(-x+3)*t^2*exp(-t) end proc

> sols:=solve({W1(x,t)=0,W2(x,t)=0});

sols := {t = t, x = 0}, {x = 2, t = 2}, {t = 0, x = x}

Wähle Nummer i der Lösung sols[i]:

> sol:=sols[2];
unassign('x0'): unassign('y0') :

sol0:=
subs({x=x0,t=t0},sol) : # sol0:=
map(evalf,sol0) :
assign(
sol0): "[x0,t0]"=[x0,t0];

sol := {x = 2, t = 2}

Wähle Nummer i der Lösung sols[i]:

> g:=(x,t)->[W1(x,t),W2(x,t)]; "grad W(x0,t0)"=g(x0,t0);

g := proc (x, t) options operator, arrow; [W1(x, t), W2(x, t)] end proc

> H1:=Hessian(W(x,t),[x,t]);

H1 := Matrix([[2*(-x+3)*t^2*exp(-t)-4*x*t^2*exp(-t), 4*x*(-x+3)*t*exp(-t)-2*x*(-x+3)*t^2*exp(-t)-2*x^2*t*exp(-t)+x^2*t^2*exp(-t)], [4*x*(-x+3)*t*exp(-t)-2*x*(-x+3)*t^2*exp(-t)-2*x^2*t*exp(-t)+x^2*t^2*...

> H := unapply( H1, [x,t] ):
H( x0, t0 );

Matrix([[-24*exp(-2), 0], [0, -8*exp(-2)]])

> q1:=mtaylor(W(x,t), [x=x0,t=t0], 3);

q1 := 16*exp(-2)-12*exp(-2)*(x-2)^2-4*exp(-2)*(-2+t)^2

> p:=plot3d(W(x,t),x=0..a,t=0..10,view=0..3, grid=[20,20], style=patchcontour ,axes=normal, tickmarks=[0,0,0]):

> Q1:=plot3d(q1,x=(x0-2)..(x0+2),t=(t0-2)..(t0+2),view=0..3, grid=[20,20],transparency=0.7):

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

> display(p,Q1,Stelle);

[Plot]

> plot(W(1,t), t=0..10, color=blue, thickness=3, legend=["W(1,t)"]);

[Plot]

> plot(W(x,2), x=0..a, color=red, thickness=3, legend=["W(x,2)"]);

[Plot]

E 06

> F:=x+y+z+exp(-x)+exp(-y)-2*exp(-z); F:=unapply(F,[x,y,z]);

F := x+y+z+exp(-x)+exp(-y)-2*exp(-z)

F := proc (x, y, z) options operator, arrow; x+y+z+exp(-x)+exp(-y)-2*exp(-z) end proc

> implicitplot3d(F(x,y,z)=0,x=-5..15,y=-5..15,z=-5..1, grid=[20,20,20],axes=normal,style=patchcontour);

[Plot]

>