Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have no trouble finding stationary points using diff and solve in the following way:

f:= somefunction;



which gives me an approximation for the stationary points; however, if I wanted the stationary points between 1..4, for example, how do I specify that? I tried evalf(solve(dx=0, 1..4)); but I get an error saying "too many and/or wrong type of arguments...". Also, if I wanted to include a range too, so I was looking for stationary points within a square field, how do I accomplish that?

share|cite|improve this question
up vote 2 down vote accepted

You can try including inequalities in the solve command. This should work if your $f$ is a rational function. For example:

solve({x^3 - 3*x + 2 = 0, x >= 0, x <= 3});

$\{x = 1\}$

It's rather iffy for transcendental functions, especially since they might not have closed-form solutions.

On the other hand, you can use fsolve to get a numerical approximation to a solution. For example:

fsolve(x^3 - 4*sin(x) + 2 = 0, x = 0 .. 2);


For a system of equations (I suspect that's what you mean by "stationary points within a square field") you can also use fsolve, e.g.

fsolve({ 3*x + 4*y = 8, sin(x) + sin(y) = 1}, {x,y}, x=0 .. 3, y=0 .. 3);

$\{x = 2.312379302, y = .2657155233\}$

This will only give you one solution. On the other hand, for a polynomial system you can try RootFinding[Isolate] which will give you all solutions in a given rectangle. For example:

RootFinding[Isolate]({ 3*x + 4*y - 8, (x-2)^2 + (y-2)^2 - 2}, [x,y],x=0 .. 3, y=0 .. 3);

$[[x = 1.878665182, y = .5910011136], [x = .6813348181, y = 1.488998886]]$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.