help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Symbolic solve in Octave isn't the same as in MATLAB


From: Colin Macdonald
Subject: Re: Symbolic solve in Octave isn't the same as in MATLAB
Date: Mon, 3 Apr 2017 09:55:42 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 02/04/17 04:44 PM, spertasolutions wrote:
I'm using the following OCTAVE command to solve an equation:

syms lambda
f = 0.9999999999999999614356461247534*lambda^8 +
0.010136594318889089056437488043559*lambda^7 +
0.000015602822908760063058460837969499*lambda^6 -
0.000000047482181730798751628339904656436*lambda^5 -
1.6804583575154387080270563605856e-10*lambda^4 -
1.9779236089667689638174134679895e-13*lambda^3 -
1.1091457134190232245774382079799e-16*lambda^2 -
2.9823717782777009154185183839051e-20*lambda -
3.202469692780878591525091765936e-24
solve(f==0, lambda)

The answer I get is

ans = {}(0x0)
On the other hand, when I try to use the same command in MATLAB, I get the
following answer:

ans =
 0.0027518081408059183214532684717853
-0.0075831287286429577224408168637228
- 0.00029575583281255452382838468617809 -
0.0001257455668418381216048479457788*i
- 0.0016381334730465236707629472401125 -
0.00001988265276086766636376330275894*i
- 0.0016381334730465236707629472401125 +
0.00001988265276086766636376330275894*i
- 0.00071874755966694673136475169368249 -
0.00019245511322083820223381924903732*i
- 0.00029575583281255452382838468617809 +
0.0001257455668418381216048479457788*i
- 0.00071874755966694673136475169368249 +
0.00019245511322083820223381924903732*i
Is there any way I can make OCTAVE's output equal to MATLAB's output, may be
with some tweaks?

Not that I know of. There is no formula for roots of a 8th degree polynomial. I'd suggest using "vpasolve". Perhaps this is what Matlab's Symbolic Toolbox is doing anyway.

Some other comments:

1. You're mixing floating point and symbolic quantities in the same expression: in my experience, that's probably a bad idea.

2. For example: the roots of that 8th degree polynomial are going to be very sensitive to error in the monomial coefficients, whether solved for numerically or symbolically.

best,
Colin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]