Python | Sympy Ellipse.equation() method

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output:

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

Example #2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output:

x**2/9 + y**2/4 - 1
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.