Python | sympy.expand_trig() method
Last Updated :
18 Jun, 2019
With the help of sympy.expand_trig(expn)
method, we are able to expand the trigonometric equations.
Syntax : sympy.expand_trig(expn)
Return : Return the expanded trigonometric expression.
Example #1 :
In this example we can see that by using sympy.expand_trig(expn)
method, we are able to find the expanded form of trigonometric function.
from sympy import *
x, y = symbols( 'x y' )
expn = sin( 2 * x) + cos( 2 * x)
gfg = expand_trig(expn)
print (gfg)
|
Output :
2*sin(x)*cos(x) + 2*cos(x)**2 – 1
Example #2 :
from sympy import *
x, y = symbols( 'x y' )
expn = sin( 2 * x) * * 2 + cos( 2 * x) * * 2
gfg = expand_trig(expn)
print (gfg)
|
Output :
(2*cos(x)**2 – 1)**2 + 4*sin(x)**2*cos(x)**2
Share your thoughts in the comments
Please Login to comment...