noninteractive and topoly together



-----maxima-bounces at math.utexas.edu wrote: -----

>Thanks Barton.  That solved my specific problem nicely.  A couple more
>things FYI below.
>
>On Thu, 24 Jul 2008, Barton Willis wrote:
>
>> The function to_poly_solve tries to be careful; try this (eq is your
>> equation) workaround:
>>
>> (%i3) to_poly(eq,[phi2])$
>> (%i4) elim(first(%),[%g0,%g1])$
>
>(The dummy variables I get seem to be called %g1 and %g2, but I guess
>this difference is trivial.)

You'll get different dummy variables each time you evaluate %i3. That's a
necessary nuisance, I think.

>> (%i11) for si in sol do print([si,radcan(subst(si, eq))]);
>>  <radcan believes in the multi-valueness of sqrt, so all solutions are
>OK>
>
>Nice.  But I wonder what I should read into it if one of the solutions
>didn't pass this test.

Either it means the putative solution is spurious or that there is a bug.
Here is an example of a spurious solution:

(%i15) eq : sqrt(x) - sqrt(5-x) = -sqrt(2)$

(%i16) to_poly(eq,[x])$

(%i17) elim_allbut(first(%),[x])$

(%i18) sol : solve(first(%),x);

(%o18) [x=9/2,x=1/2]

(%i19) for si in sol do print([si,radcan(subst(si, eq))]);
[x=9/2,2/sqrt(2)=-sqrt(2)]
[x=1/2,-2/sqrt(2)=-sqrt(2)]

If you allow the square roots in sqrt(x) - sqrt(5-x) = -sqrt(2) to each
have
different definitions, x = 9/2 is a solution.

>> So to_poly_solve finds two solutions; depending on some messy
>> inequality, conditionally there is a third solution.
>
>Almost.  There are also chains of answers (e.g. -+---+--) for which
>to_poly_solve finds only one solution, or (e.g. -+-0) for which it
>finds no solution at all.

Sorry--I didn't mean to say that "to_poly_solve finds two solutions." I
should have
said that the "workaround found..."

Barton