ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 15 Apr 2017 05:33:34 +0200recognize form sin(x)^2 + cos(x)^2 = 1https://ask.sagemath.org/question/23805/recognize-form-sinx2-cosx2-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.Sat, 16 Aug 2014 18:17:01 +0200https://ask.sagemath.org/question/23805/recognize-form-sinx2-cosx2-1/Answer by lh for <p>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.</p>
https://ask.sagemath.org/question/23805/recognize-form-sinx2-cosx2-1/?answer=37303#post-id-37303Actually, 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). Sat, 15 Apr 2017 05:33:34 +0200https://ask.sagemath.org/question/23805/recognize-form-sinx2-cosx2-1/?answer=37303#post-id-37303Answer by mgass for <p>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.</p>
https://ask.sagemath.org/question/23805/recognize-form-sinx2-cosx2-1/?answer=23807#post-id-23807 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()) ?
Sat, 16 Aug 2014 19:58:19 +0200https://ask.sagemath.org/question/23805/recognize-form-sinx2-cosx2-1/?answer=23807#post-id-23807Comment by dazedANDconfused for <p>Looks like trig_simplify() does the job:</p>
<p>f(t) = cos(t+1)^2 + sin(t+1)^2
f.trig_simplify()</p>
<p>t |--> 1</p>
<p>Where would I find this in the sage documentation if I did not know the name of the method (trig_simplify()) ?</p>
https://ask.sagemath.org/question/23805/recognize-form-sinx2-cosx2-1/?comment=23808#post-id-23808You'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?Sat, 16 Aug 2014 20:40:59 +0200https://ask.sagemath.org/question/23805/recognize-form-sinx2-cosx2-1/?comment=23808#post-id-23808