All,

I'd like SymPy to simplify some trig expressions (see below), but I'm 
stumped. What's the appropriate call (I assume to one of the functions 
in http://docs.sympy.org/0.7.2/modules/simplify/simplify.html)? I've tried 
several and can't seem to figure out the right approach.


from sympy import symbols, sin, cos

from sympy.simplify import *

s = symbols('s')

expr = sin(s)**2 + cos(s)**2

print('Original expression: %s' % expr)

print('Simplifies to: %s' % simplify(expr))

expr2 = (expr**2).expand()

print('Original squared: %s' % expr2)

print('Simplifies to: %s' % trigsimp(expr2))


The output:

Original expression: sin(s)**2 + cos(s)**2

Simplifies to: 1

Original squared: sin(s)**4 + 2*sin(s)**2*cos(s)**2 + cos(s)**4

Simplifies to: sin(s)**4 - cos(s)**4 + 2*cos(s)**2

I'd like the last line to read: "Simplifies to: 1"

Any ideas?

Thanks!

Bryan

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/sympy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to