� ��g�)���dZddlmZddlmZddlmZmZddlm Z m Z ddl m Z m Z ddlmZmZmZmZmZddlmZdd lmZdd lmZdd lmZGd �d e ��ZdS)z4Parabolic geometrical entity. Contains * Parabola �)�S)�ordered)�_symbol�symbols)�GeometryEntity� GeometrySet)�Point�Point2D)�Line�Line2D�Ray2D� Segment2D�LinearEntity3D)�Ellipse)�sign)�simplify)�solvec���eZdZdZdd�Zed���Zed���Zed���Zed���Z dd �Z ed ���Z ed ���Z d �Z ed���Zed���ZdS)�Parabolaa�A parabolic GeometryEntity. A parabola is declared with a point, that is called 'focus', and a line, that is called 'directrix'. Only vertical or horizontal parabolas are currently supported. Parameters ========== focus : Point Default value is Point(0, 0) directrix : Line Attributes ========== focus directrix axis of symmetry focal length p parameter vertex eccentricity Raises ====== ValueError When `focus` is not a two dimensional point. When `focus` is a point of directrix. NotImplementedError When `directrix` is neither horizontal nor vertical. Examples ======== >>> from sympy import Parabola, Point, Line >>> p1 = Parabola(Point(0, 0), Line(Point(5, 8), Point(7,8))) >>> p1.focus Point2D(0, 0) >>> p1.directrix Line2D(Point2D(5, 8), Point2D(7, 8)) Nc ���|rt|d���}ntdd��}t|��}|�|��rtd���t j|||fi|��S)N�)�dimrz*The focus must not be a point of directrix)r r �contains� ValueErrorr�__new__)�cls�focus� directrix�kwargss �g/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/geometry/parabola.pyrzParabola.__new__Asy�� � ��%�Q�'�'�'�E�E��!�Q�K�K�E���O�O� � � � �e� $� $� K��I�J�J� J��%�c�5�)�F�F�v�F�F�F�c��dS)aXReturns the ambient dimension of parabola. Returns ======= ambient_dimension : integer Examples ======== >>> from sympy import Parabola, Point, Line >>> f1 = Point(0, 0) >>> p1 = Parabola(f1, Line(Point(5, 8), Point(7, 8))) >>> p1.ambient_dimension 2 r���selfs r �ambient_dimensionzParabola.ambient_dimensionOs ��&�qr!c�@�|j�|j��S)a�Return the axis of symmetry of the parabola: a line perpendicular to the directrix passing through the focus. Returns ======= axis_of_symmetry : Line See Also ======== sympy.geometry.line.Line Examples ======== >>> from sympy import Parabola, Point, Line >>> p1 = Parabola(Point(0, 0), Line(Point(5, 8), Point(7, 8))) >>> p1.axis_of_symmetry Line2D(Point2D(0, 0), Point2D(0, 1)) )r�perpendicular_linerr$s r �axis_of_symmetryzParabola.axis_of_symmetryds��0�~�0�0���<�<�<r!c��|jdS)a�The directrix of the parabola. Returns ======= directrix : Line See Also ======== sympy.geometry.line.Line Examples ======== >>> from sympy import Parabola, Point, Line >>> l1 = Line(Point(5, 8), Point(7, 8)) >>> p1 = Parabola(Point(0, 0), l1) >>> p1.directrix Line2D(Point2D(5, 8), Point2D(7, 8)) ���argsr$s r rzParabola.directrix~���0�y��|�r!c��tjS)a�The eccentricity of the parabola. Returns ======= eccentricity : number A parabola may also be characterized as a conic section with an eccentricity of 1. As a consequence of this, all parabolas are similar, meaning that while they can be different sizes, they are all the same shape. See Also ======== https://en.wikipedia.org/wiki/Parabola Examples ======== >>> from sympy import Parabola, Point, Line >>> p1 = Parabola(Point(0, 0), Line(Point(5, 8), Point(7, 8))) >>> p1.eccentricity 1 Notes ----- The eccentricity for every Parabola is 1 by definition. )r�Oner$s r � eccentricityzParabola.eccentricity�s ��B�u� r!�x�yc���t|d���}t|d���}|jj}|tjur-d|jz||jjz z}||jjz dz}n�|dkr-d|jz||jjz z}||jjz dz}n\|j \}}|jj dd�\}} ||z dz||z dzz}|j� ||��dz|dz| dzzz }||z S)azThe equation of the parabola. 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 Parabola, Point, Line >>> p1 = Parabola(Point(0, 0), Line(Point(5, 8), Point(7, 8))) >>> p1.equation() -x**2 - 16*y + 64 >>> p1.equation('f') -f**2 - 16*y + 64 >>> p1.equation(y='z') -x**2 - 16*z + 64 T��real�rrN) rr�sloper�Infinity� p_parameter�vertexr2r3r� coefficients�equation) r%r2r3�m�t1�t2�a�b�c�ds r r=zParabola.equation�s��6 �A�D� !� !� !�� �A�D� !� !� !�� �N� �� �� �?�?��d�&�'�1�t�{�}�+<�=�B��d�k�m�#�a�'�B�B� �!�V�V��d�&�'�1�t�{�}�+<�=�B��d�k�m�#�a�'�B�B��:�D�A�q��>�.�r��r�2�D�A�q��a�%�!��q�1�u�q�j�(�B���(�(��A�.�.��1�1�a�4�!�Q�$�;�?�B��B�w�r!c�N�|j�|j��}|dz }|S)aYThe focal length of the parabola. Returns ======= focal_lenght : number or symbolic expression Notes ===== The distance between the vertex and the focus (or the vertex and directrix), measured along the axis of symmetry, is the "focal length". See Also ======== https://en.wikipedia.org/wiki/Parabola Examples ======== >>> from sympy import Parabola, Point, Line >>> p1 = Parabola(Point(0, 0), Line(Point(5, 8), Point(7, 8))) >>> p1.focal_length 4 r)r�distancer)r%rF� focal_lengths r rGzParabola.focal_length�s*��<�>�*�*�4�:�6�6����z� ��r!c��|jdS)a�The focus of the parabola. Returns ======= focus : Point See Also ======== sympy.geometry.point.Point Examples ======== >>> from sympy import Parabola, Point, Line >>> f1 = Point(0, 0) >>> p1 = Parabola(f1, Line(Point(5, 8), Point(7, 8))) >>> p1.focus Point2D(0, 0) rr,r$s r rzParabola.focus r.r!c �V��tdd���\}}|���}t�t��rY�|vr�gSt t d�t |����g||gd���dD������St�t��rGt|� |�j df|�j dfg����dkr�gSgSt�ttf��rzt |t�jd�jd�����g||gd���d}t t �fd�|D������St�ttf��rRt t d �t |����g||gd���dD������St�t ��rt#d ���t#d ���) a�The intersection of the parabola and another geometrical entity `o`. Parameters ========== o : GeometryEntity, LinearEntity Returns ======= intersection : list of GeometryEntity objects Examples ======== >>> from sympy import Parabola, Point, Ellipse, Line, Segment >>> p1 = Point(0,0) >>> l1 = Line(Point(1, -2), Point(-1,-2)) >>> parabola1 = Parabola(p1, l1) >>> parabola1.intersection(Ellipse(Point(0, 0), 2, 5)) [Point2D(-2, 0), Point2D(2, 0)] >>> parabola1.intersection(Line(Point(-7, 3), Point(12, 3))) [Point2D(-4, 3), Point2D(4, 3)] >>> parabola1.intersection(Segment((-12, -65), (14, -68))) [] zx yTr5c�,�g|]}t|����Sr#)r ��.0�is r � <listcomp>z)Parabola.intersection.<locals>.<listcomp>Fs0��%G�%G�%G�!�U�1�X�X�%G�%G�%Gr!)�setr+rc�6��g|]}|�v�t|����Sr#�r )rLrM�os �r rNz)Parabola.intersection.<locals>.<listcomp>Qs$��� F� F� F��q�A�v�v�����v�v�vr!c�,�g|]}t|����Sr#rQrKs r rNz)Parabola.intersection.<locals>.<listcomp>Ss0��!C�!C�!C������!C�!C�!Cr!z5Entity must be two dimensional, not three dimensionalzWrong type of argument were put)rr=� isinstancer�listrrr r�subs�_argsrr r �pointsrr� TypeError)r%rRr2r3� parabola_eq�results ` r � intersectionzParabola.intersection$sh���8�u�4�(�(�(���1��m�m�o�o� � �a�� "� "� ?��D�y�y��s� ��G�%G�%G�u� �!�*�*�,�,�/�!�Q��T�8C�8C�8C�CD�8F�%G�%G�%G�H�H�I�I�I� ��7� #� #� ?�� �(�(�1�a�g�a�j�/�A�q�w�q�z�?�)K�L�L�M�M�QR�R�R��s� �� � ��I�u�-� .� .� ?��K��q�x��{�A�H�Q�K�0�0�9�9�;�;�=��A��D�"�"�"�"#�%�F��� F� F� F� F�V� F� F� F�G�G�H�H� H� ��F�G�,� -� -� ?���!C�!C�U��a�j�j�l�l�+�a��V��6?�6?�6?�?@�6B�!C�!C�!C�D�D�E�E� E� ��>� *� *� ?��S�T�T� T��=�>�>� >r!c��|jj}|tjur5|jjd}t |jjd|z��}n{|dkr5|jjd}t |jjd|z��}n@|j�|j��}t |jj |j z ��}||j zS)aP is a parameter of parabola. Returns ======= p : number or symbolic expression Notes ===== The absolute value of p is the focal length. The sign on p tells which way the parabola faces. Vertical parabolas that open up and horizontal that open right, give a positive value for p. Vertical parabolas that open down and horizontal that open left, give a negative value for p. See Also ======== https://www.sparknotes.com/math/precalc/conicsections/section2/ Examples ======== >>> from sympy import Parabola, Point, Line >>> p1 = Parabola(Point(0, 0), Line(Point(5, 8), Point(7, 8))) >>> p1.p_parameter -4 rrr+) rr8rr9r<rrr-� projectionr2rG)r%r>r2�pr3rDs r r:zParabola.p_parameterZs���B �N� �� �� �?�?���+�A�.�A��T�Z�_�Q�'�!�+�,�,�A�A� �!�V�V���+�A�.�A��T�Z�_�Q�'�!�+�,�,�A�A���)�)�$�*�5�5�A��T�Z�\�A�C�'�(�(�A��4�$�$�$r!c�P�|j}|jj}|tjur/t |jd|jz |jd��}nU|dkr/t |jd|jd|jz ��}n |j� |��d}|S)apThe vertex of the parabola. Returns ======= vertex : Point See Also ======== sympy.geometry.point.Point Examples ======== >>> from sympy import Parabola, Point, Line >>> p1 = Parabola(Point(0, 0), Line(Point(5, 8), Point(7, 8))) >>> p1.vertex Point2D(0, 4) rr+) rrr8rr9r r-r:r)r\)r%rr>r;s r r;zParabola.vertex�s���.� �� �N� �� �� �?�?��5�:�a�=�4�+;�;�U�Z��]�K�K�F�F� �!�V�V��5�:�a�=�%�*�Q�-�$�:J�*J�K�K�F�F��*�7�7��=�=�a�@�F�� r!)NN)r2r3)�__name__� __module__� __qualname__�__doc__r�propertyr&r)rr1r=rGrr\r:r;r#r!r rrs7������*�*�X G� G� G� G�����X��(�=�=��X�=�2����X��2� � ��X� �D*�*�*�*�X� � ��X� �D����X��24?�4?�4?�l�*%�*%��X�*%�X����X���r!rN)rd� sympy.corer�sympy.core.sortingr�sympy.core.symbolrr�sympy.geometry.entityrr�sympy.geometry.pointr r �sympy.geometry.liner r r rr�sympy.geometry.ellipser�sympy.functionsr�sympy.simplifyr�sympy.solvers.solversrrr#r!r �<module>rps-����������&�&�&�&�&�&�.�.�.�.�.�.�.�.�=�=�=�=�=�=�=�=�/�/�/�/�/�/�/�/�N�N�N�N�N�N�N�N�N�N�N�N�N�N�*�*�*�*�*�*� � � � � � �#�#�#�#�#�#�'�'�'�'�'�'�R�R�R�R�R�{�R�R�R�R�Rr!
Memory