does solve fail on sin(x)=sin(x) ?



-----maxima-bounces at math.utexas.edu wrote: -----

>(%i) solve(sin(x)+cos(x)=0,x)
>
>With "solveexplicit: false" I get
>(%o) [sin(x)=-cos(x)]
>
>and with "solveexplicit: true"
>(%o)  []
>
>Hm. Should maxima be able to give the "desired" solution (did I forget
>some variable?) or is this a known "bug" (cause the second is clearly
false).

It's not a bug that keeps Maxima from solving sin(x)+cos(x)=0. The
problem is that solve doesn't know much about non-polynomial
equations. As far as I know, solve doesn't even have a mechanism
for returning a non-finite solution set.

Here is a workaround (using the same steps, you could define a function
that
tries to solve other trigonometric equations):

(%i2) eq : sin(x)+cos(x)=0;
(%o2) sin(x)+cos(x)=0

(%i3) eq : exponentialize(eq);
(%o3)(%e^(%i*x)+%e^(-%i*x))/2-(%i*(%e^(%i*x)-%e^(-%i*x)))/2=0

(%i4) eq : ratsubst(z, exp(%i*x),eq);
(%o4) -(-z^2+%i*(z^2-1)-1)/(2*z)=0

(%i5) eq : solve(eq,z);
(%o5)[z=-sqrt(%i/(%i-1)+1/(%i-1)),z=sqrt(%i/(%i-1)+1/(%i-1))]

(%i6) eq : ratsimp(eq);
(%o6) [z=-sqrt(-%i),z=sqrt(-%i)]

(%i7) eq : ratsubst(exp(%i*x - 2*%pi * %i * n),z,eq);
(%o7) [%e^(%i*x-2*%i*%pi*n)=-sqrt(-%i),%e^(%i*x-2*%i*%pi*n)=sqrt(-%i)]

(%i8) map(lambda([s], expand(rectform(solve(s,x)))),%);
(%o8) [[x=2*%pi*n+(3*%pi)/4],[x=2*%pi*n-%pi/4]]

There is another solve function in /share. I don't know much about
it. I wasn't able to get it to solve your equation:

(%i10) load(solver)$

(%i11) Solver([cos(x) + sin(x)=0],[x],[]);

(%o11) [[[sin(x)+cos(x)]]]

BW