Question: fsolve doesn't work everytime..

Hi,

I have to solve a very complex trigonometric equation which has 0,1 or 2 solutions between 0 and Pi (it depends from some parameters...).

The first problem I solved is to find the two solutions (when they exist), because at the beginning, the fsolve function returned only one solution. So, reading in your site, I solved this problem "splitting" che solutions domain in two parts in which I expect to find the two different solutions.

So for example a I wrote:

 

sol1:=fsolve(sqrt(x^2+y^2-2.54=0, x, 0..Pi/2);

sol2:=fsolve(sqrt(x^2+y^2-2.54=0, x, Pi/2..Pi);

 

and it works.

[x and y are trigonometric functions]

now the problem is that when the parameters are such that sol2 couldn't exist (it is evident by the plot!), the fsolve for sol2 doesn't work (i think!!). I expected to find sol2=NULL, so I made an if control.

 

if sol2=NULL then print('no solution2') end if;

 

but at this point the execution stops and Maple says: "Error, cannot determine if this expression is true or false...".

Could you help me?

I need that whenever the solution doesn't exist, the variable acquires the NULL value.

thanks a lot! 

bye!

Andrea

 

Please Wait...