semi-newbie | differences in solve



On Mon, Jun 20, 2011 at 16:45, egc <cooch17 at verizon.net> wrote:

> On 6/20/2011 4:14 PM, Barton Willis wrote:
>
>> ...The function linsolve doesn't check for linearity, so calling linsolve
>> on a nonlinear equation is hazardous; example
>>
>> Bogus:
>>
>>  (%i16) linsolve(p + p^3-42,p);
>>  (%o16) [p=42]
>>
>
> Clearly -- should be p=3.38015...
>
> Challenge here is the complex roots, I suppose.


No, that's not the problem!  The problem is that linsolve is ignoring the
p^3 term completely, cf.

linsolve(a*x^2+b*x+c,x);
   =>  [x = -c/b]

We should probably at least *check* for nonsense like this.

Regular solve (for symbolic solutions), algsys (for systems of algebraic
equations), and allroots (for numerical solutions) have no problem with the
complex roots.

           -s