Open rtoy opened 4 months ago
Imported from SourceForge on 2024-07-04 18:03:19 Created by robert_dodier on 2021-12-06 05:35:55 Original: https://sourceforge.net/p/maxima/bugs/3896/#ca69
Confirmed in Maxima post-5.45. I was digging around in src/trgred.lisp a little bit, and I tried a few changes to SP1TLIN to avoid the error, but I wasn't able to get a correct result.
The code in src/trgred.lisp is pretty convoluted; from reading the comments, it looks like a fairly narrow range of expressions is handled. If so, then just starting over and rewriting in Maxima, making use of the pattern matching machinery (matchdeclare / defrule, etc.) could be a win.
For the record, I find I can get to the expected result by working in steps.
(%i1) cos(e/2)^2*sin(e/2)^2;
2 e 2 e
(%o1) cos (-) sin (-)
2 2
(%i2) trigreduce(%);
1 - cos(2 e)
(%o2) ------------
8
(%i3) %, e=acos(a);
1 - cos(2 acos(a))
(%o3) ------------------
8
(%i4) trigexpand(%);
2
2 - 2 a
(%o4) --------
8
(%i5) ratsimp(%);
2
a - 1
(%o5) - ------
4
Imported from SourceForge on 2024-07-04 18:03:22 Created by macrakis on 2022-01-10 14:32:23 Original: https://sourceforge.net/p/maxima/bugs/3896/#179e
trigreduce(cos(k*acos(q))^2*sin(k*acos(q))^2)
also works fine.
Substituting k=1/2, applying trigexpand
, then ratsimp
, gets a nice simple (and correct) answer, -(q^2-1)/4
.
Imported from SourceForge on 2024-07-04 18:03:18 Created by dreitzle on 2021-12-03 17:49:05 Original: https://sourceforge.net/p/maxima/bugs/3896
I stumbled upon the following problem in trigreduce():
The correct answer should be something like (1-q^2)/4 .