Discussion:
[Maxima-discuss] trigtools/trigsolve broken ?
Christof Köhler
2016-05-25 15:17:53 UTC
Permalink
Hello,

I noticed that trigsolve from the trigtools package appears to be
broken. While I
understand that contrib is not maintained I would like to bring this
to your attention
anyway.

The trigtools documentation contrib/trigtools/trigtools-doc.pdf gives
an example
on page 9 for solving eq:3*sin(x)+4*cos(x)=2 (apparently the
documentation contains
an obvious typo there assigning a value to eq). Still, according to
the documentation
the result should be something involving atan() expressions and
numerical values given
appear to be right.

Actually doing the computation gives

Maxima 5.38.0 http://maxima.sourceforge.net
using Lisp CLISP 2.49 (2010-07-07)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) load(trigtools)$
(%i2) eq:3*sin(x)+4*cos(x)=2;
(%o2) 3 sin(x) + 4 cos(x) = 2
(%i3) trigsolve(eq,-%pi,%pi);
(%o3) {0, 2}
(%i4)

(%i6) build_info();
(%o6)
Maxima version: "5.38.0"
Maxima build date: "2016-04-06 12:07:25"
Host type: "x86_64-unknown-linux-gnu"
Lisp implementation type: "CLISP"
Lisp implementation version: "2.49 (2010-07-07) (built 3605577779)
(memory 3668926047)"

Actually it does not work with my own 5.37.2 build and the 5.32.1 package in
ubuntu 14.04 either.

Maxima 5.32.1 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.10 (a.k.a. GCL)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) load(trigtools);
(%o1) /usr/share/maxima/5.32.1/share/contrib/trigtools/trigtools.mac
(%i2) eq:3*sin(x)+4*cos(x)=2;
(%o2) 3 sin(x) + 4 cos(x) = 2
(%i3) trigsolve(eq,-%pi,%pi);
(%o3) {0, 2}


Or am I doing something wrong ?

Other trigtools functions like trigfactor, c2sin, trigvalue appear to
work as documented.

Best Regards

Christof
Stavros Macrakis (Σταῦρος Μακράκης)
2016-05-25 16:11:28 UTC
Permalink
I don't know anything about trigsolve, but %solve handles this:

load(to_poly_solve)$

%solve(eq,x);

%union([x =
2*%pi*%z45-%i*(log(((3*sqrt(21))/25+8/25)^2+(6/25-(4*sqrt(21))/25)^2)/2

-%i*atan(((4*sqrt(21))/25-6/25)/((3*sqrt(21))/25+8/25)))],
[x =
2*%pi*%z47-%i*(%i*(atan(((4*sqrt(21))/25+6/25)/(8/25-(3*sqrt(21))/25))+%pi)

+log(((4*sqrt(21))/25+6/25)^2+(8/25-(3*sqrt(21))/25)^2)/2)])

ratsimp(%);

%union([x = 2*%pi*%z45-atan((4*sqrt(21)-6)/(3*sqrt(21)+8))],
[x = 2*%pi*%z47-atan((4*sqrt(21)+6)/(3*sqrt(21)-8))+%pi])


On Wed, May 25, 2016 at 11:17 AM, Christof Köhler <
Post by Christof Köhler
Hello,
I noticed that trigsolve from the trigtools package appears to be
broken. While I
understand that contrib is not maintained I would like to bring this
to your attention
anyway.
The trigtools documentation contrib/trigtools/trigtools-doc.pdf gives
an example
on page 9 for solving eq:3*sin(x)+4*cos(x)=2 (apparently the
documentation contains
an obvious typo there assigning a value to eq). Still, according to
the documentation
the result should be something involving atan() expressions and
numerical values given
appear to be right.
Actually doing the computation gives
Maxima 5.38.0 http://maxima.sourceforge.net
using Lisp CLISP 2.49 (2010-07-07)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) load(trigtools)$
(%i2) eq:3*sin(x)+4*cos(x)=2;
(%o2) 3 sin(x) + 4 cos(x) = 2
(%i3) trigsolve(eq,-%pi,%pi);
(%o3) {0, 2}
(%i4)
(%i6) build_info();
(%o6)
Maxima version: "5.38.0"
Maxima build date: "2016-04-06 12:07:25"
Host type: "x86_64-unknown-linux-gnu"
Lisp implementation type: "CLISP"
Lisp implementation version: "2.49 (2010-07-07) (built 3605577779)
(memory 3668926047)"
Actually it does not work with my own 5.37.2 build and the 5.32.1 package in
ubuntu 14.04 either.
Maxima 5.32.1 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.10 (a.k.a. GCL)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) load(trigtools);
(%o1) /usr/share/maxima/5.32.1/share/contrib/trigtools/trigtools.mac
(%i2) eq:3*sin(x)+4*cos(x)=2;
(%o2) 3 sin(x) + 4 cos(x) = 2
(%i3) trigsolve(eq,-%pi,%pi);
(%o3) {0, 2}
Or am I doing something wrong ?
Other trigtools functions like trigfactor, c2sin, trigvalue appear to
work as documented.
Best Regards
Christof
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data
untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Maxima-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
Stavros Macrakis (Σταῦρος Μακράκης)
2016-05-25 19:46:22 UTC
Permalink
Even better, maybe:

ratsimp(%),algebraic
=>
%union([x = 2*%pi*%z45+atan((2*sqrt(21)-12)/5)],
[x = 2*%pi*%z47-atan((2*sqrt(21)+12)/5)+%pi])

On Wed, May 25, 2016 at 12:11 PM, Stavros Macrakis (ΣταῊρος Μακράκης) <
Post by Stavros Macrakis (Σταῦρος Μακράκης)
load(to_poly_solve)$
%solve(eq,x);
%union([x =
2*%pi*%z45-%i*(log(((3*sqrt(21))/25+8/25)^2+(6/25-(4*sqrt(21))/25)^2)/2
-%i*atan(((4*sqrt(21))/25-6/25)/((3*sqrt(21))/25+8/25)))],
[x =
2*%pi*%z47-%i*(%i*(atan(((4*sqrt(21))/25+6/25)/(8/25-(3*sqrt(21))/25))+%pi)
+log(((4*sqrt(21))/25+6/25)^2+(8/25-(3*sqrt(21))/25)^2)/2)])
ratsimp(%);
%union([x = 2*%pi*%z45-atan((4*sqrt(21)-6)/(3*sqrt(21)+8))],
[x = 2*%pi*%z47-atan((4*sqrt(21)+6)/(3*sqrt(21)-8))+%pi])
On Wed, May 25, 2016 at 11:17 AM, Christof Köhler <
Post by Christof Köhler
Hello,
I noticed that trigsolve from the trigtools package appears to be
broken. While I
understand that contrib is not maintained I would like to bring this
to your attention
anyway.
The trigtools documentation contrib/trigtools/trigtools-doc.pdf gives
an example
on page 9 for solving eq:3*sin(x)+4*cos(x)=2 (apparently the
documentation contains
an obvious typo there assigning a value to eq). Still, according to
the documentation
the result should be something involving atan() expressions and
numerical values given
appear to be right.
Actually doing the computation gives
Maxima 5.38.0 http://maxima.sourceforge.net
using Lisp CLISP 2.49 (2010-07-07)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) load(trigtools)$
(%i2) eq:3*sin(x)+4*cos(x)=2;
(%o2) 3 sin(x) + 4 cos(x) = 2
(%i3) trigsolve(eq,-%pi,%pi);
(%o3) {0, 2}
(%i4)
(%i6) build_info();
(%o6)
Maxima version: "5.38.0"
Maxima build date: "2016-04-06 12:07:25"
Host type: "x86_64-unknown-linux-gnu"
Lisp implementation type: "CLISP"
Lisp implementation version: "2.49 (2010-07-07) (built 3605577779)
(memory 3668926047)"
Actually it does not work with my own 5.37.2 build and the 5.32.1 package in
ubuntu 14.04 either.
Maxima 5.32.1 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.10 (a.k.a. GCL)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) load(trigtools);
(%o1) /usr/share/maxima/5.32.1/share/contrib/trigtools/trigtools.mac
(%i2) eq:3*sin(x)+4*cos(x)=2;
(%o2) 3 sin(x) + 4 cos(x) = 2
(%i3) trigsolve(eq,-%pi,%pi);
(%o3) {0, 2}
Or am I doing something wrong ?
Other trigtools functions like trigfactor, c2sin, trigvalue appear to
work as documented.
Best Regards
Christof
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data
untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Maxima-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
Christof Köhler
2016-05-26 07:35:41 UTC
Permalink
Hello,

I tried it again. What I notice it that

(%i1) load(trigtools);
(%o1) /usr/share/maxima/5.32.1/share/contrib/trigtools/trigtools.mac
(%i2) eq:3*sin(x)+4*cos(x)=2;
(%o2) 3 sin(x) + 4 cos(x) = 2
(%i3) trigsolve(eq,-%pi,%pi);
(%o3) {0, 2}

does not give the warning about to_poly_solve.

Loading to_poly_solve explicitely before trigtools/trigsolve appears to work

(%i1) load(to_poly_solve);
Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $
(%o1) /usr/share/maxima/5.32.1/share/to_poly_solve/to_poly_solve.mac
(%i2) load(trigtools);
(%o2) /usr/share/maxima/5.32.1/share/contrib/trigtools/trigtools.mac
(%i3) eq:3*sin(x)+4*cos(x)=2;
(%o3) 3 sin(x) + 4 cos(x) = 2
(%i4) trigsolve(eq,-%pi,%pi);
2 sqrt(21) 12 2 sqrt(21) 12
(%o4) {atan(---------- - --), %pi - atan(---------- + --)}
5 5 5 5

The same in 5.38.0. Both on ubuntu 14.04.

I assume that it does not load to_poly_solve automatically is not the
intended behaviour ?
I could not find anything hinting that to_poly_solve has to be loaded
manually in the
documentation. Eventually trigsolve should clearly abort if loading fails ?

Best Regards

Christof

----- Nachricht von Aleksas Domarkas <***@gmail.com> ---------
Datum: Wed, 25 May 2016 21:17:35 +0300
Von: Aleksas Domarkas <***@gmail.com>
Betreff: Re: [Maxima-discuss] trigtools/trigsolve broken ?
Post by Christof Köhler
(%i1) load(trigtools);
(%o1)
"C:\maxima-5.38.1\share\maxima\5.38.1_5_gdf93b7b_dirty\share\contrib\trigtools\trigtools.mac"
(%i2) eq:3*sin(x)+4*cos(x)=2;
(eq)3*sin(x)+4*cos(x)=2
(%i3) trigsolve(eq,-%pi,%pi);
to_poly_solve: to_poly_solver.mac is obsolete; I'm loading
to_poly_solve.mac instead.
(%o3) {atan((2*sqrt(21))/5-12/5),%pi-atan((2*sqrt(21))/5+12/5)}
(%i4) float(%);
(%o4) {-0.5157783719341241,1.802780589520693}
(%i5) wxplot2d([lhs(eq)-rhs(eq)], [x,-%pi,%pi])$
(%t5) (Graphics)
best
Aleksas D
Post by Christof Köhler
Hello,
I noticed that trigsolve from the trigtools package appears to be
broken. While I
understand that contrib is not maintained I would like to bring this
to your attention
anyway.
The trigtools documentation contrib/trigtools/trigtools-doc.pdf gives
an example
on page 9 for solving eq:3*sin(x)+4*cos(x)=2 (apparently the
documentation contains
an obvious typo there assigning a value to eq). Still, according to
the documentation
the result should be something involving atan() expressions and
numerical values given
appear to be right.
Actually doing the computation gives
Maxima 5.38.0 http://maxima.sourceforge.net
using Lisp CLISP 2.49 (2010-07-07)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) load(trigtools)$
(%i2) eq:3*sin(x)+4*cos(x)=2;
(%o2) 3 sin(x) + 4 cos(x) = 2
(%i3) trigsolve(eq,-%pi,%pi);
(%o3) {0, 2}
(%i4)
(%i6) build_info();
(%o6)
Maxima version: "5.38.0"
Maxima build date: "2016-04-06 12:07:25"
Host type: "x86_64-unknown-linux-gnu"
Lisp implementation type: "CLISP"
Lisp implementation version: "2.49 (2010-07-07) (built 3605577779)
(memory 3668926047)"
Actually it does not work with my own 5.37.2 build and the 5.32.1 package in
ubuntu 14.04 either.
Maxima 5.32.1 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.10 (a.k.a. GCL)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) load(trigtools);
(%o1) /usr/share/maxima/5.32.1/share/contrib/trigtools/trigtools.mac
(%i2) eq:3*sin(x)+4*cos(x)=2;
(%o2) 3 sin(x) + 4 cos(x) = 2
(%i3) trigsolve(eq,-%pi,%pi);
(%o3) {0, 2}
Or am I doing something wrong ?
Other trigtools functions like trigfactor, c2sin, trigvalue appear to
work as documented.
Best Regards
Christof
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data
untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Maxima-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
----- Ende der Nachricht von Aleksas Domarkas <***@gmail.com> -----
Stavros Macrakis (Σταῦρος Μακράκης)
2016-05-26 15:27:47 UTC
Permalink
On Thu, May 26, 2016 at 3:35 AM, Christof Köhler <
***@bccms.uni-bremen.de> wrote:
​...​
Post by Christof Köhler
(%i1) load(trigtools);
​...​
Post by Christof Köhler
​​
does not give the warning about to_poly_solve.
Loading to_poly_solve explicitely before trigtoo
​​
ls/trigsolve appears to work
​Packages should normally load any packages they depend on (if they are not
already loaded), and give an error if that fails.

​​ -s​

Loading...