Subject: controlling output of a trigonometric sum
From: Giulio Venezian
Date: Sun, 17 Nov 2013 14:40:02 -0500
Here is a fragment: (the %o lines are messed up)
(%i59) (t*cos(x)+t^3*cos(3*x))^2*4*cos(x);
3 2
(%o59) 4 cos(x) (t cos(3 x) + t cos(x))
(%i60) expand(%);
6 2 4 2 2 3
(%o60) 4 t cos(x) cos (3 x) + 8 t cos (x) cos(3 x) + 4 t cos (x)
(%i61) trigreduce(%);
6 6
t cos(7 x) t cos(5 x)
----------- + ----------- 6
2 2 t cos(x)
(%o61) 4 (------------------------- + ---------)
2 2
4 4
t cos(5 x) t cos(x)
----------- + --------- 4 2 2
2 2 t cos(3 x) t cos(3 x) 3 t cos(x)
+ 8 (----------------------- + -----------) + 4 (----------- + -----------)
2 2 4 4
(%i62) expand(%);
6 6 4 4 2
(%o62) t cos(7 x) + t cos(5 x) + 2 t cos(5 x) + 4 t cos(3 x) + t cos(3 x)
6 4 2
+ 2 t cos(x) + 2 t cos(x) + 3 t cos(x)
(%i63)
I would like the output grouped like this:
cos(x)*(3t^2+2t^4+2t^6) +cos(3x)*(t^2+4t^4) + cos(5x)*(t^6) +cos(&x)*(t^6)
in other words, as a sum of cos(nx)*fn(t). And it would be extra nice if the fn(t) come out in increasing powers of t.
Can this be done?