See also bug reports ID: 742909 and ID: 2999635
INPUT
build_info();
display2d : false;
trigrat(sin(%pi/5));
INPUT AND OUTPUT
(%i1) build_info();
Maxima version: 5.25.0
Maxima build date: 12:0 8/2/2011
Host type: i686-pc-mingw32
Lisp implementation type: Clozure Common Lisp
Lisp implementation version: Version 1.7-r14925M (WindowsX8632)
(%o1)
(%i2) display2d : false;
(%o2) false
(%i3) trigrat(sin(%pi/5));
(%o3) -(-sin(3*%pi/5)+%i*(cos(3*%pi/5)-cos(2*%pi/5)+2*cos(%pi/5)-1)
+sin(2*%pi/5)-2*sin(%pi/5))
/2
Verified that this is still a problem in 5.43 on SBCL.
Note that the result is doubly bad: not only does it make something simple into something complicated, but the imaginary part can actually be simplified by trigrat to zero:
I ran into a similar problem with sin(%pi/7). In fact, it gives stuff like this for all
with n>4.
A side-effect of this non-simplification is that trying scanmap(trigrat,e1) gets into an infinite loop, since a subexpression gets expanded....
Interestingly, if you load(spangl) (range reduction for trig), some of these problems go away:
but sometimes trigrat loops:
That is, it's not idempotent.
Here is a related bug report: https://sourceforge.net/p/maxima/bugs/4554/