§
    OŠtjÜ)  ã                   óº   — d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	m
Z
 ddlmZmZ ddlmZmZmZmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZ  G d„ de
¦  «        ZdS )z4Parabolic geometrical entity.

Contains
* Parabola

é    )ÚS)Úordered)Ú_symbolÚsymbols)ÚGeometryEntityÚGeometrySet)ÚPointÚPoint2D)ÚLineÚLine2DÚRay2DÚ	Segment2DÚLinearEntity3D)ÚEllipse)Úsign)Úsimplify)Úsolvec                   óØ   — e Zd ZdZdd„Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Z	dd
„Z
ed„ ¦   «         Zed„ ¦   «         Zd„ Zed„ ¦   «         Zed„ ¦   «         ZdS )Ú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                 óØ   — |rt          |d¬¦  «        }nt          dd¦  «        }t          |¦  «        }|                     |¦  «        rt          d¦  «        ‚t	          j        | ||fi |¤ŽS )Né   )Údimr   z*The focus must not be a point of directrix)r	   r   ÚcontainsÚ
ValueErrorr   Ú__new__)ÚclsÚfocusÚ	directrixÚkwargss       úU/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/geometry/parabola.pyr   zParabola.__new__A   sy   € àð 	 Ý˜% QÐ'Ñ'Ô'ˆEˆEå˜!˜Q‘K”KˆEå˜‘O”Oˆ	à×Ò˜eÑ$Ô$ð 	KÝÐIÑJÔJÐJåÔ% c¨5°)ÐFÐF¸vÐFÐFÐFó    c                 ó   — dS )aX  Returns 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_dimensionzParabola.ambient_dimensionO   s	   € ð& ˆ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_liner   r$   s    r    Úaxis_of_symmetryzParabola.axis_of_symmetryd   s   € ð0 Œ~×0Ò0°´Ñ<Ô<Ð<r!   c                 ó   — | j         d         S )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    r   zParabola.directrix~   ó   € ð0 Œy˜Œ|Ðr!   c                 ó   — t           j        S )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    ÚeccentricityzParabola.eccentricity˜   s   € õB Œuˆr!   ÚxÚyc                 óü  — t          |d¬¦  «        }t          |d¬¦  «        }| j        j        }|t          j        u r-d| j        z  || j        j        z
  z  }|| j        j        z
  dz  }n�|dk    r-d| j        z  || j        j        z
  z  }|| j        j        z
  dz  }n\| j	        \  }}| j        j
        dd…         \  }}	||z
  dz  ||z
  dz  z   }| j                             ||¦  «        dz  |dz  |	dz  z   z  }||z
  S )az  The 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é   r   r   N)r   r   Úsloper   ÚInfinityÚp_parameterÚvertexr2   r3   r   ÚcoefficientsÚequation)
r%   r2   r3   ÚmÚt1Út2ÚaÚbÚcÚds
             r    r=   zParabola.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        ¦  «        }|dz  }|S )aY  The 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    rG   zParabola.focal_lengthç   s*   € ð< ”>×*Ò*¨4¬:Ñ6Ô6ˆØ ‘zˆàÐr!   c                 ó   — | j         d         S )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)

        r   r,   r$   s    r    r   zParabola.focus
  r.   r!   c           
      óV  ‡— t          dd¬¦  «        \  }}|                      ¦   «         }t          ‰t          ¦  «        rY‰| v r‰gS t	          t          d„ t          |‰                     ¦   «         g||gd¬¦  «        d         D ¦   «         ¦  «        ¦  «        S t          ‰t          ¦  «        rGt          | 	                    |‰j
        d         f|‰j
        d         fg¦  «        ¦  «        dk    r‰gS g S t          ‰t          t          f¦  «        rzt          |t          ‰j        d         ‰j        d         ¦  «                             ¦   «         g||gd¬¦  «        d         }t	          t          ˆfd„|D ¦   «         ¦  «        ¦  «        S t          ‰t          t          f¦  «        rRt	          t          d	„ t          |‰                     ¦   «         g||gd¬¦  «        d         D ¦   «         ¦  «        ¦  «        S t          ‰t           ¦  «        rt#          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)))
        []

        zx yTr5   c                 ó,   — g | ]}t          |¦  «        ‘ŒS r#   )r	   ©Ú.0Úis     r    ú
<listcomp>z)Parabola.intersection.<locals>.<listcomp>F  s0   € ð %Gð %Gð %G°!¥U¨1¡X¤Xð %Gð %Gð %Gr!   )Úsetr+   r   c                 ó6   •— g | ]}|‰v ¯t          |¦  «        ‘ŒS r#   ©r
   )rL   rM   Úos     €r    rN   z)Parabola.intersection.<locals>.<listcomp>Q  s$   ø€ Ð FÐ FÐ F°¸qÀA¸v¸v¥¨¡¤¸v¸v¸vr!   c                 ó,   — g | ]}t          |¦  «        ‘ŒS r#   rQ   rK   s     r    rN   z)Parabola.intersection.<locals>.<listcomp>S  s0   € ð !Cð !Cð !C°¥¨¡¤ð !Cð !Cð !Cr!   z5Entity must be two dimensional, not three dimensionalzWrong type of argument were put)r   r=   Ú
isinstancer   Úlistr   r   r
   r   ÚsubsÚ_argsr   r   r   Úpointsr   r   Ú	TypeError)r%   rR   r2   r3   Úparabola_eqÚresults    `    r    ÚintersectionzParabola.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                 óª  — | j         j        }|t          j        u r5| j         j        d         }t          | j        j        d         |z   ¦  «        }n{|dk    r5| j         j        d         }t          | j        j        d         |z   ¦  «        }n@| j                              | j        ¦  «        }t          | j        j	        |j	        z
  ¦  «        }|| j
        z  S )a  P 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

        r   r   r+   )r   r8   r   r9   r<   r   r   r-   Ú
projectionr2   rG   )r%   r>   r2   Úpr3   rD   s         r    r:   zParabola.p_parameterZ  s¸   € ð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         }| j        j        }|t          j        u r/t          |j        d         | j        z
  |j        d         ¦  «        }nU|dk    r/t          |j        d         |j        d         | j        z
  ¦  «        }n | j         	                    | ¦  «        d         }|S )ap  The 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)

        r   r+   )
r   r   r8   r   r9   r	   r-   r:   r)   r\   )r%   r   r>   r;   s       r    r;   zParabola.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)r2   r3   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr&   r)   r   r1   r=   rG   r   r\   r:   r;   r#   r!   r    r   r      s7  € € € € € ð*ð *ðXGð Gð Gð Gð ðð ñ „Xðð( ð=ð =ñ „Xð=ð2 ðð ñ „Xðð2 ð ð  ñ „Xð ðD*ð *ð *ð *ðX ð ð  ñ „Xð ðD ðð ñ „Xðð24?ð 4?ð 4?ðl ð*%ð *%ñ „Xð*%ðX ðð ñ „Xðð ð r!   r   N)rd   Ú
sympy.corer   Úsympy.core.sortingr   Úsympy.core.symbolr   r   Úsympy.geometry.entityr   r   Úsympy.geometry.pointr	   r
   Úsympy.geometry.liner   r   r   r   r   Úsympy.geometry.ellipser   Úsympy.functionsr   Úsympy.simplify.simplifyr   Úsympy.solvers.solversr   r   r#   r!   r    ú<module>rp      s-  ððð ð Ð Ð Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &Ø .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ø =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ø /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ø NÐ NÐ NÐ NÐ NÐ NÐ NÐ NÐ NÐ NÐ NÐ NÐ NÐ NØ *Ð *Ð *Ð *Ð *Ð *Ø  Ð  Ð  Ð  Ð  Ð  Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'ðRð Rð Rð Rð Rˆ{ñ Rô Rð Rð Rð Rr!   