Ask Your Question
1

Another problem simplifying symbolic trigonometric expressions

asked 2018-01-11 10:40:29 +0100

ceiar gravatar image

I am testing Sage with the notebook interface, and I want to simplify this trigonometric symbolic expression:

var('x1','x2')
exp1=sin(x1)*cos(x2)+sin(x2)*cos(x1)
print(exp1.trig_simplify())

Sage does not simplify this expression and the result is:

cos(x2)*sin(x1) + cos(x1)*sin(x2)

As you can see the result show be:

sin(x1+x2)

Is there any to simplify trigonometric functions applied to the addition or the subtraction of two values? Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-01-11 14:10:48 +0100

eric_g gravatar image

updated 2018-01-11 14:15:11 +0100

You must use trig_reduce():

sage: exp1.trig_reduce()
sin(x1 + x2)

The reverse operation is trig_expand():

sage: exp2 = sin(x1 + x2)
sage: exp2.trig_expand()
cos(x2)*sin(x1) + cos(x1)*sin(x2)
edit flag offensive delete link more

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

Stats

Asked: 2018-01-11 10:40:29 +0100

Seen: 1,048 times

Last updated: Jan 11 '18