Trigonometric expansions and simplifications
Trigonometry is full of multiples of angles, the sums of angles, the products and the powers of trigonometric functions, and the long list of relations between them. Multiples and sums of angles fall into one category. The products and powers of trigonometric functions fall in another category. It’s very useful to do conversions from one of these categories to the other one, to crack a range of simple and complex problems catering to a range of requirements—from basic hobby science to quantum mechanics. trigexpand() does the conversion from ‘multiples and sums of angles’ to ‘products and powers of trigonometric functions’. trigreduce() does exactly the opposite. Here’s a small demo: $ maxima -q (%i1) trigexpand(sin(2*x)); (%o1) 2 cos(x) sin(x) (%i2) trigexpand(sin(x+y)-sin(x-y)); (%o2) 2 cos(x) sin(y) (%i3) trigexpand(cos(2*x+y)-cos(2*x-y)); (%o3) - 2 sin(2 x) sin(y) (%i4) trigexpand(%o3); (%o4) - 4 cos(x) sin(x) sin(y) (%i5) string(trigreduce(%o4)); (%o5) -2*(cos(y-2*x)/2-cos(y+2*x)/2) (%i6) string(trigsimp(%o5)); (%o6) cos(y+2*x)-cos(y-2*x) (%i7) string(trigexpand(cos(2*x))); (%o7) cos(x)^2-sin(x)^2 (%i8) string(trigexpand(cos(2*x) + 2*sin(x)^2)); (%o8) sin(x)^2+cos(x)^2 (%i9) trigsimp(trigexpand(cos(2*x) + 2*sin(x)^2)); (%o9) 1 (%i10) quit();
In %o5 above, you might have noted that the 2s could have been cancelled for further simplification. But that is not the job of trigreduce(). For that we have to apply the trigsimp() function as shown in %i6. In fact, many other trigonometric identities-based simplifications are achieved using trigsimp(). Check out the %i7 to %o9 sequences for another such example.