# recognize form sin(x)^2 + cos(x)^2 = 1

Is there a way to tell sage that expressions like sin(x)^2 + cos(x)^2 are equivalent to 1? So, for instance, sage would replace/simplify an expression like sin(t+1)^2 + cos(t+1)^2 with 1.

edit retag close merge delete

Sort by ยป oldest newest most voted

Actually, this doesn't work in any but the nearly trivial case. If Sage has gotten to the point (in something like human notation) that f(t) = sqrt(64(sin^2(t)+cos^2(t))cos^2(8t) + (sin^2(t)+cos^2(t)+64)sin^2(8t) + 16cos^2(t) + 8(sin^2(t)+cos^2(t))sin(8t) + 64sin^2(8t)), then f.simplify makes no change, f.simplify_full expands everything down to sin(t) and cos(t) without ever noticing the sin^2+cos^2, f.simplify_real makes no change, f.simplify_trig does the same thing as f.simplify_full. In fact, the expression can be written as sqrt( (sin(8t)+4)^2+64).

more

Looks like trig_simplify() does the job:

f(t) = cos(t+1)^2 + sin(t+1)^2 f.trig_simplify()

t |--> 1

Where would I find this in the sage documentation if I did not know the name of the method (trig_simplify()) ?

more

You're looking to use a trig identity to simplify your expression. Searching "trig identity" on the sagemath website gives [this page](http://www.sagemath.org/doc/reference/calculus/sage/symbolic/expression.html) as the first result and searching "trig simplify" gets you results, too. Likewise, googling "sagemath trig" gives 1 (!) result, the page linked above. A problem with simplifying is that there can be multiple simplified form [cos(2x), cos^2(x)-sin^2(x), 2cos^2(x)-1, 1-2sin^2(x)]. Which form result should be given as simplified?

( 2014-08-16 20:40:59 +0200 )edit