blatt07.mw

Blatt 7 zu Extremalstellen mit Nebenbedingungen

> 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

Blatt 7 Aufgabe T20

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

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

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

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

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

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

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

sols := {y = 0, x = 0}

> x0:=0; y0:=0;

x0 := 0

y0 := 0

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

H1 := Matrix([[6, -2], [-2, 2]])

relatives Minimum an Stelle (0,0)

Extrema auf Rand x^2+y^2=1 ?

> F(t):=f(cos(t),sin(t));

F(t) := 3*cos(t)^2-2*sin(t)*cos(t)+sin(t)^2

> p:=plot3d([u*cos(v),u*sin(v),f(u*cos(v),u*sin(v))],u=0..1,v=0..2*Pi,view=-1..4,axes=normal, grid=[20,20],tickmarks=[0, 0, 0]):

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

> d:=plot3d([cos(v),sin(v),u*f(cos(v),sin(v))], u=0..1, v=0..2*Pi, grid=[20,20],style=patchcontour,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,q,d,Stelle);

[Plot]

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

dF(t) := -4*sin(t)*cos(t)-4*cos(t)^2+2

[Plot]

> evalf(solve(dF(t)=0,t));

-.3926990814, 2.748893573, 1.178097245, -1.963495409

> x1:=cos(-.3926990814); y1:=sin(-.3926990814); z1:=f(x1,y1);

x1 := .9238795326

y1 := -.3826834321

z1 := 3.414213562

> x2:=cos(2.748893573); y2:=sin(2.748893573); z2:=f(x2,y2);

x2 := -.9238795329

y2 := .3826834313

z2 := 3.414213563

> x3:=cos(1.178097245); y3:=sin(1.178097245); z3:=f(x3,y3);

x3 := .3826834325

y3 := .9238795325

z3 := .5857864377

> x4:=cos(-1.963495409); y4:=sin(-1.963495409); z4:=f(x4,y4);

x4 := -.3826834328

y4 := -.9238795323

z4 := .5857864375

Methode von Lagrange

> f(x,y);

3*x^2-2*y*x+y^2

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

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

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

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

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

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

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

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

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

{x = .3826834324, lambda = -.5857864376, y = .9238795325}

Liefert allerdings zunächst nur eine der vier Lösungen

> pr:=plot([cos(t),sin(t),t=0..2*Pi], thickness=3, color=blue, scaling=constrained):

> pf1:=contourplot( f(x,y) , x=-1.5..1.5,y=-1.5..1.5,contours=[0,0.25,1,2,3.5,5,8,11], color=red):

> pf2:=contourplot( f(x,y) , x=-1.5..1.5,y=-1.5..1.5,contours=[z1,z3], thickness=2, color=red):

> Stelle1:=plot([x1+0.03*cos(t),y1+0.03*sin(t),t=0..2*Pi], thickness=2, color=black):

> Stelle2:=plot([x2+0.03*cos(t),y2+0.03*sin(t),t=0..2*Pi], thickness=2, color=black):

> Stelle3:=plot([x3+0.03*cos(t),y3+0.03*sin(t),t=0..2*Pi], thickness=2, color=black):

> Stelle4:=plot([x4+0.03*cos(t),y4+0.03*sin(t),t=0..2*Pi], thickness=2, color=black):

> display(pr,pf1,pf2,Stelle1,Stelle2,Stelle3,Stelle4);

[Plot]

Blatt 7 Aufgabe T22

Parameterdarstellung:

> v0(t):=[4*(cos(t))^2,4*sin(t)*cos(t),4*sin(t)];

v0(t) := [4*cos(t)^2, 4*sin(t)*cos(t), 4*sin(t)]

> px:=spacecurve([t,0,0],t=-3..6,thickness=2,color=black):py:=spacecurve([0,t,0],t=-5..5.5,thickness=2,color=black):pz:=spacecurve([0,0,t], t=-6..6,thickness=2,color=black,scaling=constrained):

> pc:=spacecurve(v0(t), t=-Pi..Pi, thickness=6, color=blue):

> pf1:=plot3d([1.899*sin(u)+1.98,1.899*cos(u),v], u=0..2*Pi, v=-5..5, grid=[20,20], style=patchcontour, color=red, transparency=0):

> pf2:=plot3d([3.9*cos(u)*cos(v),3.9*sin(u)*cos(v),3.9*sin(v)],u=-Pi/2..Pi/2, v=0..2*Pi, grid=[18,18],color=green, style=patchcontour, transparency=0):

> display([px,py,pz,pc,pf1,pf2]);

[Plot]

> v0(t);

[4*cos(t)^2, 4*sin(t)*cos(t), 4*sin(t)]

> f:=x^2+z^2;

f := x^2+z^2

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

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

> F(t):=f(4*(cos(t))^2,4*sin(t)*cos(t),4*sin(t));

F(t) := 16*cos(t)^4+16*sin(t)^2

> F1(t):=diff(F(t),t);

F1(t) := -64*cos(t)^3*sin(t)+32*sin(t)*cos(t)

> solve(F1(t)=0,t);

1/2*Pi, 0, 1/4*Pi, 3/4*Pi, -1/4*Pi, -3/4*Pi

Blatt 7 Aufgabe H12

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

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

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

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

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

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

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

sols := {y = 0, x = 0}

> x0:=0; y0:=0;

x0 := 0

y0 := 0

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

H1 := Matrix([[8, -3], [-3, 0]])

Sattelpunkt an Stelle (0,0)

Extrema auf Rand x^2+y^2=1 ?

> F(t):=f(cos(t),sin(t));

F(t) := 4*cos(t)^2-3*sin(t)*cos(t)

> p:=plot3d([u*cos(v),u*sin(v),f(u*cos(v),u*sin(v))],u=0..1,v=0..2*Pi,view=-1..5,axes=normal, grid=[20,20],tickmarks=[0, 0, 0]):

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

> d:=plot3d([cos(v),sin(v),u*f(cos(v),sin(v))], u=0..1, v=0..2*Pi, grid=[20,20],style=patchcontour,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,q,d,Stelle);

[Plot]

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

dF(t) := -8*sin(t)*cos(t)-6*cos(t)^2+3

[Plot]

> evalf(solve(dF(t)=0,t));

-.3217505544, 2.819842100, 1.249045772, -1.892546882

> x1:=cos(-.3217505544); y1:=sin(-.3217505544); z1:=f(x1,y1);

x1 := .9486832980

y1 := -.3162277660

z1 := 4.500000000

> x2:=cos(2.819842100); y2:=sin(2.819842100); z2:=f(x2,y2);

x2 := -.9486832983

y2 := .3162277653

z2 := 4.500000000

> x3:=cos(1.249045772); y3:=sin(1.249045772); z3:=f(x3,y3);

x3 := .3162277664

y3 := .9486832979

z3 := -.5000000001

> x4:=cos(-1.892546882); y4:=sin(-1.892546882); z4:=f(x4,y4);

x4 := -.3162277668

y4 := -.9486832978

z4 := -.5000000001

Methode von Lagrange

> f(x,y);

4*x^2-3*y*x

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

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

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

L0 := 4*x^2-3*y*x+lambda*(x^2+y^2-1)

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

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

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

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

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

{x = .9486832980, lambda = -4.500000000, y = -.3162277660}, {y = .9486832980, x = .3162277660, lambda = .5000000000}

Liefert allerdings zunächst nur zwei der vier Lösungen

> pr:=plot([cos(t),sin(t),t=0..2*Pi], thickness=3, color=blue, scaling=constrained):

> pf1:=contourplot( f(x,y) , x=-1.5..1.5,y=-1.5..1.5,contours=[0,0.25,1,2,3.5,5,8,11], color=red):

> pf2:=contourplot( f(x,y) , x=-1.5..1.5,y=-1.5..1.5,contours=[z1,z3], thickness=2, color=red):

> Stelle1:=plot([x1+0.03*cos(t),y1+0.03*sin(t),t=0..2*Pi], thickness=2, color=black):

> Stelle2:=plot([x2+0.03*cos(t),y2+0.03*sin(t),t=0..2*Pi], thickness=2, color=black):

> Stelle3:=plot([x3+0.03*cos(t),y3+0.03*sin(t),t=0..2*Pi], thickness=2, color=black):

> Stelle4:=plot([x4+0.03*cos(t),y4+0.03*sin(t),t=0..2*Pi], thickness=2, color=black):

> display(pr,pf1,pf2,Stelle1,Stelle2,Stelle3,Stelle4);

[Plot]

Ergänzung 7

> F:=4*x^2+y^4+16*z; F:=unapply(F,[x,y,z]);

F := 4*x^2+y^4+16*z

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

> G:=2*x+y+4*z-12; G:=unapply(G,[x,y,z]);

G := 2*x+y+4*z-12

G := proc (x, y, z) options operator, arrow; 2*x+y+4*z-12 end proc

> L0:=(x-u)^2+(y-v)^2+(z-w)^2+lambda*F(x,y,z)+mu*G(u,v,w); L:=unapply(L0,[x,y,z,u,v,w,lambda,mu]);

L0 := (x-u)^2+(y-v)^2+(z-w)^2+lambda*(4*x^2+y^4+16*z)+mu*(2*u+v+4*w-12)

L := proc (x, y, z, u, v, w, lambda, mu) options operator, arrow; (x-u)^2+(y-v)^2+(z-w)^2+lambda*(4*x^2+y^4+16*z)+mu*(2*u+v+4*w-12) end proc

> f1:=D[1](L); f2:=D[2](L); f3:=D[3](L); f4:=D[4](L); f5:=D[5](L); f6:=D[6](L); f7:=D[7](L); f8:=D[8](L);
evalf(solve({f1(
x,y,z,u,v,w,lambda,mu)=0, f2(x,y,z,u,v,w,lambda,mu)=0, f3(x,y,z,u,v,w,lambda,mu)=0, f4(x,y,z,u,v,w,lambda,mu)=0, f5(x,y,z,u,v,w,lambda,mu)=0, f6(x,y,z,u,v,w,lambda,mu)=0, f7(x,y,z,u,v,w,lambda,mu)=0, f8(x,y,z,u,v,w,lambda,mu)=0}));

f1 := proc (x, y, z, u, v, w, lambda, mu) options operator, arrow; 2*x-2*u+8*lambda*x end proc

f2 := proc (x, y, z, u, v, w, lambda, mu) options operator, arrow; 2*y-2*v+4*lambda*y^3 end proc

f3 := proc (x, y, z, u, v, w, lambda, mu) options operator, arrow; 2*z-2*w+16*lambda end proc

f4 := proc (x, y, z, u, v, w, lambda, mu) options operator, arrow; -2*x+2*u+2*mu end proc

f5 := proc (x, y, z, u, v, w, lambda, mu) options operator, arrow; -2*y+2*v+mu end proc

f6 := proc (x, y, z, u, v, w, lambda, mu) options operator, arrow; -2*z+2*w+4*mu end proc

f7 := proc (x, y, z, u, v, w, lambda, mu) options operator, arrow; 4*x^2+y^4+16*z end proc

f8 := proc (x, y, z, u, v, w, lambda, mu) options operator, arrow; 2*u+v+4*w-12 end proc

{v = 1.488095238, lambda = .2440476190, w = 1.639880952, x = 1., z = -.3125000000, mu = -.9761904762, u = 1.976190476, y = 1.}, {x = 1., lambda = .2708333333-0.1546473936e-1*I, u = 2.083333334-0.61858...{v = 1.488095238, lambda = .2440476190, w = 1.639880952, x = 1., z = -.3125000000, mu = -.9761904762, u = 1.976190476, y = 1.}, {x = 1., lambda = .2708333333-0.1546473936e-1*I, u = 2.083333334-0.61858...{v = 1.488095238, lambda = .2440476190, w = 1.639880952, x = 1., z = -.3125000000, mu = -.9761904762, u = 1.976190476, y = 1.}, {x = 1., lambda = .2708333333-0.1546473936e-1*I, u = 2.083333334-0.61858...{v = 1.488095238, lambda = .2440476190, w = 1.639880952, x = 1., z = -.3125000000, mu = -.9761904762, u = 1.976190476, y = 1.}, {x = 1., lambda = .2708333333-0.1546473936e-1*I, u = 2.083333334-0.61858...{v = 1.488095238, lambda = .2440476190, w = 1.639880952, x = 1., z = -.3125000000, mu = -.9761904762, u = 1.976190476, y = 1.}, {x = 1., lambda = .2708333333-0.1546473936e-1*I, u = 2.083333334-0.61858...{v = 1.488095238, lambda = .2440476190, w = 1.639880952, x = 1., z = -.3125000000, mu = -.9761904762, u = 1.976190476, y = 1.}, {x = 1., lambda = .2708333333-0.1546473936e-1*I, u = 2.083333334-0.61858...{v = 1.488095238, lambda = .2440476190, w = 1.639880952, x = 1., z = -.3125000000, mu = -.9761904762, u = 1.976190476, y = 1.}, {x = 1., lambda = .2708333333-0.1546473936e-1*I, u = 2.083333334-0.61858...{v = 1.488095238, lambda = .2440476190, w = 1.639880952, x = 1., z = -.3125000000, mu = -.9761904762, u = 1.976190476, y = 1.}, {x = 1., lambda = .2708333333-0.1546473936e-1*I, u = 2.083333334-0.61858...{v = 1.488095238, lambda = .2440476190, w = 1.639880952, x = 1., z = -.3125000000, mu = -.9761904762, u = 1.976190476, y = 1.}, {x = 1., lambda = .2708333333-0.1546473936e-1*I, u = 2.083333334-0.61858...{v = 1.488095238, lambda = .2440476190, w = 1.639880952, x = 1., z = -.3125000000, mu = -.9761904762, u = 1.976190476, y = 1.}, {x = 1., lambda = .2708333333-0.1546473936e-1*I, u = 2.083333334-0.61858...

Liefert neben der einen reellen Lösung noch komplexe Lösungen

> z0:=-0.3125000000; v0 := 1.488095238; w0 := 1.639880952; lambda0 := .2440476190; y0 := 1.; x0 := 1.; u0 := 1.976190476; mu0 := 0.9761904762;  

z0 := -.3125000000

v0 := 1.488095238

w0 := 1.639880952

lambda0 := .2440476190

y0 := 1.

x0 := 1.

u0 := 1.976190476

mu0 := .9761904762

> gF:=implicitplot3d(F(x,y,z)=0,x=-1..3,y=-1..3,z=-2..3, grid=[20,20,20],axes=normal,style=patchcontour,scaling=constrained):

> gG:=implicitplot3d(G(x,y,z)=0,x=-1..3,y=-1..3,z=-2..3, grid=[20,20,20],axes=normal,style=patchcontour):

> Stelle1:=spacecurve([x0+0.03*cos(t),y0+0.03*sin(t),z0,t=0..2*Pi], thickness=2, color=red):

> Stelle2:=spacecurve([u0+0.03*cos(t),v0+0.03*sin(t),w0,t=0..2*Pi], thickness=2, color=red):

> str:=spacecurve([x0*(1-t)+t*u0,y0*(1-t)+t*v0,z0*(1-t)+t*w0,t=0..1], thickness=3 ,color=red):

> display(gF,gG,Stelle1,Stelle2,str);

[Plot]

>