# Python | Sympy Ellipse() method

In sympy, the function `Ellipse()` is used to create ellipse from a center and two radii, the first being the horizontal radius (along the x-axis) and the second being the vertical radius (along the y-axis).

Syntax: Ellipse()

Parameters:
center: Point
hradius: number or SymPy expression, optional
vradius: number or SymPy expression, optional
eccentricity: number or SymPy expression, optional

Error: Raises Geometry Error when hradius, vradius and eccentricity are incorrectly supplied as parameters and Type Error when center is not a Point.

Example #1: Using center and radii

 `# import sympy and geometry module  ` `from` `sympy.geometry ``import` `Point, Ellipse ` ` `  `# using Ellipse() ` `e1 ``=` `Ellipse(Point(``0``, ``0``), ``5``, ``1``) ` ` `  `print``(e1.hradius,e1.vradius) `

Output:

`(5,1)`

Example #2: Using center, hradius and eccentricity

 `# import sympy and geometry module  ` `from` `sympy.geometry ``import` `Point, Ellipse, Rational ` ` `  `# using Ellipse() ` `e2 ``=` `Ellipse(Point(``3``, ``1``), hradius``=``3``, eccentricity``=``Rational(``4``, ``5``)) ` ` `  `print``(e2) `

Output:

`Ellipse(Point2D(3, 1), 3, 9/5)`

Example #3: Using center, vradius and eccentricity

 `# import sympy and geometry module  ` `from` `sympy.geometry ``import` `Point, Ellipse, Rational ` ` `  `# using Ellipse() ` `e2 ``=` `Ellipse(Point(``3``, ``1``), vradius``=``3``, eccentricity``=``Rational(``4``, ``5``)) ` ` `  `print``(e2) `

Output:

`Ellipse(Point2D(3, 1), 5, 3)`

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

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.