-----macrakis at gmail.com wrote: -----
>scanfactorpower(ex):=block([inflag:true],
> if mapatom(ex) then ex
> elseif op(ex)="^" and ratnump(part(ex,1)) and ratnump(part(ex,2))
> then block([algebraic:true],ratsimp(factor(part(ex,1)) ^
>part(ex,2)))
> else map(scanfactorpower,ex) ) $
>
>Does this solve your problem?
Thanks---Yes, this seems to be a nice workaround.
I was playing with an alternative to_poly_solve. The solver was
rejecting some non-spurious solutions because it wasn't crunching some
expressions to zero. Here is a tiny deomo of the alternative solver:
(%i17) domain : complex$
(%i18) sol : xsolve(sqrt(x)=a,x);
(%o18) if equal(sqrt(a^2),a) then [x=a^2] else {}
(%i19) subst(a=1+%i,%);
(%o19) if equal(sqrt((%i+1)^2),%i+1) then [x=(%i+1)^2] else {}
The 'ev' is required, I think :(
(%i20) ev(%);
(%o20) [x=(%i+1)^2]
(%i21) sol : xsolve(abs(x)=a,x);
(%o21) (if equal(abs(a),a) then [x=a] else {}) or (if equal(abs(a),a) then
[x=-a] else {})
(%i22) subst(a=-42,%);
(%o22) (if equal(42,-42) then [x=-42] else {}) or (if equal(42,-42) then
[x=42] else {})
Yikes! set() or set () doesn't simplify to set(); that's sad.
(%i23) ev(%);
(%o23) {} or {}
to_poly_solve is "smarter"
(%i35) xsolve(x^(1/2) - x = 1,x);
(%o35) (if equal(sqrt(sqrt(3)*%i-1)/sqrt(2)-(sqrt(3)*%i-1)/2,1) then
[x=(sqrt(3)*%i-1)/2] else {}) or
(if equal((sqrt(3)*%i+1)/2+sqrt(-sqrt(3)*%i-1)/sqrt(2),1) then
[x=-(sqrt(3)*%i+1)/2] else {})
(%i36) to_poly_solve(x^(1/2) - x = 1,x);
(%o36) [[x=(sqrt(3)*%i-1)/2],[x=-(sqrt(3)*%i+1)/2]]
The solvers use different schemes for rejecting spurious
solutions...
Whenever I look at the way Maxima simplifies / evaluates logical
expressions, I'm flummoxed: Let's trace simp-mand; OK:
(%i2) a and b;
1> (SIMP-MAND ((MAND) $A $B) 1 NIL)
<1 (SIMP-MAND ((MAND SIMP) $A $B))
(%o2) a and b
But (a=1) and b doesn't get sent through simp-mand
(%i3) (a=1) and b;
(%o3) false
Barton