§
    OŠtjº'  ã                   ó¦   — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZ ddlmZ ddlmZ dd	lmZmZ dd
lmZ ddlmZ  G d„ de¦  «        ZdS )zCCurves in 2-dimensional Euclidean space.

Contains
========
Curve

é    )Úsqrt)Údiff)ÚTuple)Ú_symbol)ÚGeometryEntityÚGeometrySet)ÚPoint)Ú	integrate)ÚMatrixÚ	rot_axis3)Úis_sequence)Úprec_to_dpsc                   óØ   — e Zd ZdZd„ Zd„ Zd„ Zdd„Zdd„Ze	d	„ ¦   «         Z
e	d
„ ¦   «         Ze	d„ ¦   «         Ze	d„ ¦   «         Ze	d„ ¦   «         Ze	d„ ¦   «         Zdd„Zdd„Zdd„Zdd„ZdS )ÚCurvea,  A curve in space.

    A curve is defined by parametric functions for the coordinates, a
    parameter and the lower and upper bounds for the parameter value.

    Parameters
    ==========

    function : list of functions
    limits : 3-tuple
        Function parameter and lower and upper bounds.

    Attributes
    ==========

    functions
    parameter
    limits

    Raises
    ======

    ValueError
        When `functions` are specified incorrectly.
        When `limits` are specified incorrectly.

    Examples
    ========

    >>> from sympy import Curve, sin, cos, interpolate
    >>> from sympy.abc import t, a
    >>> C = Curve((sin(t), cos(t)), (t, 0, 2))
    >>> C.functions
    (sin(t), cos(t))
    >>> C.limits
    (t, 0, 2)
    >>> C.parameter
    t
    >>> C = Curve((t, interpolate([1, 4, 9, 16], t)), (t, 0, 1)); C
    Curve((t, t**2), (t, 0, 1))
    >>> C.subs(t, 4)
    Point2D(4, 16)
    >>> C.arbitrary_point(a)
    Point2D(a, a**2)

    See Also
    ========

    sympy.core.function.Function
    sympy.polys.polyfuncs.interpolate

    c                 óN  — t          |¦  «        rt          |¦  «        dk    rt          dt          |¦  «        z  ¦  «        ‚t          |¦  «        rt          |¦  «        dk    rt          dt          |¦  «        z  ¦  «        ‚t	          j        | t          |Ž t          |Ž ¦  «        S )Né   z3Function argument should be (x(t), y(t)) but got %sé   z3Limit argument should be (t, tmin, tmax) but got %s)r   ÚlenÚ
ValueErrorÚstrr   Ú__new__r   )ÚclsÚfunctionÚlimitss      úR/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/geometry/curve.pyr   zCurve.__new__L   s¬   € Ý˜8Ñ$Ô$ð 	.­¨H©¬¸Ò(:Ð(:Ýð Ý" 8™}œ}ñ-ñ .ô .ð .å˜6Ñ"Ô"ð 	,¥c¨&¡k¤k°QÒ&6Ð&6Ýð Ý" 6™{œ{ñ+ñ ,ô ,ð ,õ Ô% c­5°(Ð+;½UÀF¸^ÑLÔLÐLó    c                 ó8   — |                       | j        |¦  «        S ©N)ÚsubsÚ	parameter)ÚselfÚfs     r   Ú__call__zCurve.__call__V   s   € Ø�yŠy˜œ¨Ñ+Ô+Ð+r   c                 óV   ‡‡— ‰| j         k    rt          ˆˆfd„| j        D ¦   «         Ž S d S )Nc                 ó<   •— g | ]}|                      ‰‰¦  «        ‘ŒS © ©r   )Ú.0r"   ÚnewÚolds     €€r   ú
<listcomp>z$Curve._eval_subs.<locals>.<listcomp>[   s'   ø€ ÐDÐDÐD°˜1Ÿ6š6 # sÑ+Ô+ÐDÐDÐDr   )r    r	   Ú	functions)r!   r*   r)   s    ``r   Ú
_eval_subszCurve._eval_subsY   s>   øø€ Ø�$”.Ò Ð ÝÐDÐDÐDÐDÐD°T´^ÐDÑDÔDÐEÐEð !Ð r   é   c                 óÒ   ‡‡— | j         \  }\  }}}t          |¦  «        Št          ˆˆfd„|D ¦   «         ¦  «        }ˆˆfd„||fD ¦   «         \  }}|                      ||||f¦  «        S )Nc                 ó.   •— g | ]} |j         dd ‰i‰¤Ž‘ŒS ©Únr&   ©Úevalf©r(   ÚiÚdpsÚoptionss     €€r   r+   z%Curve._eval_evalf.<locals>.<listcomp>`   s0   ø€ Ð8Ð8Ð8°�7�1”7Ð,Ð,˜SÐ, GÐ,Ð,Ð8Ð8Ð8r   c                 ó.   •— g | ]} |j         dd ‰i‰¤Ž‘ŒS r1   r3   r5   s     €€r   r+   z%Curve._eval_evalf.<locals>.<listcomp>a   s0   ø€ Ð:Ð:Ð:¨a��”Ð)Ð)˜#Ð) Ð)Ð)Ð:Ð:Ð:r   )Úargsr   ÚtupleÚfunc)r!   Úprecr8   r"   ÚtÚaÚbr7   s     `    @r   Ú_eval_evalfzCurve._eval_evalf]   s…   øø€ Ø”y‰ˆ‰9ˆAˆq�!Ý˜$ÑÔˆÝÐ8Ð8Ð8Ð8Ð8°aÐ8Ñ8Ô8Ñ9Ô9ˆØ:Ð:Ð:Ð:Ð:°A°q°6Ð:Ñ:Ô:‰ˆˆ1Ø�yŠy˜˜Q  1˜IÑ&Ô&Ð&r   r>   c                 ó  ‡‡— |€t          | j        Ž S t          || j        d¬¦  «        Š| j        Š‰j        ‰j        k    r/‰j        d„ | j        D ¦   «         v rt          d‰j        z  ¦  «        ‚t          ˆˆfd„| j        D ¦   «         Ž S )aã  A parameterized point on the curve.

        Parameters
        ==========

        parameter : str or Symbol, optional
            Default value is 't'.
            The Curve's parameter is selected with None or self.parameter
            otherwise the provided symbol is used.

        Returns
        =======

        Point :
            Returns a point in parametric form.

        Raises
        ======

        ValueError
            When `parameter` already appears in the functions.

        Examples
        ========

        >>> from sympy import Curve, Symbol
        >>> from sympy.abc import s
        >>> C = Curve([2*s, s**2], (s, 0, 2))
        >>> C.arbitrary_point()
        Point2D(2*t, t**2)
        >>> C.arbitrary_point(C.parameter)
        Point2D(2*s, s**2)
        >>> C.arbitrary_point(None)
        Point2D(2*s, s**2)
        >>> C.arbitrary_point(Symbol('a'))
        Point2D(2*a, a**2)

        See Also
        ========

        sympy.geometry.point.Point

        NT©Úrealc              3   ó$   K  — | ]}|j         V — Œd S r   )Úname)r(   r"   s     r   ú	<genexpr>z(Curve.arbitrary_point.<locals>.<genexpr>–   s$   è è € Ð@Ð@¨˜aœfÐ@Ð@Ð@Ð@Ð@Ð@r   zFSymbol %s already appears in object and cannot be used as a parameter.c                 ó<   •— g | ]}|                      ‰‰¦  «        ‘ŒS r&   r'   )r(   Úwr>   Útnews     €€r   r+   z)Curve.arbitrary_point.<locals>.<listcomp>™   s%   ø€ Ð?Ð?Ð?¨1�q—v’v˜a ‘”Ð?Ð?Ð?r   )r	   r,   r   r    rF   Úfree_symbolsr   )r!   r    r>   rJ   s     @@r   Úarbitrary_pointzCurve.arbitrary_pointd   s¯   øø€ ðX ÐÝ˜$œ.Ð)Ð)å�y $¤.°tÐ<Ñ<Ô<ˆØŒNˆØŒI˜œÒÐØ”	Ð@Ð@¨dÔ.?Ð@Ñ@Ô@Ð@Ð@Ýð 5Ø7;´yñAñ Bô Bð BåÐ?Ð?Ð?Ð?Ð?°´Ð?Ñ?Ô?Ð@Ð@r   c                 ó    — t          ¦   «         }| j        | j        dd…         z   D ]}||j        z  }Œ|                     | j        h¦  «        }|S )aÄ  Return a set of symbols other than the bound symbols used to
        parametrically define the Curve.

        Returns
        =======

        set :
            Set of all non-parameterized symbols.

        Examples
        ========

        >>> from sympy.abc import t, a
        >>> from sympy import Curve
        >>> Curve((t, t**2), (t, 0, 2)).free_symbols
        set()
        >>> Curve((t, t**2), (t, a, 2)).free_symbols
        {a}

        é   N)Úsetr,   r   rK   Ú
differencer    )r!   Úfreer?   s      r   rK   zCurve.free_symbols›   sV   € õ, ‰uŒuˆØ” $¤+¨a¨b¨b¤/Ñ1ð 	#ð 	#ˆAØ�A”NÑ"ˆDˆDØ�Š ¤Ð/Ñ0Ô0ˆØˆr   c                 ó6   — t          | j        d         ¦  «        S )a;  The dimension of the curve.

        Returns
        =======

        int :
            the dimension of curve.

        Examples
        ========

        >>> from sympy.abc import t
        >>> from sympy import Curve
        >>> C = Curve((t, t**2), (t, 0, 2))
        >>> C.ambient_dimension
        2

        r   )r   r:   ©r!   s    r   Úambient_dimensionzCurve.ambient_dimension·   s   € õ* �4”9˜Q”<Ñ Ô Ð r   c                 ó   — | j         d         S )a“  The functions specifying the curve.

        Returns
        =======

        functions :
            list of parameterized coordinate functions.

        Examples
        ========

        >>> from sympy.abc import t
        >>> from sympy import Curve
        >>> C = Curve((t, t**2), (t, 0, 2))
        >>> C.functions
        (t, t**2)

        See Also
        ========

        parameter

        r   ©r:   rS   s    r   r,   zCurve.functionsÎ   ó   € ð2 Œy˜Œ|Ðr   c                 ó   — | j         d         S )a’  The limits for the curve.

        Returns
        =======

        limits : tuple
            Contains parameter and lower and upper limits.

        Examples
        ========

        >>> from sympy.abc import t
        >>> from sympy import Curve
        >>> C = Curve([t, t**3], (t, -2, 2))
        >>> C.limits
        (t, -2, 2)

        See Also
        ========

        plot_interval

        rN   rV   rS   s    r   r   zCurve.limitsé   rW   r   c                 ó(   — | j         d         d         S )am  The curve function variable.

        Returns
        =======

        Symbol :
            returns a bound symbol.

        Examples
        ========

        >>> from sympy.abc import t
        >>> from sympy import Curve
        >>> C = Curve([t, t**2], (t, 0, 2))
        >>> C.parameter
        t

        See Also
        ========

        functions

        rN   r   rV   rS   s    r   r    zCurve.parameter  s   € ð2 Œy˜Œ|˜AŒÐr   c                 óˆ   ‡ — t          t          ˆ fd„‰ j        D ¦   «         ¦  «        ¦  «        }t          |‰ j        ¦  «        S )zÃThe curve length.

        Examples
        ========

        >>> from sympy import Curve
        >>> from sympy.abc import t
        >>> Curve((t, t), (t, 0, 1)).length
        sqrt(2)

        c              3   óT   •K  — | ]"}t          |‰j        d          ¦  «        dz  V — Œ#dS )r   r   N)r   r   )r(   r<   r!   s     €r   rG   zCurve.length.<locals>.<genexpr>,  s8   øè è € ÐVÐV¸t�T $¨¬°A¬Ñ7Ô7¸Ñ:ÐVÐVÐVÐVÐVÐVr   )r   Úsumr,   r
   r   )r!   Ú	integrands   ` r   ÚlengthzCurve.length  sC   ø€ õ �ÐVÐVÐVÐVÀtÄ~ÐVÑVÔVÑVÔVÑWÔWˆ	Ý˜ D¤KÑ0Ô0Ð0r   c                 óp   — t          || j        d¬¦  «        }|gt          | j        dd…         ¦  «        z   S )aë  The plot interval for the default geometric plot of the curve.

        Parameters
        ==========

        parameter : str or Symbol, optional
            Default value is 't';
            otherwise the provided symbol is used.

        Returns
        =======

        List :
            the plot interval as below:
                [parameter, lower_bound, upper_bound]

        Examples
        ========

        >>> from sympy import Curve, sin
        >>> from sympy.abc import x, s
        >>> Curve((x, sin(x)), (x, 1, 2)).plot_interval()
        [t, 1, 2]
        >>> Curve((x, sin(x)), (x, 1, 2)).plot_interval(s)
        [s, 1, 2]

        See Also
        ========

        limits : Returns limits of the parameter interval

        TrC   rN   N)r   r    Úlistr   )r!   r    r>   s      r   Úplot_intervalzCurve.plot_interval/  s:   € õB �I˜tœ~°DÐ9Ñ9Ô9ˆØˆs•T˜$œ+ a b bœ/Ñ*Ô*Ñ*Ð*r   r   Nc                 ó   — |rt          |d¬¦  «         }nt          dd¦  «        } | j        |j        Ž }t          |j        ¦  «        }|                     d¦  «         t          dd|¦  «        }|t          |¦  «        z  }|                      |ddd…f          	                    ¦   «         d         | j
        ¦  «        }| } |j        |j        Ž S )aþ  This function is used to rotate a curve along given point ``pt`` at given angle(in radian).

        Parameters
        ==========

        angle :
            the angle at which the curve will be rotated(in radian) in counterclockwise direction.
            default value of angle is 0.

        pt : Point
            the point along which the curve will be rotated.
            If no point given, the curve will be rotated around origin.

        Returns
        =======

        Curve :
            returns a curve rotated at given angle along given point.

        Examples
        ========

        >>> from sympy import Curve, pi
        >>> from sympy.abc import x
        >>> Curve((x, x), (x, 0, 1)).rotate(pi/2)
        Curve((-x, x), (x, 0, 1))

        r   ©Údimr   rN   r   N)r	   Ú	translater:   r`   r,   Úappendr   r   r<   Útolistr   )r!   ÚangleÚptÚrvr"   s        r   ÚrotatezCurve.rotateS  sÇ   € ð: ð 	Ý˜ Ð"Ñ"Ô"Ð"ˆBˆBå�q˜‘”ˆBØˆTŒ^˜RœWÐ%ˆÝ�”ÑÔˆØ	�Š�‰ŒˆÝ�1�a˜‰OŒOˆØ	�Y�uÑÔÑˆØ�YŠY�q˜˜B˜Q˜B˜”x—’Ñ(Ô(¨Ô+¨T¬[Ñ9Ô9ˆØˆSˆØˆrŒ|˜RœWÐ%Ð%r   rN   c                 óä   — |rBt          |d¬¦  «        }  | j        | j        Ž                      ||¦  «        j        |j        Ž S | j        \  }}|                      ||z  ||z  f| j        ¦  «        S )a^  Override GeometryEntity.scale since Curve is not made up of Points.

        Returns
        =======

        Curve :
            returns scaled curve.

        Examples
        ========

        >>> from sympy import Curve
        >>> from sympy.abc import x
        >>> Curve((x, x), (x, 0, 1)).scale(2)
        Curve((2*x, x), (x, 0, 1))

        r   rc   )r	   re   r:   Úscaler,   r<   r   )r!   ÚxÚyri   ÚfxÚfys         r   rm   zCurve.scale}  s{   € ð$ ð 	OÝ�r˜qÐ!Ñ!Ô!ˆBØD�>�4”> R C¤:Ð.×4Ò4°Q¸Ñ:Ô:ÔDÀbÄgÐNÐNØ”‰ˆˆBØ�yŠy˜"˜Q™$  1¡˜ t¤{Ñ3Ô3Ð3r   c                 ó\   — | j         \  }}|                      ||z   ||z   f| j        ¦  «        S )aL  Translate the Curve by (x, y).

        Returns
        =======

        Curve :
            returns a translated curve.

        Examples
        ========

        >>> from sympy import Curve
        >>> from sympy.abc import x
        >>> Curve((x, x), (x, 0, 1)).translate(1, 2)
        Curve((x + 1, x + 2), (x, 0, 1))

        )r,   r<   r   )r!   rn   ro   rp   rq   s        r   re   zCurve.translate•  s2   € ð$ ”‰ˆˆBØ�yŠy˜"˜q™& " q¡&Ð)¨4¬;Ñ7Ô7Ð7r   )r.   )r>   )r   N)rN   rN   N)r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r#   r-   rA   rL   ÚpropertyrK   rT   r,   r   r    r^   ra   rk   rm   re   r&   r   r   r   r      ss  € € € € € ð3ð 3ðjMð Mð Mð,ð ,ð ,ðFð Fð Fð'ð 'ð 'ð 'ð5Að 5Að 5Að 5Aðn ðð ñ „Xðð6 ð!ð !ñ „Xð!ð, ðð ñ „Xðð4 ðð ñ „Xðð4 ðð ñ „Xðð4 ð1ð 1ñ „Xð1ð"+ð "+ð "+ð "+ðH(&ð (&ð (&ð (&ðT4ð 4ð 4ð 4ð08ð 8ð 8ð 8ð 8ð 8r   r   N)rv   Ú(sympy.functions.elementary.miscellaneousr   Ú
sympy.corer   Úsympy.core.containersr   Úsympy.core.symbolr   Úsympy.geometry.entityr   r   Úsympy.geometry.pointr	   Úsympy.integralsr
   Úsympy.matricesr   r   Úsympy.utilities.iterablesr   Úmpmath.libmp.libmpfr   r   r&   r   r   ú<module>r‚      s  ððð ð :Ð 9Ð 9Ð 9Ð 9Ð 9Ø Ð Ð Ð Ð Ð Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø %Ð %Ð %Ð %Ð %Ð %Ø =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ø &Ð &Ð &Ð &Ð &Ð &Ø %Ð %Ð %Ð %Ð %Ð %Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1à +Ð +Ð +Ð +Ð +Ð +ðR8ð R8ð R8ð R8ð R8ˆKñ R8ô R8ð R8ð R8ð R8r   