Subject: problem solving multiple trigonometric equations
From: Olaf Booij
Date: Wed, 23 Jun 2010 00:21:05 +0200
On Tue, Jun 22, 2010 at 04:38:17PM -0500, Barton Willis wrote:
> -----maxima-bounces at math.utexas.edu wrote: -----
>
> >Very recently I started using Maxima and already got some usefull results.
> >However, I now stumbled on a problem with solving mutliple equations
> >involving
> >trigonometric functions. A simple (not very usefull) example:
> >
> >(%i1) solve([cos(x) = 1/2, sin(y) = 1/2], [x,y]);
> >(%o1) []
>
> Maxima has two alternative solve functions. I know little about one
> of these, but the optional package to_poly_solver can solve trigonometric
> equations that can be converted into polynomial equations that algsys can solve.
> Try this:
>
> (%i1) load(to_poly_solver)$
>
> (%i8) %solve([cos(x) = 1/2, sin(y) = 1/2], [x,y], 'simpfuncs = ['ratexpand]);
>
> (%o8) %union([x=2*%pi*%z58-%pi/3,y=2*%pi*%z58+(5*%pi)/6],[x=2*%pi*%z60-%pi/3,y=2*%pi*%z60+%pi/6],[x=2*%pi*%z62+%pi/3,y=2*%pi*%z62+(5*%pi)/6],[x=2*%pi*%z64+%pi/3,y=2*%pi*%z64+%pi/6])
>
> The user documentation for to_poly_solve is
>
> .../maxima/share/contrib/topoly-user-doc.html
>
> where ... depends on the location of your Maxima. Welcome to Maxima.
> Let us know if you have questions about to_poly_solver or Maxima in
> general.
Thanks Barton, for the quick reply.
I compiled maxima-5.21.1, which allowed me to load the to_poly_solver
package:
(%i1) load("to_poly_solver");
Loading maxima-grobner $Revision: 1.6 $ $Date: 2009/06/02 07:49:49 $
define: warning: redefining the built-in function prog1
define: warning: redefining the built-in function symbolcheck
define: warning: redefining the built-in function push
define: warning: redefining the built-in function pop
define: warning: redefining the built-in function tr_ev
WARNING: DEFUN/DEFMACRO: redefining macro OPAPPLY in
/home/obooij/src/maxima-5.21.1/share/contrib/fourier_elim/fourier_elim.
lisp,
was defined in
/home/obooij/src/maxima-5.21.1/share/contrib/topoly.lisp
WARNING: DEFUN/DEFMACRO: redefining macro OPCONS in
/home/obooij/src/maxima-5.21.1/share/contrib/fourier_elim/fourier_elim.
lisp,
was defined in
/home/obooij/src/maxima-5.21.1/src/binary-clisp/nummod.fas
WARNING: DEFUN/DEFMACRO: redefining function SIMP-ISREAL-P in
/home/obooij/src/maxima-5.21.1/share/contrib/to_poly_solve_extra.lisp,
was defined in
/home/obooij/src/maxima-5.21.1/share/contrib/topoly.lisp
(%o1) /home/obooij/src/maxima-5.21.1/share/contrib/to_poly_solver.mac
I hope I can safely ignore these warnings.
This indeed allowed me to solve the equation:
(%i2) %solve([cos(x) = 1/2, sin(y) = 1/2], [x,y], 'simpfuncs = ['ratexpand]);
%pi 5 %pi
(%o2) %union([x = 2 %pi %z15 - ---, y = 2 %pi %z15 + -----],
3 6
%pi %pi
[x = 2 %pi %z17 - ---, y = 2 %pi %z17 + ---],
3 6
%pi 5 %pi
[x = 2 %pi %z19 + ---, y = 2 %pi %z19 + -----],
3 6
%pi %pi
[x = 2 %pi %z21 + ---, y = 2 %pi %z21 + ---])
3 6
However, a somewhat more involved (although still simple) example does not seem to work:
%solve([cos(x) = 1/2, cos(x)*sin(y) = 1/3], [x,y], 'simpfuncs = ['ratexpand]);
Unable to solve
Unable to solve
Unable to solve
1 1
(%o3) %solve([cos(x) = -, cos(x) sin(y) = -], [x, y], simpfuncs = [ratexpand])
2 3
I didn't have a look at topoly-user-doc.html yet, so perhaps the answer is
in there (and if so: sorry for this post).
Olaf