MATLAB How do I find the Critical points of a multi-variable function using MATlab?

Click For Summary
To find the critical points of the two-variable function f(x,y) = 10x^2y - 5x^2 - 4y^2 - x^4 - 2y^4 using MATLAB, the user is advised to set the partial derivatives f_x and f_y to zero. The user has derived the equations f_x = 20yx - 10x - 4x^3 and f_y = 10x^2 - 8y - 8y^3, and attempted to solve them by substituting values. Suggestions include using symbolic variables in MATLAB with the command "syms x y" to facilitate solving the equations. The user is also encouraged to verify their results by plugging back the obtained (x, y) values into the original equations to check if they approximate zero. Overall, using MATLAB's symbolic toolbox is recommended for solving such multi-variable functions effectively.
VinnyCee
Messages
486
Reaction score
0
How do I find the Critical points of a two-variable function using MATlab?

I have a problem, I cannot seem to find the critical points of a two-variable function for the life of me!

The funtion f(x,y) = 10x^2y - 5x^2 - 4y^2 - x^4 -2y^4 is supposed to have six potential critical points. I have the following:

f_x = 20yx - 10x - 4x^3
f_y = 10x^2 - 8y - 8y^3

For what it's worth:

\nabla f_x = (20y - 10 - 12x^2) i + (20x) j
\nabla f_y = (20x) i + (-8-24y^2) j

\nabla f_x = \lambda\nabla f_y

\lambda = \frac{20y - 10 - 12x^2}{20x} = \frac{20x}{-8-24y^2}

I know that the potential critical points are at f_x = f_y = 0, but how do I find these using MATlab, or even on paper. How would I solve for both equations?

I just can't crack this problem!

P.S. - I have MATlab version 6.5
 
Last edited:
Physics news on Phys.org
Here are some preliminary (probably wrong) answers:

Ok, I took the first equation f_x = 20yx - 10x - 4x^3 = 0 and factored out a 2x to get 2x (10y - 5 - 2x^2) = 0.

Then I solved for -2x^2 to get -2x^2 = 5 - 10y and I substituted that into the second equation of f_y = 10x^2 - 8y - 8y^3 = 0 to get f_y = -5(5 - 10y) - 8y - 8y^3. This resolves down to -8y^3 + 42y = 25 which one can solve and get y = 1.898, 0.647, -2.545, but what do I do now?
 
Last edited:
Using the supposed answers, I figured this:

Plug this y = 1.898, 0.647, -2.545 into f_x = 20yx - 10x - 4x^3 to get x = \pm 2.644, \pm 0.857, 0

Are these correct? When the (x, y)'s are plugged into f_x and f_y they are pretty close to zero (rounding). But for some reason I don't think this is correct. How would I check with MATlab?
 
This may not be any help but ...

have you tried creating symbolic variables for x and y?

try:
>syms x y
>g=((10*x^2)*y)-(5*x^2)-(4*y^2)-(x^4)-(2*y^4)
and then solve for g
(I would have tyied this before posting but my MATlab has a bug and willl not recognise the syms command!)
 
Last edited:

Similar threads

Replies
3
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 7 ·
Replies
7
Views
1K