Thank you for the bug report--if at all possible, please file a bug report (http://sourceforge.net/p/maxima/bugs/).
By the way:
(%i4) sol : to_poly_solve(expr, costheta);
1" Enter "to_poly[-2*m[a]*p[a]^2*E[a]*costheta*E_M*sqrt(m[a]^2*E_M^2+m[1]^2*p[a]^2*costheta^2-m[1]^2*E[a]^2)-costheta^2*(m[a]^2*p[a]^3*E_M^2+m[1]^2*p[a]^3*E[a]^2)-m[a]^2*p[a]*E[a]^2*E_M^2+m[1]^2*p[a]*E[a]^4,[costheta]]
1" Exit "to_poly[[(-m[a]^2*p[a]^3*costheta^2-m[a]^2*p[a]*E[a]^2)*E_M^2-2*%g7*m[a]*p[a]^2*E[a]*costheta*E_M-m[1]^2*p[a]^3*E[a]^2*costheta^2+m[1]^2*p[a]*E[a]^4,m[a]^2*E_M^2+m[1]^2*p[a]^2*costheta^2-m[1]^2*E[a]^2=%g7^2],[-%pi/2<parg(%g7),parg(%g7)<=%pi/2],[]]
1" Enter "algsys[[(-m[a]^2*p[a]^3*costheta^2-m[a]^2*p[a]*E[a]^2)*E_M^2-2*%g7*m[a]*p[a]^2*E[a]*costheta*E_M-m[1]^2*p[a]^3*E[a]^2*costheta^2+m[1]^2*p[a]*E[a]^4,m[a]^2*E_M^2+m[1]^2*p[a]^2*costheta^2-m[1]^2*E[a]^2=%g7^2],[%g7,costheta]]
1" Exit "algsys[[%g7=m[a]*E_M,costheta=-E[a]/p[a]],[%g7=-m[a]*E_M,costheta=E[a]/p[a]]]
1" Enter "algsys[[],[]]
1" Exit "algsys[[]]
1" Enter "algsys[[],[]]
1" Exit "algsys[[]]
(%o4) %union([costheta=-E[a]/p[a]],[costheta=E[a]/p[a]])
Since -%pi/2<parg(%g7),parg(%g7)<=%pi/2, it follows that %g7 must be in the right half plane. Looking at the output of algsys, the %g7 solution puts
m[a]*E_M (or its negation) into the right half plane. Since m[a] * E_M doesn't involve costheta, the to_poly_solver erroneously concludes that
-%pi/2<parg(%g7),parg(%g7)<=%pi/2, says nothing about the solution. That's purely a logical error on my part.
Also, checking the answer shows that it is bogus:
(%i9) map(lambda([s], subst(s, expr)), sol)$
(%i10) factor(ratsimp(%));
(%o10) %union(-2*m[a]*p[a]*E[a]^2*E_M*(abs(m[a])*abs(E_M)-m[a]*E_M),2*m[a]*p[a]*E[a]^2*E_M*(abs(m[a])*abs(E_M)+m[a]*E_M))
Sorry for the my error, and thanks for the bug report.
--Barton
________________________________________
From: maxima-bounces at math.utexas.edu [maxima-bounces at math.utexas.edu] on behalf of Dmitry Shkirmanov [piminusmeson at bk.ru]
Sent: Wednesday, November 28, 2012 01:18
To: maxima at math.utexas.edu
Subject: to_poly_solve() bug?
ya at shvabra:~$ maxima
Maxima 5.28.0 http://maxima.sourceforge.net
using Lisp SBCL 1.0.40.0.debian
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) load("to_poly_solve")$
Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $
STYLE-WARNING: redefining SIMP-ISREAL-P in DEFUN
(%i2) expr:2*E_M*m[a]*p[a]^2*E[a]*costheta*sqrt(m[1]^2*p[a]^2*costheta^2-m[1]^2*E[a]^2+E_M^2*m[a]^2)+(m[1]^2*p[a]^3*E[a]^2+E_M^2*m[a]^2*p[a]^3)*costheta^2-m[1]^2*p[a]*E[a]^4+E_M^2*m[a]^2*p[a]*E[a]^2$
(%i3) to_poly_solve(expr, costheta);
E E
a a
(%o3) %union([costheta = - --], [costheta = --])
p p
a a
(%i4) assume(m[a]>0, E_M>0);
(%o4) [m> 0, E_M> 0]
a
(%i5) to_poly_solve(expr, costheta);
E
a
(%o5) %union([costheta = - --])
p
a
(%i6)
It looks like that to_poly_solve() gives wrong solution E[a]/p[a] in (%o3). Is it really bug or some kind of feature?
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima