Question about to_poly_solve



 see Rupert Swarbrick mail
http://www.math.utexas.edu/pipermail/maxima/2013/033278.html

 Example. Solve trigonometric equation
(%i1) eq:cos(3*x)-sin(x)=sqrt(3)*(cos(x)-sin(3*x));
(%o1) cos(3*x)-sin(x)=sqrt(3)*(cos(x)-sin(3*x))

 We use identity T:
(%i2) T:cos(x)-sin(y)=2*sin(%pi/4-x/2-y/2)*sin(%pi/4+x/2-y/2);
(%o2) cos(x)-sin(y)=2*sin(y/2-x/2-%pi/4)*sin(y/2+x/2-%pi/4)

 and  function "trigsolve" for solving trigonometric equations in interval
[a, b)
(%i3) trigsolve(eq,a,b):=block([a1,s,ats,i],
algebraic:true,
to_poly_solve([eq], [x],
'simpfuncs = ['rootscontract,'expand,'radcan, 'nicedummies]),
s:makelist(rhs(part(%%,k)[1]),k,1,length(%%)),
ats:[],
for i:1 thru length(s) do
(makelist(ev(s[i],%z0=k),k,-10,10),
ats:append(ats,%%)),
sublist(ats,lambda([e],e>=a and e<b)),
sort(%%),
setify(%%)
)$

 Equation is equivalent to
(%i4) psubst([x=3*x,y=x],rhs(T))=sqrt(3)*subst(y=3*x,rhs(T));
(%o4) -2*sin(x+%pi/4)*sin(2*x-%pi/4)=2*sqrt(3)*sin(x-%pi/4)*sin(2*x-%pi/4)
(%i5) L:factor(rhs(%)-lhs(%));
(%o5) 2*(sin((4*x+%pi)/4)+sqrt(3)*sin((4*x-%pi)/4))*sin((8*x-%pi)/4)
(%i6) eq1:part(L,2)=0;
(%o6) sin((4*x+%pi)/4)+sqrt(3)*sin((4*x-%pi)/4)=0
(%i7) eq2:part(L,3)=0;
(%o7) sin((8*x-%pi)/4)=0

(%i8) S1:trigsolve(eq1,0,2*%pi);
to_poly_solve: to_poly_solver.mac is obsolete; I'm loading
to_poly_solve.mac instead.
Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $
(%o8) {%pi/12,(13*%pi)/12}

(%i9) S2:trigsolve(eq2,0,2*%pi);
(%o9) {%pi/8,(5*%pi)/8,(9*%pi)/8,(13*%pi)/8}

(%i10) S:listify(union(S1,S2));
(%o10) [%pi/12,%pi/8,(5*%pi)/8,(13*%pi)/12,(9*%pi)/8,(13*%pi)/8]

(%i11) float(%), numer;
(%o11)
[0.26179938779915,0.39269908169872,1.963495408493621,3.403392041388942,3.534291735288517,5.105088062083414]

 Answer:
x = a+2*%pi*k, where a any from S, k any integer

best regards

Aleksas D