HP Forums

Full Version: Error solving equation in CAS
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm trying to find the solutions of the equation:
{(3,068e-3/(0.118+1,001e-5*X))-[[(1+2,126e-5*X)/(1+8,506e-5*X)]-[0.3+2,55e-5*X]]}=0

When i do it in CAS mode with "solve(equation,x)" i get as solutions {-9413.99 ; 15254.47}

And doing the same in non CAS with "FNROOT(equation,X)" i get 12055.26; this is the good solution(I have seen it plotting), but i only get the positive one.

I don't understand what happens or if I am doing something wrong.
Please state your equation again.

You shouldn't need any "{}" nor "[]". Are the "," thousand separators, or are they decimal points "."? All "X" should be "x" in CAS.

In CAS, try fsolve(your equation, x). You can also use a starting value, or interval (see help for fsolve).

In Home, try FNROOT with a starting guess close to the second solution (again, see help for FNROOT). Here "X" is OK.
((3.068E-3/(0.118+1.001E-5*X))-(((1+2.126E-5*X)/(1+8.506E-5*X))-(0.3+2.55E-5*X)))=0
The "." are decimal points.

In CAS (with X as x) with "solve" or "fsolve" i get {-9413.99 ; 15254.47} ; but if I use a starting value (solve(equation,x,1)) I get the right solution 12055.26

So should I always put a starting value, or interval?
Yes, that way you are certain that an iterative method is used. Otherwise solve/fsolve will check for a polynomial equation and apply methods that can be suited to exact coefficients but not to approx ones, that's the case here, and bad thing can happen (here because the leading coefficient of the numerator is very small).
Perhaps a hint here is that after copy/pasting this expression from your text into EMU/CAS (Var X:=0 in this example):

((3.068E-3/(0.118+1.001E-5*X))-(((1+2.126E-5*X)/(1+8.506E-5*X))-(0.3+2.55E-5*X)))=0

The EMU/CAS Entry line resulted in this:

$$
\left(\frac{3.068e-3}{0.118+1.001e-5*X}
{-}
\left(\frac{1+2.126e-5*X}{1+8.506e-5*X}
{-}
\left({0.3+2.55e-5*X}\right)
\right)\right)
{=0}
$$

EMU/CAS then produced this output:

$$
\left({-.674}\right){=0}
$$

Exactly approximate and vice versa!
Reference URL's