Python | Sympy Ellipse.equation() method
Last Updated :
30 Jan, 2020
In sympy, the function
Ellipse.equation()
is used to make the equation of the given ellipse.
Syntax: Ellipse.equation(x='x', y='y', _slope=None)
Parameters:
x : Label for the x-axis. Default value is ‘x’.
y : Label for the y-axis. Default value is ‘y’.
_slope : The slope of the major axis. Ignored when ‘None’.
Returns: equation : sympy expression
Example #1:
from sympy import Point, Ellipse
from sympy.abc import x, y
e1 = Ellipse(Point( 1 , 0 ), 3 , 2 )
eq1 = e1.equation(x, y);
print (eq1)
|
Output:
y**2/4 + (x/3 - 1/3)**2 - 1
Example #2:
from sympy import Point, Ellipse
from sympy.abc import x, y
e2 = Ellipse(Point( 0 , 0 ), 3 , 2 )
eq2 = e2.equation(x, y);
print (eq2)
|
Output:
x**2/9 + y**2/4 - 1
Share your thoughts in the comments
Please Login to comment...