Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Min/Max/Saddle Points

In[! ]:= f[x_, y_] := x * y - x - y

fX[x_, y_] := D[f[x, y], x]


fY[x_, y_] := D[f[x, y], y]

fXX[x_, y_] := D[f[x, y], x, x]


fYY[x_, y_] := D[f[x, y], y, y]
fXY[x_, y_] := D[f[x, y], x, y]

maxpts = SolvefX[x, y] ⩵ 0 && fY[x, y] ⩵ 0 &&


fXX[x, y] < 0 && (fXX[x, y] * fYY[x, y]) - (fXY[x, y])2 > 0, {x, y}
minpts = SolvefX[x, y] ⩵ 0 && fY[x, y] ⩵ 0 &&
fXX[x, y] > 0 && (fXX[x, y] * fYY[x, y]) - (fXY[x, y])2 > 0, {x, y}
saddlepts =
SolvefX[x, y] ⩵ 0 && fY[x, y] ⩵ 0 && (fXX[x, y] * fYY[x, y]) - (fXY[x, y])2 < 0, {x, y}
inconclusivepts =
SolvefX[x, y] ⩵ 0 && fY[x, y] ⩵ 0 && (fXX[x, y] * fYY[x, y]) - (fXY[x, y])2 ⩵ 0, {x, y}

Out[! ]= {}

Out[! ]= {}

Out[! ]= {{x → 1, y → 1}}

Out[! ]= {}

Derivative Max/Min/Zero Direction Vectors

Printed by Wolfram Mathematica Student Edition


2 MML06.nb

In[! ]:= f[x_, y_] := x2 - x * y + y2 - y


p := {1, - 1}
dvalue := 4

DelF[{x_, y_}] = ∇{x,y} f[x, y]

maxDValue = Norm[DelF[p]]
maxD = DelF[p] / Norm[DelF[p]]
minD = - maxD
0 -1 0 1
zeroD = maxD. , maxD. 
1 0 -1 0
SolveDelF[p].{x, y} ⩵ dvalue && x2 + y2 ⩵ 1, {x, y}

Out[! ]= {2 x - y, - 1 - x + 2 y}

Out[! ]= 5
3 4
Out[! ]=  ,- 
5 5
3 4
Out[! ]= - , 
5 5
4 3 4 3
Out[! ]= - ,- ,  , 
5 5 5 5
24 7
Out[! ]= {x → 0, y → - 1}, x → ,y→- 
25 25

Tangent planes & Directional Derivative


3D

Printed by Wolfram Mathematica Student Edition


MML06.nb 3


In[! ]:= f[x_, y_, z_] := Log x2 + y2 + z2 
p := {2, 4, 12}
DirectionVector := {3, 6, - 2}
ds := 0.1

delF[{x_, y_, z_}] = ∇{x,y,z} f[x, y, z]

Expand[((delF[p]).({x, y, z} - p))] ⩵ 0
((- delF[p]) * ({t, t, t}) + p)

DirectionalD = (DirectionVector.(delF[p])) / Norm[DirectionVector]


DirectionalD * ds
x y z
Out[! ]=  , , 
x2 + y2 + z2 x2 + y2 + z2 x2 + y2 + z2
x y 3z
Out[! ]= -1 + + + ⩵0
82 41 41
t t 3t
Out[! ]= 2 - , 4- , 12 - 
82 41 41
3
Out[! ]=
574

Out[! ]= 0.000522648

2D
In[! ]:= f[x_, y_] := E7 x Cos[y]
p := {0, 0}
DirectionVector := {1, 1}

delF[{x_, y_}] = ∇{x,y} f[x, y]

Expand[((delF[p]).({x, y} - p))] ⩵ 0
((- delF[p]) * ({t, t}) + p)

(DirectionVector.(delF[p])) / Norm[DirectionVector]
Out[! ]= 7 ⅇ7 x Cos[y], - ⅇ7 x Sin[y]

Out[! ]= 7x⩵0

Out[! ]= {- 7 t, 0}
7
Out[! ]=
2

Printed by Wolfram Mathematica Student Edition


4 MML06.nb

f1[x_, y_] := x2  2 + x * y + y2


DelF[x_, y_] = ∇{x,y} f1[x, y]
Norm[f1[2, 1]]
maxD = f1[2, 1] / Norm[f1[2, 1]]
minD = - maxD
0 -1 0 1
zeroD = maxD. , maxD. 
1 0 -1 0

Lagrange Optimizations
3D
In[! ]:= f[x_, y_, z_] := (x - 0)2 + (y - 3)2 + (z - 0)2
g[x_, y_, z_] := x + 2 y + z

D[f[x, y, z], x] ⩵ λ * D[g[x, y, z], x]


D[f[x, y, z], y] ⩵ λ * D[g[x, y, z], y]
D[f[x, y, z], z] ⩵ λ * D[g[x, y, z], z]
g[x, y, z] ⩵ 0

pts = Solve[D[f[x, y, z], x] / D[g[x, y, z], x] ⩵ D[f[x, y, z], y] / D[g[x, y, z], y] ⩵


D[f[x, y, z], z] / D[g[x, y, z], z] && g[x, y, z] ⩵ 0, {x, y, z}]
fvalues := Map[f, {x, y, z} /. pts]
f[{x_, y_, z_}] := f[x, y, z]
maxf = Max[fvalues]
maxf = Min[fvalues]
Out[! ]= 2x⩵λ

Out[! ]= 2 (- 3 + y) ⩵ 2 λ

Out[! ]= 2z⩵λ

Out[! ]= x+2y+z ⩵ 0

Out[! ]= {{x → - 1, y → 1, z → - 1}}

Out[! ]= 6

Out[! ]= 6

2D

Printed by Wolfram Mathematica Student Edition


MML06.nb 5

In[! ]:= f[x_, y_] := 4 x * y


g[x_, y_] := x2  4 + y2  9 - 1

D[f[x, y], x] ⩵ λ * D[g[x, y], x]


D[f[x, y], y] ⩵ λ * D[g[x, y], y]
g[x, y] ⩵ 0

pts = Solve[
D[f[x, y], x] / D[g[x, y], x] ⩵ D[f[x, y], y] / D[g[x, y], y] && g[x, y] ⩵ 0, {x, y}]
fvalues := Map[f, {x, y} /. pts]
f[{x_, y_}] = f[x, y]
maxf = Max[fvalues]
maxf = Min[fvalues]


Out[! ]= 4y⩵
2
2yλ
Out[! ]= 4x⩵
9

x2 y2
Out[! ]= -1 + + ⩵0
4 9
3 3 3 3
Out[! ]= x → - 2, y → - , x → - 2, y → , x → 2, y → - , x → 2, y → 
2 2 2 2

Out[! ]= 4xy

Out[! ]= 12

Out[! ]= - 12

Taylor’s Formula center

Printed by Wolfram Mathematica Student Edition


6 MML06.nb

In[! ]:= f[x_, y_] := 3 Cos[x] * Cos[y]

delf[x_, y_] = Grad[f[x, y], {x, y}]


del2f[x_, y_] = {D[f[x, y], x, x], D[f[x, y], x, y], D[f[x, y], y, y]}
del3f[x_, y_] =
{D[f[x, y], x, x, x], D[f[x, y], x, x, y], D[f[x, y], x, y, y], D[f[x, y], y, y, y]}

t2[x_, y_] = f[0, 0] + ({x, y}.delf[0, 0]) + x2 , 2 xy, y2 .del2f[0, 0]  2
t3[x_, y_] = t2[x, y] + x3 , 3 x3 * y, 3 x * y2 , y3 .del3f[0, 0]  6

Out[! ]= {- 3 Cos[y] Sin[x], - 3 Cos[x] Sin[y]}

Out[! ]= {- 3 Cos[x] Cos[y], 3 Sin[x] Sin[y], - 3 Cos[x] Cos[y]}

Out[! ]= {3 Cos[y] Sin[x], 3 Cos[x] Sin[y], 3 Cos[y] Sin[x], 3 Cos[x] Sin[y]}


1
Out[! ]= 3+ - 3 x2 - 3 y2 
2
1
Out[! ]= 3+ - 3 x2 - 3 y2 
2

Printed by Wolfram Mathematica Student Edition

You might also like