Ask Your Question

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

asked 2014-08-16 18:17:01 +0200

mgass gravatar image

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 flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-04-15 05:33:34 +0200

lh gravatar image

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).

edit flag offensive delete link more

answered 2014-08-16 19:58:19 +0200

mgass gravatar image

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()) ?

edit flag offensive delete link more


You're looking to use a trig identity to simplify your expression. Searching "trig identity" on the sagemath website gives [this page]( 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?

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-08-16 18:17:01 +0200

Seen: 1,056 times

Last updated: Aug 16 '14