Message Boards Message Boards

Find the root of a function with two variables?

Posted 6 years ago

I have this equation :

w[s_, u_] := 1 + (1 + 0.65 s - 1.2 s^2 - 0.4 s^3 + 0.35 s^4) Cos[u] + (1.4 s - 0.4 s^2 - 1.5 s^3 - 0.35 s^4) Sin[u];

And I need to find the critical point of this equation; The requirement is using the ContourPlot and FindRoot to solve it, so I need to give the FindRoot function an initial guess for a critical point; I can see the initial guess now, but how to find the "Find Root function" ?

If I try:

FindRoot[w[s, u], {s, 0}, {u, pi}]

,then the error message: " The number of equations does not match the number of variables in FindRoot[w[s,u],{s,0},{u,[Pi]}]."

Please help, Thank you!

enter image description here

POSTED BY: KA KAM CHEN
3 Replies
Posted 6 years ago

Thank you for your help!

POSTED BY: KA KAM CHEN

It is not w that you want to be zero, but its gradient:

FindRoot[Grad[w[s, u], {s, u}] == 0, {s, 0}, {u, Pi}]
POSTED BY: Gianluca Gorni

In this case I would try FindMaximum:

FindMaximum[w[s, u], {s, .3}, {u, .1}]

For exact symbolic solutions you can use Reduce:

Reduce[Grad[Rationalize[w[s, u]], {s, u}] == 0 &&
  -1 < s < 1 &&
  -1 < u < 1,
 {s, u}, Reals]
% // N
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract