Post Reply 
Error solving equation in CAS
10-18-2014, 10:46 PM
Post: #1
Error solving equation in CAS
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.
Find all posts by this user
Quote this message in a reply
10-19-2014, 02:35 AM
Post: #2
RE: Error solving equation in CAS
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.
Find all posts by this user
Quote this message in a reply
10-19-2014, 08:13 AM
Post: #3
RE: Error solving equation in CAS
((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?
Find all posts by this user
Quote this message in a reply
10-19-2014, 12:08 PM
Post: #4
RE: Error solving equation in CAS
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).
Find all posts by this user
Quote this message in a reply
10-19-2014, 12:47 PM
Post: #5
RE: Error solving equation in CAS
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!
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)