> I need to solve trig functions on maxima and get all solutions for a
> given domain. For example, sin(x) = 1/2 In the domain of [-2*%pi, 2*%pi].
The package (in share/contrib) is able to find the complete solution to some trigonometric equations, but
it doesn't have a mechanism for determining the solutions in a given interval. Examples:
(%i1) load(to_poly_solver)$
The solution to sin(x)=1/2 is given in terms of arbitrary integers %z6 and %z8
(%i2) %solve(sin(x)=1/2,x);
(%o2) %union([x=2*%pi*%z6+%pi/6],[x=2*%pi*%z8+(5*%pi)/6])
The function nicedummies resets the indices of the dummy variables to 0 and 1
(%i3) nicedummies(%);
(%o3) %union([x=2*%pi*%z0+%pi/6],[x=2*%pi*%z1+(5*%pi)/6])
Determining the values of the %z0 and %z1 that give solutions in a given interval will not be easy, I think.
Another example:
(%i4) %solve(cos(3*x)*sin(x-%pi/4)=0,x);
(%o4) %union([x=-(-2*%pi*%z18-%pi)/2],[x=-(%pi/3-2*%pi*%z20)/2],[x=-(-2*%pi*%z22-%pi/3)/2],[x=-(-2*%pi*%z24-%pi/2)/2])
By the way: A high school student can outwit %solve:
(%i5) %solve(cos(42*x)*sin(x),x);
(%o5) %solve([sin(x)*cos(42*x)],[x])
First %solve makes the change of variable z = exp(%i x); second it tries to solve a degree 86 polynomial equation for z. It's unable to find all 86 solutions, so %solve fails
to return any solutions. The degree 86 polynomial (z ---> %g205) is
(%i20) (-%g205^86+%g205^84-%g205^2+1);
(%o20) -%g205^86+%g205^84-%g205^2+1
Show that %g205 = exp(%i * %pi/84) is a solution:
(%i21) subst(%g205=exp(%i * %pi/84),%);
(%o21) -%e^((%i*%pi)/42)-%e^(-(41*%i*%pi)/42)
(%i22) rectform(%);
(%o22) %i*(sin((41*%pi)/42)-sin(%pi/42))-cos((41*%pi)/42)-cos(%pi/42)
(%i23) trigrat(%);
(%o23) 0
Oh surely, %solve should notice that %solve(cos(42*x)*sin(x),x) = union(%solve(cos(42*x),x), %solve(sin(x),x)). The %to_poly_solver has other
weaknesses too :(
--bw (author of %to_poly_solver)