John28
John28

Reputation: 773

Sympy simplify sine

I try to simplify the following equation

f = 1/(2*i) *(E**(i*x)-E**(-i*x))

So I wrote this code:

from sympy import *
from sympy.abc import x
init_printing(use_unicode=False, wrap_line=False, no_global=True)

f = 1/(2*I) *(E**(I*x)-E**(-I*x))

trigsimp(f)

I want to get the result as the sine-function, because

1/(2*I) *(E**(I*x)-E**(-I*x)) = sine(x)

Does anyone know, how to get the results simplified as sine, cos... -function?

Many thanks in advance!

John

Upvotes: 2

Views: 71

Answers (1)

smichr
smichr

Reputation: 19029

f.rewrite(sin) should do it. This is an example of the rewriting capabilities. Whenever you think something can be rewritten in terms of something else, try this method.

Upvotes: 3

Related Questions