Sage has several methods that are used primarily when an expression involves trigonometric functions. Let's try them out.
var('x, y') f(x, y) = sin(x) * cos(x)^3 + sin(y)^2 print("f(x, y)") f.show() g(x, y) = f.reduce_trig() # also trig_reduce print("After trig_reduce:") g.show() print("After expanding:") show(g.expand_trig()) # also trig_expand print("Simplify to get original expression:") show(g.expand_trig().trig_simplify()) # also simplify_trig
The output is shown in the following screenshot:
We demonstrated some useful methods that are specifically designed to manipulate expressions that involve trigonometric functions. expand_trig
and reduce_trig
(or trig_expand
and trig_reduce
) are complementary methods that have a similar function to those used in the previous example. We also introduced the method called trig_simplify
(or simplify_trig
), which attempts to represent an expression in the most...