� ��g�'���dZddlmZddlmZddlmZddlmZddl m Z m Z ddl m Z ddlmZdd lmZmZdd lmZdd lmZGd �d e ��ZdS)zCCurves in 2-dimensional Euclidean space. Contains ======== Curve �)�sqrt)�diff)�Tuple)�_symbol)�GeometryEntity� GeometrySet)�Point)� integrate)�Matrix� rot_axis3)� is_sequence)� prec_to_dpsc���eZdZdZd�Zd�Zd�Zdd�Zdd�Ze d ���Z e d ���Z e d ���Z e d ���Z e d ���Ze d���Zdd�Zdd�Zdd�Zdd�ZdS)�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|��rt|��dkrtdt|��z���t|��rt|��dkrtdt|��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 �d/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/geometry/curve.pyrz Curve.__new__Ls����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__zCurve.__call__Vs���y�y����+�+�+rc�V����|jkrt��fd�|jD���SdS)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_subszCurve._eval_subsYs>���� �$�.� � ��D�D�D�D�D�T�^�D�D�D�E� E� !� r�c �����|j\}\}}}t|���t��fd�|D����}��fd�||fD��\}}|�||||f��S)Nc�.��g|]}|jdd�i�����S��nr&��evalf�r(�i�dps�optionss ��rr+z%Curve._eval_evalf.<locals>.<listcomp>`s0���8�8�8��7�1�7�,�,�S�,�G�,�,�8�8�8rc�.��g|]}|jdd�i�����Sr1r3r5s ��rr+z%Curve._eval_evalf.<locals>.<listcomp>as0���:�:�:�a����)�)�#�)��)�)�:�:�:r)�argsr�tuple�func)r!�precr8r"�t�a�br7s ` @r� _eval_evalfzCurve._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�&�&�&rr>c����|�t|j�St||jd����|j��j�jkr/�jd�|jD��vrt d�jz���t��fd�|jD���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��realc3�$K�|] }|jV�� dSr)�name)r(r"s r� <genexpr>z(Curve.arbitrary_point.<locals>.<genexpr>�s$����@�@��a�f�@�@�@�@�@�@rzFSymbol %s already appears in object and cannot be used as a parameter.c�<��g|]}|�������Sr&r')r(�wr>�tnews ��rr+z)Curve.arbitrary_point.<locals>.<listcomp>�s%���?�?�?�1�q�v�v�a����?�?�?r)r r,rr rF� free_symbolsr)r!r r>rJs @@r�arbitrary_pointzCurve.arbitrary_pointds�����X � ��$�.�)� )��y�$�.�t�<�<�<�� �N�� �I��� � �� �@�@�d�.?�@�@�@�@�@��5�7;�y�A�B�B� B��?�?�?�?�?���?�?�?�@�@rc��t��}|j|jdd�zD] }||jz}� |�|jh��}|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,rrK� differencer )r!�freer?s rrKzCurve.free_symbols�sV��,�u�u����$�+�a�b�b�/�1� #� #�A� �A�N� "�D�D������/�0�0��� rc�6�t|jd��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)rr:�r!s r�ambient_dimensionzCurve.ambient_dimension�s��*�4�9�Q�<� � � rc��|jdS)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:rSs rr,zCurve.functions����2�y��|�rc��|jdS)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 rNrVrSs rrz Curve.limits�rWrc�(�|jddS)amThe 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 rNrrVrSs rr zCurve.parameters��2�y��|�A��rc���tt�fd��jD������}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) c3�T�K�|]"}t|�jd��dzV��#dS)rrN)rr)r(r<r!s �rrGzCurve.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.lengthsC�����V�V�V�V�t�~�V�V�V�V�V�W�W� ���D�K�0�0�0rc�p�t||jd���}|gt|jdd���zS)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 TrCrNN)rr �listr)r!r r>s r� plot_intervalzCurve.plot_interval/s:��B �I�t�~�D� 9� 9� 9���s�T�$�+�a�b�b�/�*�*�*�*rrNc��|rt|d��� }ntdd��}|j|j�}t|j��}|�d��t dd|��}|t|��z}|�|ddd�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��dimrrNrN) r � translater:r`r,�appendr r r<�tolistr)r!�angle�pt�rvr"s r�rotatez Curve.rotateSs���: � ����"�"�"�"�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�%�%rrNc���|rBt|d���}|j| j��||��j|j�S|j\}}|�||z||zf|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)) rrc)r rer:�scaler,r<r)r!�x�yri�fx�fys rrmz 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�3rc�\�|j\}}|�||z||zf|j��S)aLTranslate 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!rnrorprqs rrezCurve.translate�s2��$����B��y�y�"�q�&�"�q�&�)�4�;�7�7�7r)r.)r>)rN)rNrNN)rr)�__name__� __module__� __qualname__�__doc__rr#r-rArL�propertyrKrTr,rr r^rarkrmrer&rrrrss������3�3�jM�M�M�,�,�,�F�F�F�'�'�'�'�5A�5A�5A�5A�n����X��6�!�!��X�!�,����X��4����X��4����X��4� 1� 1��X� 1�"+�"+�"+�"+�H(&�(&�(&�(&�T4�4�4�4�08�8�8�8�8�8rrN)rv�(sympy.functions.elementary.miscellaneousr� sympy.corer�sympy.core.containersr�sympy.core.symbolr�sympy.geometry.entityrr�sympy.geometry.pointr �sympy.integralsr �sympy.matricesr r �sympy.utilities.iterablesr �mpmath.libmp.libmpfrrr&rr�<module>r�s����:�9�9�9�9�9�������'�'�'�'�'�'�%�%�%�%�%�%�=�=�=�=�=�=�=�=�&�&�&�&�&�&�%�%�%�%�%�%�,�,�,�,�,�,�,�,�1�1�1�1�1�1�+�+�+�+�+�+�R8�R8�R8�R8�R8�K�R8�R8�R8�R8�R8r
Memory