Open In App

Python | Sympy Ellipse.equation() method

Improve
Improve
Like Article
Like
Save
Share
Report
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:




# import sympy, Point and Ellipse
from sympy import Point, Ellipse
from sympy.abc import x, y
  
# using Ellipse() 
e1 = Ellipse(Point(1, 0), 3, 2)
  
# using equation()
eq1 = e1.equation(x, y);
  
print(eq1)


Output:

y**2/4 + (x/3 - 1/3)**2 - 1

Example #2:




# import sympy, Point and Ellipse
from sympy import Point, Ellipse
from sympy.abc import x, y
  
# using Ellipse() 
e2 = Ellipse(Point(0, 0), 3, 2)
  
# using equation()
eq2 = e2.equation(x, y);
  
print(eq2)


Output:

x**2/9 + y**2/4 - 1

Last Updated : 30 Jan, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads