� ��gW�����dZddlmZddlmZddlmZmZmZddl m Z ddl m Z ddl mZddlmZmZdd lmZdd lmZmZmZdd lmZmZdd lmZmZdd lmZm Z ddl!m"Z"ddl#m$Z$m%Z%ddl&m'Z'ddl(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.ddl/m0Z0m1Z1m2Z2ddl3m4Z4m5Z5ddl6m7Z7m8Z8m9Z9ddl:m;Z;m<Z<ddl=m>Z>ddl?m@Z@ddlAmBZBmCZCddlDmEZEddlFZFd�eGd��D��\ZHZIGd�de%��ZJGd �d!eJ��ZKdd"lLmMZMmNZNdS)#z?Elliptical geometrical entities. Contains * Ellipse * Circle �)�Expr)�Eq)�S�pi�sympify)�N)�global_parameters)� fuzzy_bool)�Rational�oo)�ordered)�Dummy�uniquely_named_symbol�_symbol)�simplify�trigsimp)�sqrt�Max)�cos�sin)� elliptic_e�)�GeometryEntity� GeometrySet)� GeometryError)�Line�Segment�Ray2D� Segment2D�Line2D�LinearEntity3D)�Point�Point2D�Point3D)�idiff�find)� DomainError�Poly�PolynomialError)� _not_a_coeff�_nsort)�solve)� linear_coeffs)� filldedent� func_name)� prec_to_dpsNc�0�g|]}tdd�����S)� ellipse_dummyT��real)r��.0�is �f/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/geometry/ellipse.py� <listcomp>r9%s%��<�<�<�a��o�D�)�)�)�<�<�<��c���eZdZdZd�Zd�Z�fd�Z d0d�Zd1d �Ze d ���Z e d ���Z d2d �Z e d���Z e d���Ze d���Ze d���Ze d���Zd�Zd3d�Zd4d�Ze d���Ze d���Ze d���Zd�Zd�Ze d���Ze d���Zd5d�Ze d ���Ze d!���Zd"�Zd#�Z d2d$�Z!d5d%�Z"d&�Z#d6�fd(� Z$d7d*�Z%d+�Z&e d,���Z'd5d-�Z(d.�Z)d5d/�Z*�xZ+S)8�Ellipsea"An elliptical GeometryEntity. Parameters ========== center : Point, optional Default value is Point(0, 0) hradius : number or SymPy expression, optional vradius : number or SymPy expression, optional eccentricity : number or SymPy expression, optional Two of `hradius`, `vradius` and `eccentricity` must be supplied to create an Ellipse. The third is derived from the two supplied. Attributes ========== center hradius vradius area circumference eccentricity periapsis apoapsis focus_distance foci Raises ====== GeometryError When `hradius`, `vradius` and `eccentricity` are incorrectly supplied as parameters. TypeError When `center` is not a Point. See Also ======== Circle Notes ----- Constructed 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). When symbolic value for hradius and vradius are used, any calculation that refers to the foci or the major or minor axis will assume that the ellipse has its major radius on the x-axis. If this is not true then a manual rotation is necessary. Examples ======== >>> from sympy import Ellipse, Point, Rational >>> e1 = Ellipse(Point(0, 0), 5, 1) >>> e1.hradius, e1.vradius (5, 1) >>> e2 = Ellipse(Point(3, 1), hradius=3, eccentricity=Rational(4, 5)) >>> e2 Ellipse(Point2D(3, 1), 3, 9/5) c�L�t|t��rs|�tt���t|jt|ji��}t t|����tj uSt|t��r||kSdS)NF) � isinstancer"�equation�x�y�subsrrr�Zeror=)�self�o�ress r8� __contains__zEllipse.__contains__js~�� �a�� � � ��-�-��1�%�%�*�*�A�q�s�A�q�s�+;�<�<�C��H�S�M�M�*�*�a�f�4� 4� ��7� #� #� ��1�9� ��ur:c��t|t��o/|j|jko|j|jko|j|jkS)z5Is the other GeometryEntity the same as this ellipse?)r?r=�center�hradius�vradius�rErFs r8�__eq__zEllipse.__eq__rsJ���!�W�%�%�F�4�;�!�(�+B�,E�+/�<�1�9�+D�,E�+/�<�1�9�+D� Fr:c�D��t�����S�N)�super�__hash__)rE� __class__s �r8rRzEllipse.__hash__xs����w�w���!�!�!r:Nc ��t|��}t|��}|�tdd��}nFt|��dkr"td�|�����t|d���}tt t d�|||f������dkrttd�����|�Zt|��}|jrtd���|�|td|dzz ��z }n|�|td|dzz ��z}||krt||fi|��Stj ||fvrPtt|d|z |d|z ��t|d|z|d|z����S|jd us |jd urtd ���t!j||||fi|��S) Nrr;z2The center of "{}" must be a two dimensional point��dimc� �|duSrP�)rAs r8�<lambda>z!Ellipse.__new__.<locals>.<lambda>�s ��Q�d�]�r:zt Exactly two arguments of "hradius", "vradius", and "eccentricity" must not be None.z8Eccentricity of ellipse/circle should lie between [0, 1)rFz;Invalid value encountered when computing hradius / vradius.)rr"�len� ValueError�format�list�filterr.� is_negativerr�CirclerrDr�is_realr�__new__)�clsrJrKrL� eccentricity�kwargss r8rbzEllipse.__new__{s���'�"�"���'�"�"�� �>��1�a�[�[�F�F��6�{�{�a��� �!U�!\�!\�]`�!a�!a�b�b�b��6�q�)�)�)�F� �t�F�2�2�W�g�|�4T�U�U�V�V� W� W�[\� \� \��Z�)4�5�5�6�6� 6� � #�"�<�0�0�L��'� >�#�$^�_�_�_���!�D��\�1�_�)<�$=�$=�=�����!�D��\�1�_�)<�$=�$=�=�� �g� � ��&�'�4�4�V�4�4� 4� �6�g�w�'� '� '��5����W�!4�f�Q�i�'�6I�J�J�E�RX�YZ�R[�^e�Re�gm�no�gp�sz�gz�L{�L{�|�|� |� �?�e� #� #�w��%�'?�'?�� ]�^�^� ^��%�c�6�7�G�N�N�v�N�N�Nr:��?�#66cc99c���t|j��}t|j��t|j��}}d�d|z||j|j||��S)a%Returns SVG ellipse element for the Ellipse. Parameters ========== scale_factor : float Multiplication factor for the SVG stroke-width. Default is 1. fill_color : str, optional Hex string for fill color. Default is "#66cc99". zk<ellipse fill="{1}" stroke="#555555" stroke-width="{0}" opacity="0.6" cx="{2}" cy="{3}" rx="{4}" ry="{5}"/>g@)rrJrKrLr\rArB)rE� scale_factor� fill_color�c�h�vs r8�_svgz Ellipse._svg�sV�� �d�k�N�N��������$�,���1�� U� �&��l�"�J���Q�S�!�Q� ?� ?� @r:c��dS)Nr;rX�rEs r8�ambient_dimensionzEllipse.ambient_dimension�s���qr:c�&�|jd|jzzS)a�The apoapsis of the ellipse. The greatest distance between the focus and the contour. Returns ======= apoapsis : number See Also ======== periapsis : Returns shortest distance between foci and contour Examples ======== >>> from sympy import Point, Ellipse >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.apoapsis 2*sqrt(2) + 3 r��majorrdrps r8�apoapsiszEllipse.apoapsis����4�z�Q��!2�2�3�3r:�tc�D�t|d���}|jd�|jD��vr$tt d|jz�����t |jj|jt|��zz|jj |j t|��zz��S)aXA parameterized point on the ellipse. Parameters ========== parameter : str, optional Default value is 't'. Returns ======= arbitrary_point : Point Raises ====== ValueError When `parameter` already appears in the functions. See Also ======== sympy.geometry.point.Point Examples ======== >>> from sympy import Point, Ellipse >>> e1 = Ellipse(Point(0, 0), 3, 2) >>> e1.arbitrary_point() Point2D(3*cos(t), 2*sin(t)) Tr3c3�$K�|] }|jV�� dSrP)�name)r6�fs r8� <genexpr>z*Ellipse.arbitrary_point.<locals>.<genexpr>�s$����8�8��a�f�8�8�8�8�8�8r:zFSymbol %s already appears in object and cannot be used as a parameter.) rrz� free_symbolsr[r.r"rJrArKrrBrLr�rE� parameterrws r8�arbitrary_pointzEllipse.arbitrary_point�s���D �I�D� )� )� )�� �6�8�8�d�&7�8�8�8� 8� 8��Z�)M�OP�v�)V�W�W�X�X� X��T�[�]�T�\�#�a�&�&�%8�8��[�]�T�\�#�a�&�&�%8�8�:�:� :r:c�T�ttj|jz|jz��S)a The area of the ellipse. Returns ======= area : number Examples ======== >>> from sympy import Point, Ellipse >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.area 3*pi )rr�PirKrLrps r8�areaz Ellipse.area�s"��&���t�|�+�d�l�:�;�;�;r:c��|j|j}}|jj|z |jj|z |jj|z|jj|zfS)zwReturn a tuple (xmin, ymin, xmax, ymax) representing the bounding rectangle for the geometric figure. )rKrLrJrArB)rErlrms r8�boundszEllipse.boundssE���|�T�\�1��� � ��!�4�;�=�1�#4�d�k�m�a�6G����YZ�IZ�[�[r:c��|jdS)abThe center of the ellipse. Returns ======= center : number See Also ======== sympy.geometry.point.Point Examples ======== >>> from sympy import Point, Ellipse >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.center Point2D(0, 0) r��argsrps r8rJzEllipse.center���0�y��|�r:c��|jdkr d|jzS|jdkrdtz|jzSd|jzt |jdz��zS)z�The circumference of the ellipse. Examples ======== >>> from sympy import Point, Ellipse >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.circumference 12*elliptic_e(8/9) r�rr;)rdrtrrKrrps r8� circumferencezEllipse.circumference6s^�� � �� !� !��T�Z�<� � � �!� #� #��R�4�� �$� $��T�Z�<� �4�+<�a�+?� @� @�@� @r:c� �|j|jz S)a5The eccentricity of the ellipse. Returns ======= eccentricity : number Examples ======== >>> from sympy import Point, Ellipse, sqrt >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, sqrt(2)) >>> e1.eccentricity sqrt(7)/3 )�focus_distancertrps r8rdzEllipse.eccentricityMs��&�"�T�Z�/�/r:c���t�d�����|vrdSt|j��dkr'�fd�|jD��\}}d|jz||zz }n"|j|j����z }t|j��S)a� Return True if p is enclosed by (is inside of) self. Notes ----- Being on the border of self is considered False. Parameters ========== p : Point Returns ======= encloses_point : True, False or None See Also ======== sympy.geometry.point.Point Examples ======== >>> from sympy import Ellipse, S >>> from sympy.abc import t >>> e = Ellipse((0, 0), 3, 2) >>> e.encloses_point((0, 0)) True >>> e.encloses_point(e.arbitrary_point(t).subs(t, S.Half)) False >>> e.encloses_point((4, 0)) False r;rUFc�:��g|]}|������SrX)�distance)r6r{�ps �r8r9z*Ellipse.encloses_point.<locals>.<listcomp>�s#���7�7�7��a�j�j��m�m�7�7�7r:) r"rZ�focirt�radiusrJr�r � is_positive)rEr��h1�h2�tests ` r8�encloses_pointzEllipse.encloses_pointbs����J �!��O�O�O�� ��9�9��5� �t�y�>�>�Q� � � 8�7�7�7�T�Y�7�7�7�F�B���T�Z�<�2��7�+�D�D��;���!5�!5�a�!8�!8�8�D��$�*�+�+�+r:rArBc�V�t|d���}t|d���}||jjz }||jjz }|�F|||zz dz}||z|zdz}d|dzz}||jdzz} ||jdzz} || z || z zdz S||jz dz} ||jz dz} | | zdz S)a� Returns the equation of an ellipse aligned with the x and y axes; when slope is given, the equation returned corresponds to an ellipse with a major axis having that slope. Parameters ========== x : str, optional Label for the x-axis. Default value is 'x'. y : str, optional Label for the y-axis. Default value is 'y'. _slope : Expr, optional The slope of the major axis. Ignored when 'None'. Returns ======= equation : SymPy expression See Also ======== arbitrary_point : Returns parameterized point on ellipse Examples ======== >>> from sympy import Point, Ellipse, pi >>> from sympy.abc import x, y >>> e1 = Ellipse(Point(1, 0), 3, 2) >>> eq1 = e1.equation(x, y); eq1 y**2/4 + (x/3 - 1/3)**2 - 1 >>> eq2 = e1.equation(x, y, _slope=1); eq2 (-x + y + 1)**2/8 + (x + y - 1)**2/18 - 1 A point on e1 satisfies eq1. Let's use one on the x-axis: >>> p1 = e1.center + Point(e1.major, 0) >>> assert eq1.subs(x, p1.x).subs(y, p1.y) == 0 When rotated the same as the rotated ellipse, about the center point of the ellipse, it will satisfy the rotated ellipse's equation, too: >>> r1 = p1.rotate(pi/4, e1.center) >>> assert eq2.subs(x, r1.x).subs(y, r1.y) == 0 References ========== .. [1] https://math.stackexchange.com/questions/108270/what-is-the-equation-of-an-ellipse-that-is-not-aligned-with-the-axis .. [2] https://en.wikipedia.org/wiki/Ellipse#Shifted_ellipse Tr3Nr;r)rrJrArBrt�minorrKrL) rErArB�_slope�dx�dy�L�lrl�b�a�t1�t2s r8r@zEllipse.equation�s���r �A�D� !� !� !�� �A�D� !� !� !�� ���� �� ���� �� � ��f�R�i��!�#�A����R��!�#�A��F�A�I� �A��$�*�a�-��A��$�*�a�-��A��Q�3��1��9�q�=� ��T�\�/�A�%�B��T�\�/�A�%�B���7�Q�;� r:c��t|j��dkrtd���t|d���}t|d���}|j||jjz ztdd��z}|j||jj z ztdd��z}||z|jdz|jdzz tdd��zz S)aThe equation of evolute of the ellipse. Parameters ========== x : str, optional Label for the x-axis. Default value is 'x'. y : str, optional Label for the y-axis. Default value is 'y'. Returns ======= equation : SymPy expression Examples ======== >>> from sympy import Point, Ellipse >>> e1 = Ellipse(Point(1, 0), 3, 2) >>> e1.evolute() 2**(2/3)*y**(2/3) + (3*x - 3)**(2/3) - 5**(2/3) �z.Evolute of arbitrary Ellipse is not supported.Tr3r;) rZr��NotImplementedErrorrrKrJrAr rLrB�rErArBr�r�s r8�evolutezEllipse.evolute�s���0 �t�y�>�>�Q� � �%�&V�W�W� W� �A�D� !� !� !�� �A�D� !� !� !���l�A�� � �-�.��!�Q��� ?���l�A�� � �-�.��!�Q��� ?���B�w�$�,��/�D�L�!�O�;�h�q�!�n�n�L�L�Lr:c�P�|j}|j|j}}||kr||fSt|jdz|jdzz ��}||jkr'|t d| ��z|t d|��zfS||jkr'|t | d��z|t |d��zfSdS)ahThe foci of the ellipse. Notes ----- The foci can only be calculated if the major/minor axes are known. Raises ====== ValueError When the major and minor axis cannot be determined. See Also ======== sympy.geometry.point.Point focus_distance : Returns the distance between focus and center Examples ======== >>> from sympy import Point, Ellipse >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.foci (Point2D(-2*sqrt(2), 0), Point2D(2*sqrt(2), 0)) r;rN)rJrKrLrrtr�r")rErk�hr�vr�fds r8r�z Ellipse.focis���< �K����t�|�B�� ��8�8��q�6�M��$�*�a�-�$�*�a�-�/� 0� 0�� ��� � ���a�"�� � �%�q�5��B�<�<�'7�8� 8� �4�:� � ���r�c�1� � �%�q�5��Q�<�<�'7�8� 8�� r:c�L�tj|j|jd��S)a�The focal distance of the ellipse. The distance between the center and one focus. Returns ======= focus_distance : number See Also ======== foci Examples ======== >>> from sympy import Point, Ellipse >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.focus_distance 2*sqrt(2) r)r"r�rJr�rps r8r�zEllipse.focus_distance0s��4�~�d�k�4�9�Q�<�8�8�8r:c��|jdS)a^The horizontal radius of the ellipse. Returns ======= hradius : number See Also ======== vradius, major, minor Examples ======== >>> from sympy import Point, Ellipse >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.hradius 3 rr�rps r8rKzEllipse.hradiusLr�r:c � ��t�t��r �|vr�gSgSt�ttf��r�|�t t ��}t|t�j d�j d���t t ��gt t gd���d}tt�fd�|D������St�t��r�� |��St�ttf��r��|kr|S|�t t ��}ttd�t|��t t ��gt t gd���dD������St�t ��rt#d���t#dt%���z���) aCThe intersection of this ellipse and another geometrical entity `o`. Parameters ========== o : GeometryEntity Returns ======= intersection : list of GeometryEntity objects Notes ----- Currently supports intersections with Point, Line, Segment, Ray, Circle and Ellipse types. See Also ======== sympy.geometry.entity.GeometryEntity Examples ======== >>> from sympy import Ellipse, Point, Line >>> e = Ellipse(Point(0, 0), 5, 7) >>> e.intersection(Point(0, 0)) [] >>> e.intersection(Point(5, 0)) [Point2D(5, 0)] >>> e.intersection(Line(Point(0,0), Point(0, 1))) [Point2D(0, -7), Point2D(0, 7)] >>> e.intersection(Line(Point(5,0), Point(5, 1))) [Point2D(5, 0)] >>> e.intersection(Line(Point(6,0), Point(6, 1))) [] >>> e = Ellipse(Point(-1, 0), 4, 3) >>> e.intersection(Ellipse(Point(1, 0), 4, 3)) [Point2D(0, -3*sqrt(15)/4), Point2D(0, 3*sqrt(15)/4)] >>> e.intersection(Ellipse(Point(5, 0), 4, 3)) [Point2D(2, -3*sqrt(7)/4), Point2D(2, 3*sqrt(7)/4)] >>> e.intersection(Ellipse(Point(100500, 0), 4, 3)) [] >>> e.intersection(Ellipse(Point(0, 0), 3, 4)) [Point2D(3, 0), Point2D(-363/175, -48*sqrt(111)/175), Point2D(-363/175, 48*sqrt(111)/175)] >>> e.intersection(Ellipse(Point(-1, 0), 3, 4)) [Point2D(-17/5, -12/5), Point2D(-17/5, 12/5), Point2D(7/5, -12/5), Point2D(7/5, 12/5)] rrT)�setc�6��g|]}|�v�t|����SrX�r")r6r7rFs �r8r9z(Ellipse.intersection.<locals>.<listcomp>�s$��� D� D� D�a�Q�!�V�V��q���V�V�Vr:c�,�g|]}t|����SrXr�r5s r8r9z(Ellipse.intersection.<locals>.<listcomp>�s*��%"�%"�%"�!�U�1�X�X�%"�%"�%"r:�5Entity must be two dimensional, not three dimensionalzIntersection not handled for %s)r?r"rrr@rArBr,r�pointsr]r �Polygon� intersectionr=r r!� TypeErrorr/)rErF�ellipse_equation�results ` r8r�zEllipse.intersectionfs����j �a�� � � N��D�y�y��s� �� � ��I�u�-� .� .� N�#�}�}�Q��2�2� ��,�d���� �Q�X�a�[�/*�/*�*2�(�1�a�.�.�:�<=�q�6�������F��� D� D� D� D�6� D� D� D�E�E�F�F� F� ��7� #� #� N��>�>�$�'�'� '� ��G�V�,� -� -� N��D�y�y�� �#'�=�=��A�#6�#6� ��G�%"�%"�u�%�q�z�z�!�Q�'7�'7�8�1�a�&��8�8�8��8!�%"�%"�%"�#�#�$�$�$���>� *� *� N��S�T�T� T��=� �!� � �L�M�M� Mr:c����t�t��rdSt�t��rL�����}t|t��rdS|rt ��fd�|D����SdSt�t ��rO�����}|sdSt |��dkrdS|d�|d��St�ttf��rM�����}t |��dkr#��� |d��dvSdSt�t��r t �fd��j D����St�ttf��rtd���tdt!���z���) a�Is `o` tangent to the ellipse? Parameters ========== o : GeometryEntity An Ellipse, LinearEntity or Polygon Raises ====== NotImplementedError When the wrong type of argument is supplied. Returns ======= is_tangent: boolean True if o is tangent to the ellipse, False otherwise. See Also ======== tangent_lines Examples ======== >>> from sympy import Point, Ellipse, Line >>> p0, p1, p2 = Point(0, 0), Point(3, 0), Point(3, 3) >>> e1 = Ellipse(p0, 3, 2) >>> l1 = Line(p1, p2) >>> e1.is_tangent(l1) True FTc3��K�|]K}��|��d���|��d��V��LdS�rN)� tangent_lines�equals)r6r7rFrEs ��r8r|z%Ellipse.is_tangent.<locals>.<genexpr>�sW�����g�g�XY�D�.�.�q�1�1�!�4�<�<�Q�_�_�Q�=O�=O�PQ�=R�S�S�g�g�g�g�g�gr:rrc3�B�K�|]}��|��V��dSrP)� is_tangent)r6�srEs �r8r|z%Ellipse.is_tangent.<locals>.<genexpr>�s/�����;�;�a�t���q�)�)�;�;�;�;�;�;r:r�zIs_tangent not handled for %s)r?r#r=r��allr rZr�rrr�r��sidesr!r$r�r/)rErF� intersect�hits`` r8r�zEllipse.is_tangent�s�����J �a�� !� !� L��5� ��7� #� #� L��)�)�!�,�,�I��)�W�-�-� ��t�� ��g�g�g�g�g�]f�g�g�g�g�g�g��u� ��6� "� "� L��#�#�A�&�&�C�� ��u��3�x�x�1�}�}��t��q�6�=�=��Q��(�(� (� ��I�u�-� .� .� L��)�)�!�,�,�I��9�~�~��"�"��D�.�.�y��|�<�<�Q�?�?�?��u� ��7� #� #� L��;�;�;�;�1�7�;�;�;�;�;� ;� ��N�G�4� 5� 5� L��S�T�T� T��;�i��l�l�J�K�K� Kr:c��|jdd�}t|��dkr|dS|\}}||z dk}|dkr|S|dkr|S|jS)a�Longer axis of the ellipse (if it can be determined) else hradius. Returns ======= major : number or expression See Also ======== hradius, vradius, minor Examples ======== >>> from sympy import Point, Ellipse, Symbol >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.major 3 >>> a = Symbol('a') >>> b = Symbol('b') >>> Ellipse(p1, a, b).major a >>> Ellipse(p1, b, a).major b >>> m = Symbol('m') >>> M = m + 1 >>> Ellipse(p1, m, M).major m + 1 rr�rTF)r�rZrK�rE�abr�r�rFs r8rtz Ellipse.major��f��H�Y�q��s�^�� �r�7�7�a�<�<��a�5�L����1� ��E�A�I�� ��9�9��H� �%�Z�Z��H��|�r:c��|jdd�}t|��dkr|dS|\}}||z dk}|dkr|S|dkr|S|jS)a�Shorter axis of the ellipse (if it can be determined) else vradius. Returns ======= minor : number or expression See Also ======== hradius, vradius, major Examples ======== >>> from sympy import Point, Ellipse, Symbol >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.minor 1 >>> a = Symbol('a') >>> b = Symbol('b') >>> Ellipse(p1, a, b).minor b >>> Ellipse(p1, b, a).minor a >>> m = Symbol('m') >>> M = m + 1 >>> Ellipse(p1, m, M).minor m rr�rTF)r�rZrLr�s r8r�z Ellipse.minor+r�r:c��� � �t|d���} g}|j|jjkr.|�t |jt �����|j|jjkr)|�t |jd�����|r|S|�tt ��� t� t t��}d|z � t |tt f��j }|� z }t|t ��d}� � t |��� ��d� ��}t|j��dkr t!|t�����} nG#t$t&t(f$r-t+t|t��d���d} YnwxYw� fd �| D��} nt)d ���� fd �| D��} ���fd �| D��} �fd�| D��} d�t-| | ��D��S)aANormal lines between `p` and the ellipse. Parameters ========== p : Point Returns ======= normal_lines : list with 1, 2 or 4 Lines Examples ======== >>> from sympy import Point, Ellipse >>> e = Ellipse((0, 0), 2, 3) >>> c = e.center >>> e.normal_lines(c + Point(1, 0)) [Line2D(Point2D(0, 0), Point2D(1, 0))] >>> e.normal_lines(c) [Line2D(Point2D(0, 0), Point2D(0, 1)), Line2D(Point2D(0, 0), Point2D(1, 0))] Off-axis points require the solution of a quartic equation. This often leads to very large expressions that may be of little practical use. An approximate solution of `prec` digits can be obtained by passing in the desired value: >>> e.normal_lines((3, 3), prec=2) [Line2D(Point2D(-0.81, -2.7), Point2D(0.19, -1.2)), Line2D(Point2D(1.5, -2.0), Point2D(2.5, -2.7))] Whereas the above solution has an operation count of 12, the exact solution has an operation count of 2020. r;rUT��sloper�����r)� separatedc ���g|]D}t|t��t|��t��d����ES)r)r"r,rCrArB)r6r7�eqs �r8r9z(Ellipse.normal_lines.<locals>.<listcomp>�s>���I�I�I�q�e�A�u�R�W�W�Q��]�]�A�6�6�q�9�:�:�I�I�Ir:z7intersections for the general ellipse are not supportedc�x��g|]6}��tttf|j������7SrX)rC�ziprArBr�)r6�pt�norms �r8r9z(Ellipse.normal_lines.<locals>.<listcomp>�s5���C�C�C�b�$�)�)�C��A����0�0�1�1�C�C�Cr:Nc�:��g|]}|������SrX)�n)r6r��precs �r8r9z(Ellipse.normal_lines.<locals>.<listcomp>�s#���2�2�2�R�b�d�d�4�j�j�2�2�2r:c�\��g|](}t|��r|n|������)SrX)r*r�)r6r7r�s �r8r9z(Ellipse.normal_lines.<locals>.<listcomp>�s2���J�J�J�a�<��?�?�9�a�a����D� � �J�J�Jr:c�6�g|]\}}t||�����S)r�)r)r6r�r�s r8r9z(Ellipse.normal_lines.<locals>.<listcomp>�s)��C�C�C�e�b�!��R�q�!�!�!�C�C�Cr:)r"rArJ�appendrr rBr@r%r�r,rC�as_numer_denom�expandrZr}r(� real_rootsr'r)r�r+r�)rEr�r��rv�dydxr��seq�yis�xeq�xsolr��slopesr�r�s ` @@r8� normal_lineszEllipse.normal_linesZsF�����H �!��O�O�O�� ��B��s�d�k�m�#�#�� � �$�t�{�"�5�5�5�6�6�6��s�d�k�m�#�#�� � �$�t�{�!�4�4�4�5�5�5�� �� ��]�]�1�a� � ���R��A�����$�w���Q��A����%���d�l���C��m�m�A����g�g�a��o�o�,�,�.�.�q�1�8�8�:�:�� �s�� � �A� %� %� @��C��|�|�.�.�0�0������2E�F� @� @� @��e�C��m�m�t�<�<�<�Q�?���� @����J�I�I�I�D�I�I�I�F�F�%�I�K�K� K�C�C�C�C�F�C�C�C�� � �2�2�2�2�6�2�2�2�F�J�J�J�J�6�J�J�J�F�C�C�s�6�6�/B�/B�C�C�C�Cs�<'F$�$AG(�'G(c�&�|jd|jz zS)a�The periapsis of the ellipse. The shortest distance between the focus and the contour. Returns ======= periapsis : number See Also ======== apoapsis : Returns greatest distance between focus and contour Examples ======== >>> from sympy import Point, Ellipse >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.periapsis 3 - 2*sqrt(2) rrsrps r8� periapsiszEllipse.periapsis�rvr:c�,�|jd|jdzz zS)a@ Calculates the semi-latus rectum of the Ellipse. Semi-latus rectum is defined as one half of the chord through a focus parallel to the conic section directrix of a conic section. Returns ======= semilatus_rectum : number See Also ======== apoapsis : Returns greatest distance between focus and contour periapsis : The shortest distance between the focus and the contour Examples ======== >>> from sympy import Point, Ellipse >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.semilatus_rectum 1/3 References ========== .. [1] https://mathworld.wolfram.com/SemilatusRectum.html .. [2] https://en.wikipedia.org/wiki/Ellipse#Semi-latus_rectum rr;rsrps r8�semilatus_rectumzEllipse.semilatus_rectum�s��H�z�Q��!2�a�!7�7�8�8r:c�\�t|jt|j|j����S)a�Returns a Circle whose diameter is the major axis of the ellipse. Examples ======== >>> from sympy import Ellipse, Point, symbols >>> c = Point(1, 2) >>> Ellipse(c, 8, 7).auxiliary_circle() Circle(Point2D(1, 2), 8) >>> a, b = symbols('a b') >>> Ellipse(c, a, b).auxiliary_circle() Circle(Point2D(1, 2), Max(a, b)) )r`rJrrKrLrps r8�auxiliary_circlezEllipse.auxiliary_circle�s$���d�k�3�t�|�T�\�#B�#B�C�C�Cr:c�l�t|jt|jdz|jdzz����S)a� Returns a Circle consisting of all points where two perpendicular tangent lines to the ellipse cross each other. Returns ======= Circle A director circle returned as a geometric object. Examples ======== >>> from sympy import Ellipse, Point, symbols >>> c = Point(3,8) >>> Ellipse(c, 7, 9).director_circle() Circle(Point2D(3, 8), sqrt(130)) >>> a, b = symbols('a b') >>> Ellipse(c, a, b).director_circle() Circle(Point2D(3, 8), sqrt(a**2 + b**2)) References ========== .. [1] https://en.wikipedia.org/wiki/Director_circle r;)r`rJrrKrLrps r8�director_circlezEllipse.director_circle�s/��8�d�k�4�� �a��$�,��/�(I�#J�#J�K�K�Kr:c�X�t|d���}|tj tjgS)a�The plot interval for the default geometric plot of the Ellipse. Parameters ========== parameter : str, optional Default value is 't'. Returns ======= plot_interval : list [parameter, lower_bound, upper_bound] Examples ======== >>> from sympy import Point, Ellipse >>> e1 = Ellipse(Point(0, 0), 3, 2) >>> e1.plot_interval() [t, -pi, pi] Tr3)rrr�r~s r8� plot_intervalzEllipse.plot_intervals)��0 �I�D� )� )� )���A�D�5�!�$��r:c��tdd���}|�|��j\}}|�tj|��}nt}t |�����}d|zdz }t d|dzz ��}t|�t|��|��|�t|��|����S)aPA random point on the ellipse. Returns ======= point : Point Examples ======== >>> from sympy import Point, Ellipse >>> e1 = Ellipse(Point(0, 0), 3, 2) >>> e1.random_point() # gives some random point Point2D(...) >>> p1 = e1.random_point(seed=0); p1.n(2) Point2D(2.1, 1.4) Notes ===== When creating a random point, one may simply replace the parameter with a random number. When doing so, however, the random number should be made a Rational or else the point may not test as being in the ellipse: >>> from sympy.abc import t >>> from sympy import Rational >>> arb = e1.arbitrary_point(t); arb Point2D(3*cos(t), 2*sin(t)) >>> arb.subs(t, .1) in e1 False >>> arb.subs(t, Rational(.1)) in e1 True >>> arb.subs(t, Rational('.1')) in e1 True See Also ======== sympy.geometry.point.Point arbitrary_point : Returns parameterized point on ellipse rwTr3Nr;r) rr�r��random�Randomr rr"rCrr) rE�seedrwrArB�rng�rrkr�s r8� random_pointzEllipse.random_point5s���T �C�d� #� #� #���#�#�A�&�&�+���1� � ��-��%�%�C�C��C� �S�Z�Z�\�\� "� "�� �a�C�!�G�� ��Q��T��N�N���Q�V�V�C��F�F�A�&�&����s�1�v�v�q�(9�(9�:�:�:r:c �.����jdtfvr>�j}|����}��|�j �j��S��fd�dD��\}}��||��}t||������}|� t||f|j ��d���}ttddt|���dt|���d t|����z�����) a�Override GeometryEntity.reflect since the radius is not a GeometryEntity. Examples ======== >>> from sympy import Circle, Line >>> Circle((0, 1), 1).reflect(Line((0, 0), (1, 1))) Circle(Point2D(1, 0), -1) >>> from sympy import Ellipse, Line, Point >>> Ellipse(Point(3, 4), 1, 3).reflect(Line(Point(0, -4), Point(5, 0))) Traceback (most recent call last): ... NotImplementedError: General Ellipse is not supported but the equation of the reflected Ellipse is given by the zeros of: f(x, y) = (9*x/41 + 40*y/41 + 37/41)**2 + (40*x/123 - 3*y/41 - 364/123)**2 - 1 Notes ===== Until the general ellipse (with no axis parallel to the x-axis) is supported a NotImplemented error is raised and the equation whose zeros define the rotated ellipse is given. rc�<��g|]}t|��fd�d�����S)c� �d|zS)N�_rX)r�s r8rYz,Ellipse.reflect.<locals>.<listcomp>.<lambda>�s ��S�1�W�r:T)�modifyr4)r)r6rz�linerEs ��r8r9z#Ellipse.reflect.<locals>.<listcomp>�sL���"�"�"��*��t�T�l�+<�+<�4�I�I�I�"�"�"r:�xyT)� simultaneouszeGeneral Ellipse is not supported but the equation of the reflected Ellipse is given by the zeros of: zf(z, z) = )r�r rJ�reflect�funcrKrLr@r"rCr�r�r�r.�str)rEr�rkrArB�exprr�r�s`` r8rzEllipse.reflectms6����8 �:�!�R�� � �� �A�� � �$���A��9�9�Q��� �t�|�<�<� <�"�"�"�"�"� �"�"�"�D�A�q��=�=��A�&�&�D��a�� � �#�#�D�)�)�A��Y�Y�s�A�q�6�1�6� %� %�37��9�9�F�%�j�F�F�$'��F�F�F�F�C��F�F�F�F�C��K�K�K�@�A�'B�'B�C�C� Cr:rc���|j|jkr4|�|j�||��|j��S|t jz jr"t���||��Sd|zt jz jr:|�|j�||��|j|j��Std���)a�Rotate ``angle`` radians counterclockwise about Point ``pt``. Note: since the general ellipse is not supported, only rotations that are integer multiples of pi/2 are allowed. Examples ======== >>> from sympy import Ellipse, pi >>> Ellipse((1, 0), 2, 1).rotate(pi/2) Ellipse(Point2D(0, 1), 1, 2) >>> Ellipse((1, 0), 2, 1).rotate(pi) Ellipse(Point2D(-1, 0), 2, 1) r;z;Only rotations of pi/2 are currently supported for Ellipse.) rKrLrrJ�rotaterr�� is_integerrQr�)rE�angler�rSs �r8rzEllipse.rotate�s���� �<�4�<� '� '��9�9�T�[�/�/��r�:�:�D�L�I�I� I� �!�$�J� "� -��7�7�>�>�%��,�,� ,� �e�G�A�D�L� $� X��9�9�T�[�/�/��r�:�:�D�L�$�,�W�W� W�!�"_�`�`�`r:rc��|j}|rBt|d���}|j| j��||��j|j�S|j}|j}|�|�||��||z||z���S)atOverride GeometryEntity.scale since it is the major and minor axes which must be scaled and they are not GeometryEntities. Examples ======== >>> from sympy import Ellipse >>> Ellipse((0, 0), 2, 1).scale(2, 4) Circle(Point2D(0, 0), 4) >>> Ellipse((0, 0), 2, 1).scale(2) Ellipse(Point2D(0, 0), 4, 1) r;rU�rKrL)rJr"� translater��scalerKrLr�rErArBr�rkrlrms r8r z Ellipse.scale�s��� �K�� � O��r�q�!�!�!�B�D�>�4�>�R�C�:�.�4�4�Q��:�:�D�b�g�N� N� �L�� �L���y�y�����A����!��Q�q�S�y�A�A�Ar:c �F�t|d���}|�|��rgS||vrz|j|z }|jdz|jz}|jdz |jz}tt|j|z��t|j|z����}t||��gSt|j ��dkrC|j \}}|j}d|ztj ||��z tj ||��z } n"|j tj |j|��z } | j r | jrgS|�tt ��} t!| t t��} t|ttt ����j} t%| | z | gtt g��} t| ��dkr�| dd|jks| dd|jkrBt||tdd��z��t||tdd��z��gSt||tdd��z��t|| d��gSt|| d��t|| d��gS)a`Tangent lines between `p` and the ellipse. If `p` is on the ellipse, returns the tangent line through point `p`. Otherwise, returns the tangent line(s) from `p` to the ellipse, or None if no tangent line is possible (e.g., `p` inside ellipse). Parameters ========== p : Point Returns ======= tangent_lines : list with 1 or 2 Lines Raises ====== NotImplementedError Can only find tangent lines for a point, `p`, on the ellipse. See Also ======== sympy.geometry.point.Point, sympy.geometry.line.Line Examples ======== >>> from sympy import Point, Ellipse >>> e1 = Ellipse(Point(0, 0), 3, 2) >>> e1.tangent_lines(Point(3, 0)) [Line2D(Point2D(3, 0), Point2D(3, -12))] r;rUrr)r"r�rJrLrArKrBrrrZr�r�r�� is_numberr�r@r%r�r,)rEr��delta�rise�run�p2�f1�f2�majr�r�r�r��tangent_pointss r8r�zEllipse.tangent_lines�sp��J �!��O�O�O�� � � �q� !� !� ��I� ��9�9��K�!�O�E��L�!�O�U�W�,�D��L�!�O�$�U�W�,�C��x���c� �*�*����d� �+�+�-�-�B���B�K�K�=� ��4�9�~�~��"�"�����B��l���#����r�1�-�-�.���r�1�-�-�.����{�U�^�D�K��%C�%C�C���~� �$�"2� �� ����q�!�$�$�B���Q��?�?�D���E�!�Q�K�K�(�(�.�E�#�E�D�L�"�#5��1�v�>�>�N��>�"�"�a�'�'�!�!�$���!"��%�%�(6�q�(9�!�(<���(C�(C� ��A��a�� � �O�4�4�d�1�a�%��1�+�+�o�6N�6N�O�O� ��A��a�� � �O�4�4�d�1�n�Q�>O�6P�6P�Q�Q���N�1�-�.�.��Q��q�8I�0J�0J�K� Kr:c��|jdS)a\The vertical radius of the ellipse. Returns ======= vradius : number See Also ======== hradius, major, minor Examples ======== >>> from sympy import Point, Ellipse >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.vradius 1 r;r�rps r8rLzEllipse.vradiusr�r:c��tj|jz|jdzzdz }tj|jdzz|jzdz }d}|�|||fS||j|d|jjz dzzz}||j|d|jjz dzzz}||j|d|jjz z|d|jjz zz}|||fS)a�Returns the second moment and product moment area of an ellipse. Parameters ========== point : Point, two-tuple of sympifiable objects, or None(default=None) point is the point about which second moment of area is to be found. If "point=None" it will be calculated about the axis passing through the centroid of the ellipse. Returns ======= I_xx, I_yy, I_xy : number or SymPy expression I_xx, I_yy are second moment of area of an ellise. I_xy is product moment of area of an ellipse. Examples ======== >>> from sympy import Point, Ellipse >>> p1 = Point(0, 0) >>> e1 = Ellipse(p1, 3, 1) >>> e1.second_moment_of_area() (3*pi/4, 27*pi/4, 0) References ========== .. [1] https://en.wikipedia.org/wiki/List_of_second_moments_of_area r�r�rNrr;)rr�rKrLr�rJrBrA)rE�point�I_xx�I_yy�I_xys r8�second_moment_of_areazEllipse.second_moment_of_area2s���D��d�l�#�T�\�1�_�5�q�8����d�l�A�o�&�� �5�q�8���� �=���t�#� #��d�i�%��(�T�[�]�":�Q�!>�?�?���d�i�%��(�T�[�]�":�Q�!>�?�?���d�i��q��D�K�M�!9�:�E�!�H�t�{�}�<T�U�U���T�4��r:c�L�|���}|d|dzS)aReturns the polar second moment of area of an Ellipse It is a constituent of the second moment of area, linked through the perpendicular axis theorem. While the planar second moment of area describes an object's resistance to deflection (bending) when subjected to a force applied to a plane parallel to the central axis, the polar second moment of area describes an object's resistance to deflection when subjected to a moment applied in a plane perpendicular to the object's central axis (i.e. parallel to the cross-section) Examples ======== >>> from sympy import symbols, Circle, Ellipse >>> c = Circle((5, 5), 4) >>> c.polar_second_moment_of_area() 128*pi >>> a, b = symbols('a, b') >>> e = Ellipse((0, 0), a, b) >>> e.polar_second_moment_of_area() pi*a**3*b/4 + pi*a*b**3/4 References ========== .. [1] https://en.wikipedia.org/wiki/Polar_moment_of_inertia rr)r)rE� second_moments r8�polar_second_moment_of_areaz#Ellipse.polar_second_moment_of_areacs*��<�2�2�4�4� ��Q��-��"2�2�2r:c�.�|j\}}|�9|j\}}}}t||z ||z ��}t||z ||z ��} n#t|��}|j|z }|j|z } |���} | d|z } | d| z } | | fS)a�Returns a tuple with the section modulus of an ellipse Section modulus is a geometric property of an ellipse defined as the ratio of second moment of area to the distance of the extreme end of the ellipse from the centroidal axis. Parameters ========== point : Point, two-tuple of sympifyable objects, or None(default=None) point is the point at which section modulus is to be found. If "point=None" section modulus will be calculated for the point farthest from the centroidal axis of the ellipse. Returns ======= S_x, S_y: numbers or SymPy expressions S_x is the section modulus with respect to the x-axis S_y is the section modulus with respect to the y-axis A negative sign indicates that the section modulus is determined for a point below the centroidal axis. Examples ======== >>> from sympy import Symbol, Ellipse, Circle, Point2D >>> d = Symbol('d', positive=True) >>> c = Circle((0, 0), d/2) >>> c.section_modulus() (pi*d**3/32, pi*d**3/32) >>> e = Ellipse(Point2D(0, 0), 2, 4) >>> e.section_modulus() (8*pi, 4*pi) >>> e.section_modulus((2, 2)) (16*pi, 4*pi) References ========== .. [1] https://en.wikipedia.org/wiki/Section_modulus Nrr)rJr��maxr#rBrAr) rEr�x_c�y_c�x_min�y_min�x_max�y_maxrBrAr!�S_x�S_ys r8�section_moduluszEllipse.section_modulus�s���X�;���S� �=�)-�� &�E�5�%���C�%�K����-�-�A��C�%�K����-�-�A�A��E�N�N�E���#� �A���#� �A��2�2�4�4� ��A��q� ���A��q� ���C�x�r:)NNNN)rfrg)rw)rArBN�rArBrPr��rrN),�__name__� __module__� __qualname__�__doc__rHrNrRrbrn�propertyrqrur�r�r�rJr�rdr�r@r�r�r�rKr�r�rtr�r�r�r�r�r�r�r�rrr r�rLrr"r-� __classcell__)rSs@r8r=r=(s��������?�?�B���F�F�F� "�"�"�"�"�DH�$O�$O�$O�$O�L@�@�@�@�&����X���4�4��X�4�6':�':�':�':�R�<�<��X�<�(�\�\��X�\�����X��2�A�A��X�A�,�0�0��X�0�(3,�3,�3,�jJ�J�J�J�XM�M�M�M�@�*9�*9��X�*9�X�9�9��X�9�6����X��2PN�PN�PN�dBL�BL�BL�H�,�,��X�,�\�,�,��X�,�\ND�ND�ND�ND�`�4�4��X�4�6�#9�#9��X�#9�JD�D�D� L�L�L�< � � � �66;�6;�6;�6;�p+C�+C�+C�Za�a�a�a�a�a�0B�B�B�B�*NL�NL�NL�`����X��4. �. �. �. �b3�3�3�D<�<�<�<�<�<�<�<r:r=c�~�eZdZdZd�Zdd�Zed���Zdd�Zd �Z ed ���Z d �Z dd�Z ed���Z d S)r`a�A circle in space. Constructed simply from a center and a radius, from three non-collinear points, or the equation of a circle. Parameters ========== center : Point radius : number or SymPy expression points : sequence of three Points equation : equation of a circle Attributes ========== radius (synonymous with hradius, vradius, major and minor) circumference equation Raises ====== GeometryError When the given equation is not that of a circle. When trying to construct circle from incorrect parameters. See Also ======== Ellipse, sympy.geometry.point.Point Examples ======== >>> from sympy import Point, Circle, Eq >>> from sympy.abc import x, y, a, b A circle constructed from a center and radius: >>> c1 = Circle(Point(0, 0), 5) >>> c1.hradius, c1.vradius, c1.radius (5, 5, 5) A circle constructed from three points: >>> c2 = Circle(Point(0, 0), Point(1, 1), Point(1, 0)) >>> c2.hradius, c2.vradius, c2.radius, c2.center (sqrt(2)/2, sqrt(2)/2, sqrt(2)/2, Point2D(1/2, 1/2)) A circle can be constructed from an equation in the form `a*x**2 + by**2 + gx + hy + c = 0`, too: >>> Circle(x**2 + y**2 - 25) Circle(Point2D(0, 0), 5) If the variables corresponding to x and y are named something else, their name or symbol can be supplied: >>> Circle(Eq(a**2 + b**2, 25), x='a', y=b) Circle(Point2D(0, 0), 5) c����|�dtj���t|��dk�rTt |dt t f���r1|�dd��}|�dd��}|d���}t |t ��r|j|j z }t||��}t||��} t||dz|dz||��\}}}} } n#t$rtd���wxYwtj||fvs||krtd���| |z dz } | |z dz } | dz| dzz| |z z } t!| | ft#| ������Sd \}}t|��d kr=�fd �|D��}t%|�}t |t$��s|S|j}|j}nit|��dkrVt+|dd�� ��}|d} t+|d����j}n#t$rtd ���wxYw|�|�|dkr|St/j|||fi|��Std���)N�evaluaterrrArBr;z+The given equation is not that of a circle.�r8)NNr�c�4��g|]}t|d������S)r;�rVr8r�)r6r�r8s �r8r9z"Circle.__new__.<locals>.<listcomp> s(���I�I�I�q��a�Q��:�:�:�I�I�Ir:r;z-Circle with imaginary radius is not permittedz)Circle.__new__ received unknown arguments)�getr r8rZr?rrr��lhs�rhsr&r-r[rrrDr`r�Triangle� circumcenter� circumradiusr"rArrb)rcr�rerArBr@r�r�rk�d�e�center_x�center_y�r2r�rwr8s @r8rbzCircle.__new__s�����:�:�j�*;�*D�E�E�� �t�9�9��>�>�j��a��4��*�=�=�>�� � �3��$�$�A�� � �3��$�$�A��A�w�~�~�'�'�H��(�B�'�'� 7�#�<�(�,�6���Q��!�!�A��Q��!�!�A� S� -�h��1��a��d�A�q� I� I� ��1�a��A�A��� S� S� S�#�$Q�R�R�R� S�����v�!�Q����1��6�6�#�$Q�R�R�R��r�!�t�A�v�H��r�!�t�A�v�H��A�+�(�A�+�.��1��4�B��8�X�.��R���8�L�L�L� L��D�A�q��4�y�y�A�~�~�I�I�I�I�D�I�I�I���d�O��!�!�X�.�.���H��N���N����T���a����$�q�'�q�8�<�<�<����G��Y��a��X�6�6�6�8�A�A��!�Y�Y�Y�'�(W�X�X�X�Y�����I�����6�6��H�%�-�c�1�a�B�B�6�B�B�B�� K�L�L� Ls�$D�D�H+�+I�c ��|j\}}t|��}|jdd|i|��}|jdd|i|��}|�||d���S)Nr�Fr9rX)r�r0�evalfr)rEr��optionsr�r��dpss r8� _eval_evalfzCircle._eval_evalf7sj��� ���A��$���� �R�X� '� '�� '�w� '� '�� �A�G� %� %�c� %�W� %� %���y�y��Q��y�/�/�/r:c�0�dtjz|jzS)a"The circumference of the circle. Returns ======= circumference : number or SymPy expression Examples ======== >>> from sympy import Point, Circle >>> c1 = Circle(Point(3, 4), 6) >>> c1.circumference 12*pi r;)rr�r�rps r8r�zCircle.circumference>s��$�1�4�x�$�+�%�%r:rArBc��t|d���}t|d���}||jjz dz}||jjz dz}||z|jdzz S)a�The equation of the circle. Parameters ========== x : str or Symbol, optional Default value is 'x'. y : str or Symbol, optional Default value is 'y'. Returns ======= equation : SymPy expression Examples ======== >>> from sympy import Point, Circle >>> c1 = Circle(Point(0, 0), 5) >>> c1.equation() x**2 + y**2 - 25 Tr3r;)rrJrArBrtr�s r8r@zCircle.equationRsc��2 �A�D� !� !� !�� �A�D� !� !� !���$�+�-��!� #���$�+�-��!� #���B�w���Q��&�&r:c�8�t�||��S)a�The intersection of this circle with another geometrical entity. Parameters ========== o : GeometryEntity Returns ======= intersection : list of GeometryEntities Examples ======== >>> from sympy import Point, Circle, Line, Ray >>> p1, p2, p3 = Point(0, 0), Point(5, 5), Point(6, 0) >>> p4 = Point(5, 0) >>> c1 = Circle(p1, 5) >>> c1.intersection(p2) [] >>> c1.intersection(p4) [Point2D(5, 0)] >>> c1.intersection(Ray(p1, p2)) [Point2D(5*sqrt(2)/2, 5*sqrt(2)/2)] >>> c1.intersection(Line(p2, p3)) [] )r=r�rMs r8r�zCircle.intersectionqs��<�#�#�D�!�,�,�,r:c��|jdS)atThe radius of the circle. Returns ======= radius : number or SymPy expression See Also ======== Ellipse.major, Ellipse.minor, Ellipse.hradius, Ellipse.vradius Examples ======== >>> from sympy import Point, Circle >>> c1 = Circle(Point(3, 4), 6) >>> c1.radius 6 rr�rps r8r�z Circle.radius�s��.�y��|�r:c�r�|j}|�|��}|�||j ��S)aOverride GeometryEntity.reflect since the radius is not a GeometryEntity. Examples ======== >>> from sympy import Circle, Line >>> Circle((0, 1), 1).reflect(Line((0, 0), (1, 1))) Circle(Point2D(1, 0), -1) )rJrrr�)rEr�rks r8rzCircle.reflect�s2�� �K�� �I�I�d�O�O���y�y��T�[�L�)�)�)r:rNc�p�|j}|rBt|d���}|j| j��||��j|j�S|�||��}d�||fD��\}}||kr|�|||jz��S|jx}}t|||z||z���S)a;Override GeometryEntity.scale since the radius is not a GeometryEntity. Examples ======== >>> from sympy import Circle >>> Circle((0, 0), 1).scale(2, 2) Circle(Point2D(0, 0), 2) >>> Circle((0, 0), 1).scale(2, 4) Ellipse(Point2D(0, 0), 2, 4) r;rUc�,�g|]}t|����SrX)�absr5s r8r9z Circle.scale.<locals>.<listcomp>�s��'�'�'�1��A���'�'�'r:r )rJr"r r�r rr�r=rs r8r z Circle.scale�s��� �K�� � O��r�q�!�!�!�B�D�>�4�>�R�C�:�.�4�4�Q��:�:�D�b�g�N� N� �G�G�A�q�M�M��'�'��A��'�'�'���1� ��6�6��9�9�Q��$�+� �.�.� .�� ���A��q�!�A�#�q��s�3�3�3�3r:c�*�t|j��S)a This Ellipse property is an alias for the Circle's radius. Whereas hradius, major and minor can use Ellipse's conventions, the vradius does not exist for a circle. It is always a positive value in order that the Circle, like Polygons, will have an area that can be positive or negative as determined by the sign of the hradius. Examples ======== >>> from sympy import Point, Circle >>> c1 = Circle(Point(3, 4), 6) >>> c1.vradius 6 )rTr�rps r8rLzCircle.vradius�s��&�4�;���r:)rGr.r/)r0r1r2r3rbrLr4r�r@r�r�rr rLrXr:r8r`r`�s�������=�=�~1M�1M�1M�f0�0�0�0��&�&��X�&�&'�'�'�'�>-�-�-�@����X��0 *� *� *�4�4�4�4�0� � ��X� � � r:r`)r�r?)Or3�sympy.core.exprr�sympy.core.relationalr� sympy.corerrr�sympy.core.evalfr�sympy.core.parametersr �sympy.core.logicr �sympy.core.numbersr r �sympy.core.sortingr �sympy.core.symbolrrr�sympy.simplifyrr�(sympy.functions.elementary.miscellaneousrr�(sympy.functions.elementary.trigonometricrr�*sympy.functions.special.elliptic_integralsr�entityrr� exceptionsrr�rrrrr r!rr"r#r$�utilr%r&� sympy.polysr'r(r)�sympy.polys.polyutilsr*r+� sympy.solversr,�sympy.solvers.solvesetr-�sympy.utilities.miscr.r/�mpmath.libmp.libmpfr0r��rangerArBr=r`�polygonr�r?rXr:r8�<module>rns�����!� � � � � �$�$�$�$�$�$�%�%�%�%�%�%�%�%�%�%�������3�3�3�3�3�3�'�'�'�'�'�'�+�+�+�+�+�+�+�+�&�&�&�&�&�&�C�C�C�C�C�C�C�C�C�C�-�-�-�-�-�-�-�-�>�>�>�>�>�>�>�>�=�=�=�=�=�=�=�=�A�A�A�A�A�A�/�/�/�/�/�/�/�/�%�%�%�%�%�%�I�I�I�I�I�I�I�I�I�I�I�I�I�I�I�I�*�*�*�*�*�*�*�*�*�*���������:�:�:�:�:�:�:�:�:�:�6�6�6�6�6�6�6�6�������0�0�0�0�0�0�6�6�6�6�6�6�6�6�+�+�+�+�+�+� � � � �<�<�5�5��8�8�<�<�<���1�Y�Y�Y�Y�Y�k�Y�Y�Y�x,` �` �` �` �` �W�` �` �` �F '�&�&�&�&�&�&�&�&�&r:
Memory