_____________________________________
> I have another question: When I solve sin(x)=0 for x then, I get x=0
One (not the only) option is to try the to_poly_solve function. This function attempts to convert an equation (or equations) into a polynomial form
and then solve; for example:
(%i1) load(to_poly_solve)$
Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $
(%i2) %solve(sin(x)=0,x);
(%o2) %union([x=2*%pi*%z6+%pi],[x=2*%pi*%z8])
A %union object is more-or-less like a set.
Variables of the vorm %zXXX are arbitrary integers. Maxima automatically declares them to be integers. The function nicedummies
re-indexes %zXXX variables to start with zero:
(%i3) nicedummies(%);
(%o3) %union([x=2*%pi*%z0+%pi],[x=2*%pi*%z1])
We can check that the solutions are correct:
(%i4) map(lambda([s], subst(s, sin(x)=0)),args(%));
(%o4) [0=0,0=0]
Another example:
(%i5) %solve(sin(x)=1/2,x);
(%o5) %union([x=2*%pi*%z16+%pi/6],[x=2*%pi*%z18+(5*%pi)/6])
(%i6) map(lambda([s], subst(s, sin(x)=1/2)),args(%));
(%o6) [1/2=1/2,1/2=1/2]
(%i7) %solve(max(5,x+1)=42+x,x);
(%o7) %union([x=-37])
(%i8) %solve(sin(x)*cos(2*x)=0,x);
(%o8) %union([x=2*%pi*%z35+%pi],[x=2*%pi*%z37],[x=2*%pi*%z39-(3*%pi)/4],[x=-(-8*%pi*%z41-%pi)/4],[x=2*%pi*%z43-%pi/4],[x=2*%pi*%z45+(3*%pi)/4])
(%i9) map(lambda([s], subst(s, sin(x)*cos(2*x)=0)),args(%));
(%o9) [0=0,0=0,-cos(2*(2*%pi*%z39-(3*%pi)/4))/sqrt(2)=0,-sin((-8*%pi*%z41-%pi)/4)*cos((-8*%pi*%z41-%pi)/2)=0,-cos(2*(2*%pi*%z43-%pi/4))/sqrt(2)=0,cos(2*(2*%pi*%z45+(3*%pi)/4))/sqrt(2)=0]
(%i10) trigrat(%);
(%o10) [0=0,0=0,0=0,0=0,0=0,0=0]
Yikes--when the polynomial system has a high degree, Maxima sometimes finds approximation solutions. Then %solve returns approximate solutions, but they
have the appearance of being exact (no floats)
(%i11) %solve(sin(x)*cos(2*x)=1/3,x);
(%o11) %union([x=-(-12808237340241690624*%pi*%z57+711*%i+13776511260126347264)/6404118670120845312],[x=(6040*%pi*%z59-2991)/3020],[x=-(-37207902*%pi*%z61-3179029*%i-50544051)/18603951], [x=-(-39429822*%pi*%z63-3368869*%i-8373861)/19714911],[x=-(-39429822*%pi*%z65+3368869*%i-8373861)/19714911],[x=-(-37207902*%pi*%z67+3179029*%i-50544051)/18603951])
--Barton