Gradient and Optimization
For a standard vector calculus on xyz-coordinate, the package "vect" is useful and it is needed to load at the beginning:--> load(vect)The gradient operator "grad" in Maxima must be "expressed" and their partial derivatives to be "evaluated."
--> f: 10*x^2*y - 5*x^2 - 4*y^2 - x^4 - 2*y^4 --> del_f: ev(express(grad(f)),diff)Then we get the gradient
![$ [20xy-4x^3-10x, -8y^3-8y+10x^2, 0]$](img52.png)




--> realonly: true; --> sol: solve([del_f[1]=0, del_f[2]=0])We set realonly in order to produce only real-valued solutions when solve is executed. Each solution can be found by calling sol[1], sol[2], and so on. Now we need to proceed the second derivative test to determine a local minimum, a local maximum, or a saddle point for each critical point.
--> f_xx: diff(f,x,2) --> D: diff(f,x,2)*diff(f,y,2) - diff(f,x,1,y,1)^2 --> D, sol[1]; f_xx, sol[1]; --> D, sol[2]; f_xx, sol[2]; --> D, sol[3]; f_xx, sol[3]; --> D, sol[4]; f_xx, sol[4]; --> D, sol[5]; f_xx, sol[5];Here the variables x and y are substituted by each solution.
Similarly we can solve
the optimization problem
with constraint
.
--> f: x*y*z; --> g: 2*x*z + 2*y*z + x*y --> del_f: ev(express(grad(f)),diff) --> del_g: ev(express(grad(g)),diff)By applying the method of Lagrange multipliers, we can find the solutions:
--> solve([del_f[1]=lmd*del_g[1], del_f[2]=lmd*del_g[2], del_f[3]=lmd*del_g[3], g=12])
You may use wxMaxima and complete some of the even-numbered exercises assigned in the class.
- section14-6.wxm and exercise14-6.wxm (the directional derivative and the tangent plane)
- section14-7.wxm, section14-8.wxm, and exercise14-78.wxm (the second derivative test and the method of Lagrange multipliers)
© TTU Mathematics