� ��g3y��0�ddlmZddlmZddlmZmZddlmZddl m Z ddl m Z ddl mZddlmZdd lmZmZmZmZmZmZdd lmZmZmZmZmZdd lmZdd l m!Z!dd l"m#Z#ddl$m%Z%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.m/Z/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9Z9Gd�de*��Z:dddd�d�Z;d�Z<d�Z=Gd �d!��Z>dDd#�Z?d$�Z@Gd%�d&e>��ZAGd'�d(eA��ZBGd)�d*eA��ZCGd+�d,eA��ZDGd-�d.eD��ZEGd/�d0eA��ZFGd1�d2eD��ZGGd3�d4e>��ZHGd5�d6eH��ZIGd7�d8eH��ZJGd9�d:eI��ZKGd;�d<e>��ZLGd=�d>e>��ZMd?�ZNd@�ZOdEdB�ZPdC�ZQdS)F�)�Callable)�continuous_domain)�Sum�Product)�Tuple)�Expr)�arity)�default_sort_key)�Symbol)�atan2�zeta�frac�ceiling�floor�im)�Equality� GreaterThan�LessThan� Relational�Ne��sympify)� import_module)�BooleanFunction)�_get_free_symbols�extract_solution)�latex)�PythonCodePrinter)� precedence)�Set�Interval�Union)� nsimplify)�sympy_deprecation_warning)�lambdify���intervalNc��eZdZdZd�Zd�ZdS)�IntervalMathPrinterz�A printer to be used inside `plot_implicit` when `adaptive=True`, in which case the interval arithmetic module is going to be used, which requires the following edits. c����t|���d���fd�t|jt���D����S)Nz & c3�D�K�|]}��|���V��dS�N�� parenthesize��.0�a�PREC�selfs ���e/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/plotting/series.py� <genexpr>z1IntervalMathPrinter._print_And.<locals>.<genexpr>#�O�����B�B���+�+�A�t�4�4�B�B�B�B�B�B���key�r�join�sorted�argsr �r4�exprr3s` @r5� _print_AndzIntervalMathPrinter._print_And!�m�����$�����z�z�B�B�B�B�B��� �/?�@�@�@�B�B�B�B�B� Br8c����t|���d���fd�t|jt���D����S)Nz | c3�D�K�|]}��|���V��dSr-r.r0s ��r5r6z0IntervalMathPrinter._print_Or.<locals>.<genexpr>(r7r8r9r;r?s` @r5� _print_OrzIntervalMathPrinter._print_Or&rBr8N)�__name__� __module__� __qualname__�__doc__rArE�r8r5r*r*sD��������B�B�B� B�B�B�B�Br8r*F)�modules�force_real_eval�has_sumc������� �td����fd�� ��� tg���� d���� fd� }�dkr |��S � |g��R�S#t$r}||��cYd}~Sd}~wwxYw)zy Note: this is an experimental function, as such it is prone to changes. Please, do not use it in your code. �numpyc��� t||���S#ttf$rt�j�j��cYSwxYwr-)�complex�ZeroDivisionError� OverflowError�nan)�funcr>�nps �r5� wrapper_funcz#_uniform_eval.<locals>.wrapper_func4sV��� +��4�4��;�'�'� '��!�=�1� +� +� +��2�6�2�6�*�*� *� *� *� +���s��+A�A)�otypesNc�8����Fd}|�|dz }n-|dz }d�t|��j|��t|���|rGt jd�sdn�zd�t|��j|��zdz����g��R�S) Nz6Impossible to evaluate the provided numerical function�.z,because the following exception was raised: z{}: {}�The evaluation with %s failed. � NumPy/SciPy�{}: {} �OTrying to evaluate the expression with Sympy, but it might be a slow operation.)�format�typerF� RuntimeError�warnings�warn)�err�msgr>�f2rKrWs ����r5�_eval_with_sympyz'_uniform_eval.<locals>._eval_with_sympy?s���� �:�J�C��{��s� ����F�F������S� � � 2�C�8�8�8��s�#�#� #� � � �M�2�)0�=�M�M�g�?��!�!�$�s�)�)�"4�c�:�:�;�'�'� � � ��|�B�&��&�&�&�&r8�sympyr-)r� vectorizerQ� Exception) �f1rfrKrLrMr>rgrdrVrWs `` ` @@r5� _uniform_evalrl,s�������� �w� � �B�+�+�+�+�+��<�<� �g�Y�<�?�?�L�'�'�'�'�'�'�'�'�'�&�'�����!�!�!�%��|�B�&��&�&�&�&�� �%�%�%����$�$�$�$�$�$�$�$�����%���s�A� A9�$ A4�.A9�4A9c���td��}||��}t|t��r|js|���}t |��}|jdkr|jS|jS)a(Evaluate f(x) with an adaptive algorithm. Post-process the result. If a symbolic expression is evaluated with SymPy, it might returns another symbolic expression, containing additions, ... Force evaluation to a float. Parameters ========== f : callable x : float rOg:�0�yE>) r� isinstancer� is_Number�evalfrQ�imagrT�real)�f�xrV�ys r5�_adaptive_evalrv[sj�� �w� � �B� ��!���A��!�T����A�K�� �G�G�I�I���� � �A��v��~�~��v� � �6�Mr8c�P�d}|dkrd}n|dkrd}n|dkrd}n|dkrd }|S) Nz%srrzre(%s)rqzim(%s)�abszabs(%s)�argzarg(%s)rJ)�ret�wrappers r5�_get_wrapper_for_exprr|qsJ���G� �f�}�}���� ������� ������� ������ �Nr8c���eZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZdZd�Zd�Zd�Zd�Zd�Zd �Zd �Zd/d �Zd �Zed���Zejd���Zed���Zed���Zd�Zed���Zejd���Zed���Z e jd���Z ed���Z!e!jd���Z!d�Z"ed���Z#e#jd���Z#ed���Z$e$jd���Z$ed���Z%e%jd���Z%e&d0d!���Z'e&d"���Z(d#�Z)d$�Z*d%�Z+d1d'�Z,ed(���Z-e-jd)���Z-ed*���Z.e.jd+���Z.d,�Z/d-�Z0d.S)2� BaseSeriesa�Base class for the data objects containing stuff to be plotted. Notes ===== The backend should check if it supports the data series that is given. (e.g. TextBackend supports only LineOver1DRangeSeries). It is the backend responsibility to know how to use the class of data series that is given. Some data series classes are grouped (using a class attribute like is_2Dline) according to the api they present (based only on convention). The backend is not obliged to use that api (e.g. LineOver1DRangeSeries belongs to the is_2Dline group and presents the get_points method, but the TextBackend does not use the get_points method). BaseSeries F�dc���t|���t|����}|�dd��|_|�dd��|_|�dd��|_|�dd��|_|�dd��|_|�d|�d d����|_ |�d |�d d����|_ d x|_ |_ g|_ t|�d |j����t|�d|j����t|�d|j����g|_|�dd��|�dd��|�dd��g|_|�di��|_t'|jt(��st+d���t-|j��dkrd|_|�di��|_|�dd��|_|�dd��|_|�dd��|_|�dd��|_t;d�|j|j|j|jfD����st+d���g|_g|_|�dd��|_ d|_!d|_"g|_#d|_$d|_%dS)N� only_integersFrK�show_in_legendT�colorbar�use_cm�is_polar�polar�is_point�point��n1�n2�n3�xscale�linear�yscale�zscale�paramsz@`params` must be a dictionary mapping symbols to numeric values.r� rendering_kw�tx�ty�tz�tpc3�<K�|]}t|��p|duV��dSr-��callable�r1�ts r5r6z&BaseSeries.__init__.<locals>.<genexpr>�sA����6�6�!�8�A�;�;�-�1��9�6�6�6�6�6�6r8z)`tx`, `ty`, `tz`, `tp` must be functions.rL)&�_set_discretization_points�copyr`�getr�rKr�r�r�r�r��_label� _latex_label�_ranges�int�_N�_n�_scales�_paramsrn�dict� TypeError�len�is_interactiver��_tx�_ty�_tz�_tp�all� _functions� _signature�_force_real_eval�_discretized_domain�_interactive_ranges�_needs_to_be_int� color_func�_eval_color_func_with_signature)r4r>�kwargss r5�__init__zBaseSeries.__init__�s��+�F�K�K�M�M�4��:�:�F�F��#�Z�Z���?�?����z�z�)�T�2�2�� �%�j�j�)9�4�@�@��� � � �:�t�4�4�� ��j�j��5�1�1�� �� � �:�v�z�z�'�5�/I�/I�J�J�� �� � �:�v�z�z�'�5�/I�/I�J�J�� �*,�,�� �d�'��� � �� � �4���)�)� *� *� �� � �4���)�)� *� *� �� � �4���)�)� *� *� ��� �J�J�x�� *� *� �J�J�x�� *� *� �J�J�x�� *� *� �� ��z�z�(�B�/�/�� ��$�,��-�-� &��%�&�&� &� �t�|� � �q� � �"&�D� �#�J�J�~�r�:�:����:�:�d�D�)�)����:�:�d�D�)�)����:�:�d�D�)�)����:�:�d�D�)�)����6�6� �X�t�x���4�8� 4�6�6�6�6�6� I��G�H�H� H�������!'� � �+<�d� C� C���$(�� �$)�� �!#������05��,�,�,r8c��td�|D����r$tt|��jdz���dS)z�Some data series can be used to plot numerical functions, others cannot. Execute this method inside the `__init__` to prevent the processing of numerical functions. c3�4K�|]}t|��V��dSr-r��r1�es r5r6z5BaseSeries._block_lambda_functions.<locals>.<genexpr>+�(����*�*�q�x��{�{�*�*�*�*�*�*r8z requires a symbolic expression.N)�anyr�r`rF�r4�exprss r5�_block_lambda_functionsz"BaseSeries._block_lambda_functions&sT�� �*�*�E�*�*�*� *� *� ��D��J�J�/�3���� � � r8c����|j|j}}|j|j}}t |d��r|n|g}t d�|D����rdSt |�����|������|���d�|D�����t���dkr]tdd� |�|||fn||f��zd� |��zd � ���zd z���d �|D��}|D]�}t��j d �|d d�D����t �fd�|D����rtdt|��z���t���dkrd|_��|�����}t|��dkrtd|�d�d|zz�����dS)z@ Checks if there are enogh parameters and free symbols. �__iter__c3�4K�|]}t|��V��dSr-r�r�s r5r6z'BaseSeries._check_fs.<locals>.<genexpr>5r�r8Nc��g|] }|d�� S�rrJ�r1�rs r5� <listcomp>z(BaseSeries._check_fs.<locals>.<listcomp>=s��5�5�5���!��5�5�5r8rz(Incompatible expression and parameters. zExpression: {} z params: {} z)Specify what these symbols represent: {} zAre they ranges or parameters?c��g|] }|d�� Sr�rJr�s r5r�z(BaseSeries._check_fs.<locals>.<listcomp>Ks��.�.�.�!��1��.�.�.r8c��g|] }|j�� SrJ)� free_symbolsr�s r5r�z(BaseSeries._check_fs.<locals>.<listcomp>Ms��=�=�=�!�q�~�=�=�=r8r&c3� �K�|]}|�vV�� dSr-rJ)r1r��fss �r5r6z'BaseSeries._check_fs.<locals>.<genexpr>Ns'�����2�2�q�1��7�2�2�2�2�2�2r8zWRange symbols can't be included into minimum and maximum of a range. Received range: %sTz(Unkown symbols found in plotting range: z. z Are the following parameters? %s)r@�rangesr��label�hasattrr�r� difference�keysr�� ValueErrorr_�set�union�strr�) r4r�r�r�r�� range_symbolsr�� remaining_fsr�s @r5� _check_fszBaseSeries._check_fs/s]���� �4�;�v��� �T�Z��� �� �3�3�@���%��� �*�*�E�*�*�*� *� *� � �F��u� %� %�� �]�]�6�;�;�=�=� )� )�� � ����5�5�f�5�5�5�6�6�B� �r�7�7�Q�;�;��;�$�+�+�.4�.@�U�F�E�*�*�u�e�n�V�V�V�!�'�'��/�/�0�?�E�E�b�I�I� J� 3� 3��� �/�.�v�.�.�.� �� G� G�A������=�=�q����u�=�=�=�>�B��2�2�2�2�M�2�2�2�2�2� 3� !�")�+.�q�6�6�"2�3�3�3��2�w�w��{�{�+/��(��=�=������7�7�L��<� � �1�$�$� �j�FG�a�a�I�6��E�F�G�G�G�%� G� Gr8c �p�t|jd��r|jn|jg}td�|D����st|��}t |d����|_g|_|D]N}|j�t|j||j ���t|j|dd���g���On7t d �|j D��d ����|_d �|D��|_t|j t��r(t|j|j ��|_ d|_d Sd S) a�Create the lambda functions to be used by the uniform meshing strategy. Notes ===== The old sympy.plotting used experimental_lambdify. It created one lambda function each time an evaluation was requested. If that failed, it went on to create a different lambda function and evaluated it, and so on. This new module changes strategy: it creates right away the default lambda function as well as the backup one. The reason is that the series could be interactive, hence the numerical function will be evaluated multiple times. So, let's create the functions just once. This approach works fine for the majority of cases, in which the symbolic expression is relatively short, hence the lambdification is fast. If the expression is very long, this approach takes twice the time to create the lambda functions. Be aware of that! r�c3�4K�|]}t|��V��dSr-r�r�s r5r6z1BaseSeries._create_lambda_func.<locals>.<genexpr>ts(����.�.�1�8�A�;�;�.�.�.�.�.�.r8c��|jSr-��name�r�s r5�<lambda>z0BaseSeries._create_lambda_func.<locals>.<lambda>vs��q�v�r8r9)rKrhT)rK�dummifyc��g|] }|d�� Sr�rJr�s r5r�z2BaseSeries._create_lambda_func.<locals>.<listcomp>�s��%@�%@�%@�q�a��d�%@�%@�%@r8c��|jSr-r�r�s r5r�z0BaseSeries._create_lambda_func.<locals>.<lambda>�s ��PQ�PV�r8c��g|]}|df��Sr-rJr�s r5r�z2BaseSeries._create_lambda_func.<locals>.<listcomp>�s��8�8�8�Q��4�y�8�8�8r8N)r�r@r�rr=r�r��appendr%rKr�rnr�rr�)r4r�r�r�s r5�_create_lambda_funczBaseSeries._create_lambda_func^sZ��*%�T�Y� �;�;�L�� � �$�)����.�.��.�.�.�.�.� 9�"�5�)�)�B�$�R�-=�-=�>�>�>�D�O� !�D�O�� � ����&�&��T�_�a���F�F�F��T�_�a��$�O�O�O�(����� �%�%@�%@�D�K�%@�%@�%@�FV�FV�W�W�W�D�O�8�8�%�8�8�8�D�O� �d�o�t� ,� ,� 8�&�t����H�H�D�O�37�D� 0� 0� 0� 8� 8r8c�|�|jst|��St|�|j����S)z�If the value of a plotting range is a symbolic expression, substitute the parameters in order to get a numerical value. )r�rQ�subsr�)r4r�s r5�_update_range_valuezBaseSeries._update_range_value�s7���'� ��1�:�:� ��q�v�v�d�k�*�*�+�+�+r8c���g}g}t|j��D�]:\}}|�|d��|�|d��}|�|d��}|j|jcxkrdkr nn|jn|}|j|jcxkrdkr nn|jn|}|jp|d|jv} t� |||j ||j || ���} |j s| s| j dkr | d|jzz} | r| �t��} |�| ����<|�||��dS)z<Discretize the ranges for uniform meshing strategy. rr&�)�scaler�rQy�?N)� enumerater�r�r�rqrrr�r�r~� _discretize�n�scalesr��dtype�astyper��!_create_discretized_domain_helper) r4� discr_symbols�discretizations�ir��c_start�c_end�start�end�needs_integer_discr�ds r5�_create_discretized_domainz%BaseSeries._create_discretized_domain�s��� � ����d�k�*�*� &� &�D�A�q� � � ��1�� &� &� &��.�.�q��t�4�4�G��,�,�Q�q�T�2�2�E�$+�L�E�J�$C�$C�$C�$C�!�$C�$C�$C�$C�$C�G�L�L��E� '� �� � ?� ?� ?� ?�a� ?� ?� ?� ?� ?�%�*�*�U�C�"&�"4�"W��1���AV�9V� ��&�&�u�c�4�6�!�9��k�!�n�1�'�3�3�A��*� *�5H� *���I�%�%���W�\�)�)��"� "��H�H�S�M�M�� � "� "�1� %� %� %� %� �.�.�}�o�N�N�N�N�Nr8c��td��}d}|js|jr |jrd}|j|d|i�}t t ||����|_dS)z�Create 2D or 3D discretized grids. Subclasses should override this method in order to implement a different behaviour. rO�xy�ij�indexingN)r� is_3Dvector� is_3Dsurface� is_implicit�meshgridr��zipr�)r4r�r�rVr�meshess r5r�z,BaseSeries._create_discretized_domain_helper�sr�� �7� #� #���� � � �� 1� �d�6F� ��H����o�A��A�A��#'��M�6�(B�(B�#C�#C�� � � r8Tc����td����js�����jr�jr�����fd��jD��}����}g}�jD]n}tg|�|�R�}�� �� |��|d��}|� t��}|� |���o|r�fd�|D��}g|�|�S)z�Evaluation of the symbolic expression (or expressions) with the uniform meshing strategy, based on current values of the parameters. rOc�6��g|]}�j|d��Sr�)r�)r1�sr4s �r5r�z(BaseSeries._evaluate.<locals>.<listcomp>�s%���E�E�E�A��)�!�A�$�/�E�E�Er8rc�j��g|]/}��|�t������0SrJ)rrr�rQ)r1r�rVs �r5r�z(BaseSeries._evaluate.<locals>.<listcomp>�s1���?�?�?�A�R�W�W�Q�X�X�g�.�.�/�/�?�?�?r8)rr�r�r�r�r�r��_aggregate_argsrl�_correct_shape�arrayr�rQr�)r4� cast_to_real�discrr>�resultsrsr�rVs` @r5� _evaluatezBaseSeries._evaluate�s/�����7� #� #���� '� � $� $� &� &� &��(� .�T�-E� .� � +� +� -� -� -�E�E�E�E���E�E�E���#�#�%�%������ � �A��(�q�(�4�(�(�(�A��#�#�B�H�H�Q�K�K��q��:�:�A�����!�!�A� �N�N�1� � � � � � @�?�?�?�?��?�?�?�E�!��!��!�!r8c�^�g}|jD]�}||j���vre|�||jvrt |j|��n-|jr |j|nt|j|������|�|j|����|S)ztCreate a list of arguments to be passed to the lambda function, sorted accoring to self._signature. ) r�r�r�r�r�r�r�rQr�)r4r>r s r5rzBaseSeries._aggregate_args�s������� 9� 9�A��D�L�%�%�'�'�'�'�� � �,-��1F�,F�,F�C�� �Q��(�(�(�'+�'<�2�D�L��O�O� ���a��1�1�3�3�3�3� � � �D�4�Q�7�8�8�8�8�� r8c��|jS)z5Return the expression (or expressions) of the series.)�_expr�r4s r5r@zBaseSeries.expr�s ���z�r8c���t|d��}|st|��ntd�|D����}|r |�_dS|st |��nt |��_t ��}�j�tt��D]J}|j dd�D]8}t|dt��r|� |d���9�Kt|���_t t"t$t&t(g}�jdur��fd�|D��}t|���_�jr^�j�#t�jt.��r=d�jvr4d �t1||��D��}t3jd |zd z���jr����dSdS) z2Set the expression (or expressions) of the series.r�c3�4K�|]}t|��V��dSr-r�r�s r5r6z"BaseSeries.expr.<locals>.<genexpr>s(����9Q�9Q�!�(�1�+�+�9Q�9Q�9Q�9Q�9Q�9Qr8r&N�����Tc�D��g|]}�j�|����SrJ)r�has)r1rsr4s �r5r�z#BaseSeries.expr.<locals>.<listcomp>s'���;�;�;�1�T�Z�^�^�A�.�.�;�;�;r8rOc��g|] \}}|�|�� SrJrJ)r1rs�cs r5r�z#BaseSeries.expr.<locals>.<listcomp>s!��C�C�C�4�1�a��C�Q�C�C�Cr8zqNumPy is unable to evaluate with complex numbers some of the functions included in this symbolic expression: %s. z�Hence, the evaluation will use real numbers. If you believe the resulting plot is incorrect, change the evaluation module by setting the `modules` keyword argument.)r�r�r�rrrr��atomsrrr>rnr �add�listr�rrr rr r�rKr�rrbrcr�r�) r4r��is_iter� is_callabler r2�pf� check_res�funcss ` r5r@zBaseSeries.exprs�����!�Z�(�(��)0�Q�h�q�k�k�k�c�9Q�9Q�q�9Q�9Q�9Q�6Q�6Q� � � +��D�J�J�J�+2�A�������q� �D�J����A��Z�%�%�c�7�3�3� %� %��������%�%�A�!�!�B�%��0�0�%����a��e� � � ��%�%)��G�G�D� !��5�%��t�4�B��$�D�0�0�;�;�;�;��;�;�;� �(+�I����%��(� 7�t�|�/C��� �c�2�2�0D�7>�$�,�7N�7N�C�C�3�r�9�+=�+=�C�C�C�E��M�#4�6;�#<�6�#6�7�7�7��� +��(�(�*�*�*�*�*� +� +r8c�H�|j|j|jg}t|��Sr-)� is_3Dlinerrr�)r4�flags3Ds r5�is_3DzBaseSeries.is_3D&s"���>�4�#4�d�6F�G���7�|�|�r8c�<�|j|jg}t|��Sr-)� is_2Dliner)r�)r4� flagsliness r5�is_linezBaseSeries.is_line+s���n�d�n�5� ��:���r8c��t|||��t|��st|t��r||_t||d��dS|� d|_dSdS)z>This method enables back-compatibility with old sympy.plottingN)�setattrr�rnrr�)r4�prop�vals r5�_line_surface_colorzBaseSeries._line_surface_color0sk�� ��d�C� � � � �C�=�=� #�J�s�D�1�1� #�!�D�O� �D�$�� %� %� %� %� %� �_�"�D�O�O�O��_r8c��|jSr-)� _line_colorrs r5� line_colorzBaseSeries.line_color<s ����r8c�2�|�d|��dS)Nr6�r4�r4r3s r5r7zBaseSeries.line_color@s�� � � ���4�4�4�4�4r8c��|jS)zIReturns a list [n1, n2, n3] of numbers of discratization points. )r�rs r5r�z BaseSeries.nDs ���w�r8c��t|d��s ||jd<n||jdt|���<|jr|���dSdS)a�Set the numbers of discretization points. ``v`` must be an int or a list. Let ``s`` be a series. Then: * to set the number of discretization points along the x direction (or first parameter): ``s.n = 10`` * to set the number of discretization points along the x and y directions (or first and second parameters): ``s.n = [10, 15]`` * to set the number of discretization points along the x, y and z directions: ``s.n = [10, 15, 20]`` The following is highly unreccomended, because it prevents the execution of necessary code in order to keep updated data: ``s.n[1] = 15`` r�rN)r�r�r�r�r��r4�vs r5r�z BaseSeries.nJsf��$�q�*�%�%� !��D�G�A�J�J� �D�G�G�S��V�V�G� � � #� .� � +� +� -� -� -� -� -� .� .r8c��|jS)z�Get or set the current parameters dictionary. Parameters ========== p : dict * key: symbol associated to the parameter * val: the numeric value �r�rs r5r�zBaseSeries.paramsds ���|�r8c��||_dSr-r@)r4�ps r5r�zBaseSeries.paramsrs ���� � � r8c���t|jd��r|jn|jg}td�|D����r|jrt d���td�|D����r$|jt |j��krd|_|���t|d��r+|j r&|jr!tj d��d|_ dSdSdSdS) Nr�c3�4K�|]}t|��V��dSr-r�r�s r5r6z(BaseSeries._post_init.<locals>.<genexpr>xr�r8z�`params` was provided, hence an interactive plot is expected. However, interactive plots do not support user-provided numerical functions.c3�4K�|]}t|��V��dSr-r�r�s r5r6z(BaseSeries._post_init.<locals>.<genexpr>�r�r8r��adaptivez�`params` was provided, hence an interactive plot is expected. However, interactive plots do not support adaptive evaluation. Automatically switched to adaptive=False.F) r�r@r�r�r�r�r�r�r�rFrbrcr�s r5� _post_initzBaseSeries._post_initvs��$�T�Y� �;�;�L�� � �$�)��� �*�*�E�*�*�*� *� *� 6�t�{� 6��5�6�6� 6� �*�*�E�*�*�*� *� *� ��{�c�$�)�n�n�,�,��� � ������ �4�� $� $� "��� "�4�;� "� �M�"� #� #� #�"�D�M�M�M�  "� "� "� "� "� "r8c��|jSr-�r�rs r5r�zBaseSeries.scales�� ���|�r8c�z�t|t��r ||jd<dS||jdt|���<dS�Nr)rnr�r�r�r=s r5r�zBaseSeries.scales�s?�� �a�� � � &��D�L��O�O�O�$%�D�L��#�a�&�&�� !� !� !r8c��|jSr-)�_surface_colorrs r5� surface_colorzBaseSeries.surface_color�s ���"�"r8c�2�|�d|��dS)NrNr9r:s r5rOzBaseSeries.surface_color�s�� � � �!1�3�7�7�7�7�7r8c��|jSr-)� _rendering_kwrs r5r�zBaseSeries.rendering_kw�s ���!�!r8c��t|t��r ||_dSi|_|�)tjdt |��zdz��dSdS)NzP`rendering_kw` must be a dictionary, instead an object of type %s was received. z;Automatically setting `rendering_kw` to an empty dictionary)rnr�rRrbrcr`)r4r�s r5r�zBaseSeries.rendering_kw�st�� �f�d� #� #� "�!'�D� � � �!#�D� ��!�� �7�9=�f���F�!�!�"�"�"�"�"�"�!r8r�c���td��}|dur&t|��t|��}}||z dz}|dkr|�|||��S|�|||��S)aXDiscretize a 1D domain. Returns ======= domain : np.ndarray with dtype=float or complex The domain's dtype will be float or complex (depending on the type of start/end) even if only_integers=True. It is left for the downstream code to perform further casting, if necessary. rOTr&r�)rr��linspace� geomspace)r�r��Nr�r�rVs r5r�zBaseSeries._discretize�su���7� #� #�� �D� � ��U���S��X�X�3�E��e� �a��A� �H� � ��;�;�u�c�1�-�-� -��|�|�E�3��*�*�*r8c��td��}t||j��s|�|��}|j|jkr>|jdkr||�|��z}n|�|j��}|S)a)Convert ``a`` to a np.ndarray of the same shape of ``b``. Parameters ========== a : int, float, complex, np.ndarray Usually, this is the result of a numerical evaluation of a symbolic expression. Even if a discretized domain was used to evaluate the function, the result can be a scalar (int, float, complex). Think for example to ``expr = Float(2)`` and ``f = lambdify(x, expr)``. No matter the shape of the numerical array representing x, the result of the evaluation will be a single value. b : np.ndarray It represents the correct shape that ``a`` should have. Returns ======= new_a : np.ndarray An array with the correct shape. rOrJ)rrn�ndarrayr�shape� ones_like�reshape)r2�brVs r5rzBaseSeries._correct_shape�s|��0�7� #� #���!�R�Z�(�(� ����� � �A� �7�a�g� � ��w�"�}�}��� � �Q���'����I�I�a�g�&�&���r8c ��td��}|j�/tjd��|�|d��S|jr�|���}|j|�}|�|��|�|��}}|j ||� |� ||� |������<|St|j��}|dk�rF|jr�|jr}t!|��dkr5|�|�|d��|d��S|�|�|d��|d��S|jr<|jr5|�|�|d��|d��S|jr<|jr5|�|�|d��|d��S|�|�|d��|d��S|dkrf|jr3|jr,|�|j|dd��|d��S|�|j|dd��|d��S|�|j|d|��|d��S)a�Evaluate the color function. Parameters ========== args : tuple Arguments to be passed to the coloring function. Can be coordinates or parameters or both. Notes ===== The backend will request the data series to generate the numerical data. Depending on the data series, either the data series itself or the backend will eventually execute this function to generate the appropriate coloring value. rONz�This is likely not the result you were looking for. Please, re-execute the plot command, this time with the appropriate an appropriate value to line_color or surface_color.rr&r��)rr�rbrcr[r�rrrrqrT�invert�isclose� zeros_liker r-� is_parametricr�rr)r)r4r>rV�color�_re�_im�nargss r5�eval_color_funczBaseSeries.eval_color_func�s���$�7� #� #�� �?� "� �M�$� %� %� %��<�<��Q��(�(� (� � /� ��'�'�)�)�D�#�D�O�T�*�E��w�w�u�~�~�r�w�w�u�~�~��C�BD�&�C�� � �"�*�*�S�"�-�-��*<�*<�=�=�>�>� ?��J��d�o�&�&�� �A�:�:��~� N�$�"4� N��t�9�9��>�>��.�.�t���t�A�w�/G�/G��a��Q�Q�Q��*�*�4�?�?�4��7�+C�+C�T�!�W�M�M�M��� N�D�$6� N��*�*�4�?�?�4��7�+C�+C�T�!�W�M�M�M��"� N�t�'9� N��*�*�4�?�?�4��7�+C�+C�T�!�W�M�M�M��&�&�t���t�A�w�'?�'?��a��I�I� I� �a�Z�Z�� � P�T�%7� P��*�*�?�4�?�D����H�+E�t�A�w�O�O�O��&�&��t���R�a�R��'A�4��7�K�K� K��"�"�?�4�?�D��%��L�#A�4��7�K�K�Kr8c��t�)z�Compute and returns the numerical data. The number of parameters returned by this method depends on the specific instance. If ``s`` is the series, make sure to read ``help(s.get_data)`` to understand what it returns. )�NotImplementedErrorrs r5�get_datazBaseSeries.get_data*s ��"�!r8c� �||zS)z�Given a latex representation of an expression, wrap it inside some characters. Matplotlib needs "$%s%$", K3D-Jupyter needs "%s". rJ)r4r�r{s r5�_get_wrapped_labelzBaseSeries._get_wrapped_label3s�����r8�$%s$c��|dur|jS|jt|j��kr|�|j|��S|jS�a�Return the label to be used to display the expression. Parameters ========== use_latex : bool If False, the string representation of the expression is returned. If True, the latex representation is returned. wrapper : str The backend might need the latex representation to be wrapped by some characters. Default to ``"$%s$"``. Returns ======= label : str F)r�r�r@rmr��r4� use_latexr{s r5� get_labelzBaseSeries.get_label9sP�� �� � ��;� � �;�#�d�i�.�.� (� (��*�*�4�+<�g�F�F� F�� � r8c�*�|���Sr-)rsrs r5r�zBaseSeries.labelQs���~�~���r8c�"�|x|_|_dS)z)Set the labels associated to this series.N)r�r�r:s r5r�zBaseSeries.labelUs��+.�-�� �d�'�'�'r8c��|jSr-)r�rs r5r�zBaseSeries.ranges_rJr8c�~�g}|D]0}|�,|�td�|D�������1||_dS)Nc�,�g|]}t|����SrJrr�s r5r�z%BaseSeries.ranges.<locals>.<listcomp>hs��&=�&=�&=�a�w�q�z�z�&=�&=�&=r8)r��tupler�)r4r3�new_valsr>s r5r�zBaseSeries.rangescsR����� @� @�A��}�����&=�&=�1�&=�&=�&=� >� >�?�?�?���� � � r8c ��d�}d\}}}t|��dkr'|\}}|||j��|||j��fSt|��dkrMt|t��r8|\}}}|||j��|||j��|||j��fSt|��dkr8|\}}}|||j��|||j��|||j��fSt|��dkr^t|t��rI|\}}}}|||j��|||j��|||j��|||j��fSt|��dkrI|\}}}}|||j��|||j��|||j��|||j��fSt|��dkrQt|t��r<|\}}}}}|||j��|||j��|||j��||fSt|��dkrr|j rk|\}}}}}}|||j��|||j��|||j��|||j��|||j��|||j��fSt|��dkr |\}}} } } } |||| |j��| | | fS|S)a'Apply transformations to the results of numerical evaluation. Parameters ========== args : tuple Results of numerical evaluation. Returns ======= transformed_args : tuple Tuple containing the transformed results. c� �|�|n ||��Sr-rJ�rt� transforms r5r�z-BaseSeries._apply_transform.<locals>.<lambda>xs��i�&7���Y�Y�q�\�\�r8)NNNr�r_���) r�r�r�rn�Parametric2DLineSeriesr�r��Parametric3DLineSeries�ParametricSurfaceSeriesr) r4r>r�rtru�z�ur>�w�_abs�_arg�img�colorss r5�_apply_transformzBaseSeries._apply_transformks��� J� I��"���1�a� �t�9�9��>�>��D�A�q��1�Q���>�>�1�1�Q���>�>�1� 1��$�i�i�1�n�n�*�T�3I�"J�"J�n��G�A�q�!��A�a���N�N�A�A�a���N�N�A�A�a���N�N�C� C� ��Y�Y�!�^�^��G�A�q�!��1�Q���>�>�1�1�Q���>�>�1�1�Q���>�>�A� A��$�i�i�1�n�n�*�T�3I�"J�"J�n��J�A�q�!�Q��A�a���N�N�A�A�a���N�N�A�A�a���N�N�A�A�a���N�N�S� S� ��Y�Y�!�^�^��J�A�q�!�Q���!�T�X�����!�T�X�����!�T�X�����!�T�X���� ��$�i�i�1�n�n�*�T�3J�"K�"K�n� �M�A�q�!�Q���A�a���N�N�A�A�a���N�N�A�A�a���N�N�A�q�I� I��$�i�i�1�n�n�$�"2�n�#� �A�q�!�Q��1���!�T�X�����!�T�X�����!�T�X�����!�T�X�����!�T�X�����!�T�X���� ���Y�Y�!�^�^�,0� )�A�q�$��c�6��1�a�a��d�h�'�'��s�F�<� <�� r8c��d\}}|jr8d}dtt|j�������z}||z|zS)N)r�r�� interactive � and parameters )r�r�ryr�r�)r4r �pre�posts r5� _str_helperzBaseSeries._str_helper�sR��� ��T� � � G� �C�%��E�$�+�2B�2B�2D�2D�,E�,E�(F�(F�F�D��Q�w��~�r8N)T)r�F�Frn)1rFrGrHrIr-r)r� is_contourrr�rc� is_generic� is_vector� is_2Dvectorrr�r�r�r�r�r�r�r�rr�propertyr@�setterr+r/r4r7r�r�rGr�rOr�� staticmethodr�rrhrkrmrsr�r�r�r�rJr8r5r~r~~s���������.�I� �I� �L� �J� �K��N��M� �J��I��K��K� �B�\5�\5�\5�|���-G�-G�-G�^,8�,8�,8�\,�,�,�O�O�O�BD�D�D�."�"�"�"�@ � � �����X�� �[�#+�#+��[�#+�J����X������X�� #� #� #�� � ��X� ���5�5���5�����X�� �X�.�.��X�.�2� � ��X� � �]����]��"�"�"�.����X�� �]�&�&��]�&� �#�#��X�#���8�8���8��"�"��X�"��� "� "��� "��+�+�+��\�+�*� � ��\� �D>L�>L�>L�@"�"�"���� !�!�!�!�0� � ��X� � �\�.�.��\�.�����X�� �]� � ��]� �.�.�.�`����r8r~�{�G�z�?c��td��}|���}|jdz |z }tt |��dz ��D]o} || dz|| z } t || dz|| z ��} |�| | z ��} t | ��|kr |j|| dz<�p||fS)a<Compute the steepness of each segment. If it's greater than a threshold, set the right-point y-value non NaN and record the corresponding x-location for further processing. Returns ======= x : np.ndarray Unchanged x-data. yy : np.ndarray Modified y-data with NaN values. rOr�r&)rr��pi�ranger�rx�arctanrT) rtru�epsr@�symb�symbolicrV�yy� thresholdr��dx�dy�angles r5�_detect_poles_numerical_helperr��s��� �w� � �B� �����B���� �C��I� �3�q�6�6�A�:� � ���� �q�1�u�X��!��_�� ��1�q�5��A�a�D�� !� !��� � �"�r�'�"�"�� �u�:�:�� "� "���B�q�1�u�I�� �b�5�Lr8c��g}tt|��t|����}t|||��}|���}||krn�t |t ��r�t d�|jD����rkg}|jD]D}|jr|� |j ��|j r|� |j ���Ett|����}ntd|�d����|S)z�Attempts to compute symbolic discontinuities. Returns ======= pole : list List of symbolic poles, possibily empty. c3�@K�|]}t|t��V��dSr-)rnr!r�s r5r6z0_detect_poles_symbolic_helper.<locals>.<genexpr>�s,���� 6� 6��J�q�(� #� #� 6� 6� 6� 6� 6� 6r8z&Could not parse the following object: zJ . Please, submit this as a bug. Consider also to set `detect_poles=True`.)r!r#r�simplifyrnr"r�r>� left_openr��left� right_open�rightr"r�r�)r@r�r�r��polesr(�resr s r5�_detect_poles_symbolic_helperr��s�� �E�� �%�(�(�)�C�.�.�9�9�H� �D�$�� 1� 1�C� �,�,�.�.�C� �h��� � �S�%� � � � � 6� 6�S�X� 6� 6� 6�6�6� ����� &� &�A��{� %�� � �Q�V�$�$�$��|� &�� � �Q�W�%�%�%���S��Z�Z� � ���� #�S� #� #� #� � � � �Lr8c���eZdZdZdZdZdZ�fd�Zd�Zd�Z d�Z e d ���Z e d ���Z e d ���Ze d ���Zejd ���Zd�Z�xZS)�Line2DBaseSeriesz�A base class for 2D lines. - adding the label, steps and only_integers options - making is_2Dline true - defining get_segments and get_color_array Tr�i�c �@��t��jdi|��|�dd��|_|�d|�dd����|_|�d|�dd����|_|�dd��|_|�d d ��|_|�d d��|_|�d d��|_ |�d d��|_ |�dd��|_ |�dd��|_ |�d|�dd����|_ |�dd��|_g|_|�dg��}t!|t"��rt%t'|d�����}t)|d��s|g}d�|D��}t+|��|_dS)N�stepsFr�r�� is_filled�fillTrF�depth� r�r�r7� detect_polesr�r�r�r��unwrap�excluder�r�r�c�,�g|]}t|����SrJ��floatr�s r5r�z-Line2DBaseSeries.__init__.<locals>.<listcomp>�s��-�-�-��5��8�8�-�-�-r8rJ)�superr�r�r�r�r�rFr�r�r�r7r�r�r�r��poles_locationsrnr r"rr�r=r�)r4r�r�� __class__s �r5r�zLine2DBaseSeries.__init__�s���������"�"�6�"�"�"��Z�Z���/�/�� �� � �:�v�z�z�'�5�/I�/I�J�J�� ����K����F�D�1I�1I�J�J���� � �:�u�5�5�� ��Z�Z���,�,�� ��j�j��5�1�1�� � �*�*�\�4�8�8��� �*�*�\�4�8�8���"�J�J�~�u�=�=����:�:�e�T�*�*���� � �:�v�z�z�'�5�/I�/I�J�J�� ��j�j��5�1�1�� � "����*�*�Y��+�+�� �g�s� #� #� =��+�G�s�;�;�;�<�<�G��w� �+�+� ��i�G�-�-�W�-�-�-���g���� � � r8c� �td��}|���}t|t��r�|jdkr�t |j�|j��g|j d�R�}|� d�|D����}d�}||� |��|j ��|_ |j |�}|jra|jrZt|��dkr#|\}}t!|||j��\}}||f}n$|\}}}t!|||j��\}}|||f}|jr]i}|jdur|j}|jrDt|��dkr|\}}|j|fi|��}||f}n|\}}}|j|fi|��}|||f}|jdu�r3|jr�|d|d}}|� ||f��j���dd �}|� ||f��j���d d �}|jr |||df}n�||f}n�|jr�|�|dd ��dd �}|�|dd ��d d �}|�|dd ��dd �} t|��d kr ||| |d f}n||| f}t|j��dkr|�|��}|S) aReturn coordinates for plotting the line. Returns ======= x: np.ndarray x-coordinates y: np.ndarray y-coordinates z: np.ndarray (optional) z-coordinates in case of Parametric3DLineSeries, Parametric3DLineInteractiveSeries param : np.ndarray (optional) The parameter in case of Parametric2DLineSeries, Parametric3DLineSeries or AbsArgLineSeries (and their corresponding interactive series). rOr�rc�,�g|]}t|����SrJr�r�s r5r�z-Line2DBaseSeries.get_data.<locals>.<listcomp>s��6�6�6�1�e�A�h�h�6�6�6r8c� �|�|n ||��Sr-rJr}s r5r�z+Line2DBaseSeries.get_data.<locals>.<lambda>s��)�*;�Q�Q���1���r8r�Tr&Nrr_�����)r�_get_data_helperrn�LineOver1DRangeSeriesr�r�r@r�r�r�rr�r�r�r-r�r�r�r�r��T�flattenrcr)�repeatr��_insert_exclusions) r4rV�pointsr�r�rtrurB�kwr�s r5rkzLine2DBaseSeries.get_datas]��*�7� #� #���&�&�(�(�� �t�2� 3� 3� @� � �*� ,� ,�1�� ���t�{�+�+�>�.2�k�!�n�>�>�>�E��H�H�6�6��6�6�6�7�7�E�M�M�A�#$�1�R�X�X�e�_�_�d�h�#?�#?�D� �'��&��/�� �>� #�d�/� #��6�{�{�a������1�5��q�$�(�$�$���1��Q���� ���1�a�5�a��D�H�E�E���1��Q���� �;� '��B��{�$�&�&��[���~� '��v�;�;�!�#�#�!�D�A�q�!�� �!�*�*�r�*�*�A���V�F�F�$�G�A�q�!�!�� �!�*�*�r�*�*�A���A�Y�F� �:�� � ��~� '��a�y�&��)�1���H�H�a��V�$�$�&�.�.�0�0����4���H�H�a��V�$�$�&�.�.�0�0��"��5���%�$���F�1�I�.�F�F���V�F�F��� '��I�I�f�Q�i��+�+�A�B�B�/���I�I�f�Q�i��+�+�C�R�C�0���I�I�f�Q�i��+�+�A�b�D�1���v�;�;��?�?���A�v�a�y�1�F�F���A�Y�F� �t�|� � �q� � ��,�,�V�4�4�F�� r8c�V�tddd���td��}t|���|��}|j�|��j�dd|j��}|j� |dd�|dd�gd���S) Nz� The Line2DBaseSeries.get_segments() method is deprecated. Instead, use the MatplotlibBackend.get_segments() method, or use The get_points() or get_data() methods. z1.9zdeprecated-get-segments)�deprecated_since_version�active_deprecations_targetrOrr&)�axis) r$rr`rk�marr�r\�_dim� concatenate)r4rVr�s r5� get_segmentszLine2DBaseSeries.get_segmentsTs���!� � &+�'@� B� B� B� B��7� #� #���d���$�$�T�*�*������V�$�$�&�.�.�r�1�d�i�@�@���u� � �&��"��+�v�a�b�b�z�!:�� �C�C�Cr8c �<�td��}t|��}t|��}|dz }|dkrd}tt t |�����|g����}d�|jD��}|jD�]�}|||z dk}t|���rht|���rW|� |��} | dz} | dk�r6| t||��dz k�rt|||| z ��} t|||| dzz ��} t| | ��dz } || z } || z}|� ||d| �| ||g||| dzd�f��||<d}|D]{}|||�| |g����}|dz }|� ||d| �|d|j|dg||| dzd�f��||<�|���|S)apAdd NaN to each of the exclusion point. Practically, this adds a NaN to the exlusion point, plus two other nearby points evaluated with the numerical functions associated to this data series. These nearby points are important when the number of discretization points is low, or the scale is logarithm. NOTE: it would be easier to just add exclusion points to the discretized domain before evaluation, then after evaluation add NaN to the exclusion points. But that's only work with adaptive=False. The following approach work even with adaptive=True. rOr&r�rc��g|] }|d�� Sr�rJ)r1rss r5r�z7Line2DBaseSeries._insert_exclusions.<locals>.<listcomp>{s��/�/�/�!��1��/�/�/r8rN)rr"r�r=r�r�r�r�r�r�� nanargmaxrx�minr�rrT)r4r�rVr��k� j_indecesr'r�r��idx� delta_prev� delta_post�delta�prevr�r�j�valuess r5r�z#Line2DBaseSeries._insert_exclusionsdsJ���7� #� #���f���� ��K�K�� ��E�� ��6�6��A��3�u�Q�x�x�=�=�3�3�Q�C�8�8�9�9� �/�/�t��/�/�/���� b� b�A���)�a�-�1�$�C��3�x�x� b�C���I�I� b��l�l�3�'�'���q�����7�7�s�S����^�^�a�%7�7�7�!$�Q����3��%7�!8�!8�J�!$�Q����3��7�);�%;�!<�!<�J�� �J�7�7�#�=�E��u�9�D��u�9�D�!#������4�C�4��4��D�/�6�!�9�S��U�V�V�;L�M�!O�!O�F�1�I��A�&�b�b��!)��q��"�(�(�D�$�<�*@�*@�!A�!A���Q���$&�N�N�#�A�Y�t��t�_�v�a�y�"�&�&��)�.L�f�UV�i�X[�\]�X]�X^�X^�N_�`�%b�%b��q� � ��� r8c�:�|jsdn|jddSrL�r�rs r5�varzLine2DBaseSeries.var�s���;�=�t�t�D�K��N�1�,=�=r8c��|jsdS |�|jdd��S#t$r|jddcYSwxYw�Nrr&�r��_castr�rs r5r�zLine2DBaseSeries.start��e���{� ��4� %��:�:�d�k�!�n�Q�/�0�0� 0��� %� %� %��;�q�>�!�$� $� $� $� %�����%1�A�Ac��|jsdS |�|jdd��S#t$r|jddcYSwxYw�Nrr�r�rs r5r�zLine2DBaseSeries.end�r�r�c��|jdSrLrIrs r5r�zLine2DBaseSeries.xscale�s���|�A��r8c��||_dSr-)r�r=s r5r�zLine2DBaseSeries.xscale�� ���� � � r8c��td��}|j}t|d��r�|�|��}t |��}|dkr3|jr,|���}|t|����Sttt|� ������}|dkr||d��S|dkr ||dd��S||�S||� |j ��zS)NrO�__call__r&rr�) rr7r�rir rc�get_parameter_points�centers_of_segmentsr"�map� get_points�ones� nb_of_points)r4rVrrsrgrt� variabless r5�get_color_arrayz Line2DBaseSeries.get_color_array�s��� �7� #� #�� �O�� �1�j� !� !� 0�� � �Q���A��!�H�H�E���z�z�d�0�z��-�-�/�/���q�,�Q�/�/�0�0�0� ��%8�$�/�/�:K�:K�!L�!L�M�M� ��A�:�:��1�Y�q�\�?�?�*��a�Z�Z��1�i����m�,�,��1�i�=�(��R�W�W�T�.�/�/�/� /r8)rFrGrHrIr-r�r�r�rkr�r�r�r�r�r�r�r�r�� __classcell__�r�s@r5r�r��s ����������I� �D� �B�'�'�'�'�'�2P�P�P�dD�D�D� 4�4�4�l�>�>��X�>��%�%��X�%��%�%��X�%�����X�� �]����]��0�0�0�0�0�0�0r8r�c�6��eZdZdZd�fd� Zd�Zd�Zd�Z�xZS)� List2DSeriesz7Representation for a line consisting of list of points.r�c ����t��jdi|��td���t|��t|��krRt d�t|����d�t|����z���|�||��d�}t||��||��z��s|jr3|jst d���t|�|_ t|�|_ nB�� |�j ���|_ �� |�j ���|_ |j |j f|_t�fd�|j |j fD����s|���|�d|�d d ����|_||_|�d i��|_|jrG|jrBd |_t/|jt0��r#t3d |jjzdz���dSdSdS)NrOz_The two lists of coordinates must have the same number of elements. Received: len(list_x) = {} zand len(list_y) = {}c��d�|D��S)Nc�H�g|]}t|t��o|j �� SrJ)rnr� is_numberr�s r5r�z;List2DSeries.__init__.<locals>.<lambda>.<locals>.<listcomp>�s+��P�P�P��:�a��.�.�D�� �O�P�P�Pr8rJ)�ls r5r�z'List2DSeries.__init__.<locals>.<lambda>�s��P�P�a�P�P�P�r8z�Some or all elements of the provided lists are symbolic expressions, but the ``params`` dictionary was not provided: those elements can't be evaluated.�r�c3�B�K�|]}t|�j��V��dSr-)rnrY�r1r�rVs �r5r6z(List2DSeries.__init__.<locals>.<genexpr>�s/�����Q�Q��:�a���,�,�Q�Q�Q�Q�Q�Qr8r�r�Fr�Tz%s don't support symbolic zexpression for `color_func`.rJ)r�r�rr�r�r_r�r�r�r�list_x�list_yr�float64rr�r�r�r�r�r�r�rcrnrr�r�rF)r4r r r�r��checkrVr�s @�r5r�zList2DSeries.__init__�sM���������"�"�6�"�"�"� �7� #� #�� �v�;�;�#�f�+�+� %� %��.�.4�f�S��[�[�.A�.A�&�-�-�c�&�k�k�:�:�;��� � �$�$�V�V�4�4�4�P�P�� �u�u�V�}�}�u�u�V�}�}�,� -� -� =��� =��;� L� �"K�L�L�L� ��.�D�K���.�D�K�K��(�(�6���(�<�<�D�K��(�(�6���(�<�<�D�K��k�4�;�/�� ��Q�Q�Q�Q�t�{�D�K�6P�Q�Q�Q�Q�Q� � �N�N� � � �� � �:�v�z�z�'�5�/I�/I�J�J�� ��� �"�J�J�~�r�:�:��� �;� 4�4�?� 4�!%�D� ��$�/�4�0�0� 4��0�4�>�3J�J�2�3�4�4�4� 4� 4� 4� 4� 4� 4r8c��dS)Nz 2D list plotrJrs r5�__str__zList2DSeries.__str__�s���~r8c�D���j�j}}�js��||��St d��}|��fd�|D��t ���}|��fd�|D��t ���}��||��S)�3Returns coordinates that needs to be postprocessed.rOc�F��g|]}|��j�����S�)r��rpr��r1r�r4s �r5r�z1List2DSeries._get_data_helper.<locals>.<listcomp>��)���=�=�=�Q�q�w�w�D�K�w�0�0�=�=�=r8rc�F��g|]}|��j�����Srrrs �r5r�z1List2DSeries._get_data_helper.<locals>.<listcomp>rr8)r r r��_eval_color_func_and_returnrrr�)r4�lx�lyrVs` r5r�zList2DSeries._get_data_helper�s������d�k�B���"� <��3�3�B��;�;� ;� �7� #� #�� �X�X�=�=�=�=�"�=�=�=�U�X� K� K�� �X�X�=�=�=�=�"�=�=�=�U�X� K� K���/�/��B�7�7�7r8c�X�|jr"t|j��rg|�|j|��S|Sr-)r�r�r�rh�r4�datas r5rz(List2DSeries._eval_color_func_and_returns=�� �;� 8�8�D�O�4�4� 8�7�T�7�/�4�/��6�7� 7�� r8�r�) rFrGrHrIr�rr�rr�r�s@r5rr�sq�������A�A�"4�"4�"4�"4�"4�"4�H��� 8� 8� 8�������r8rc�~��eZdZdZd �fd� Zed���Zejd���Zd�Zd�Z d�Z d �Z d �Z d �Z �xZS) r�zHRepresentation for a line consisting of a SymPy expression over a range.r�c ���t��jd i|��t|��r|nt|��|_|�t |j��n||_|�t|j��n||_|g|_ t|_ |� dd��|_ |���|jsad�|j ddd�D��\}}t!|��t!|��krt#d|jjzdz���|jr$|j rt+jd��d|_dSdSdS) N�returnc�,�g|]}t|����SrJ)rQr�s r5r�z2LineOver1DRangeSeries.__init__.<locals>.<listcomp>s��A�A�A��'�!�*�*�A�A�Ar8rr&z%s requires the imaginary z=part of the start and end values of the range to be the same.zjThe adaptive algorithm is unable to deal with complex numbers. Automatically switching to uniform meshing.FrJ)r�r�r�rr@r�r�rr�r�rQr�r��_returnrGr�rr�r�rFrFrbrc)r4r@� var_start_endr�r�r�r�r�s �r5r�zLineOver1DRangeSeries.__init__ sj��������"�"�6�"�"�"�$�T�N�N�=�D�D��� � �� �(-� �c�$�)�n�n�n�5�� �05� �E�$�)�,�,�,�5���$�o�� ��� ��z�z�(�D�1�1�� � �������'� '�B�A�d�k�!�n�Q�R�R�.@�A�A�A�J�E�3��%�y�y�B�s�G�G�#�#� �0�4�>�3J�J�&�&�'�'�'� �=� "�T�\� "� �M�O� P� P� P�!�D�M�M�M� "� "� "� "r8c��|jdSrLr�rs r5r�z"LineOver1DRangeSeries.nb_of_points'����v�a�y�r8c��||_dSr-r�r=s r5r�z"LineOver1DRangeSeries.nb_of_points+� ������r8c �p�d�}|jrdnd}d}|jr6dtt|j�������z}t |j��}|d||jz�dt|j���dt||j ��||j ��f����z|zS)Nc�X�t|t��r|jdkr|S|jS|SrL)rnrQrqrrr�s r5rsz(LineOver1DRangeSeries.__str__.<locals>.f0s0���!�W�%�%� ��6�Q�;�;��H��v� ��Hr8r�r�r�zcartesian line: � for � over ) r�r�ryr�r�r|r#r@r�r�r�)r4rsr�r�r{s r5rzLineOver1DRangeSeries.__str__/s��� � � � !%� 3�;�n�n����� � � G�%��E�$�+�2B�2B�2D�2D�,E�,E�(F�(F�F�D�'�� �5�5���s� �d�i� � � � ���M�M�M�M� ���4�:�����$�(� � �,� -� -� -� � � � � r8c�*�|���S)a�Return lists of coordinates for plotting. Depending on the ``adaptive`` option, this function will either use an adaptive algorithm or it will uniformly sample the expression over the provided range. This function is available for back-compatibility purposes. Consider using ``get_data()`` instead. Returns ======= x : list List of x-coordinates y : list List of y-coordinates �r�rs r5r�z LineOver1DRangeSeries.get_pointsAs�� �$�$�&�&�&r8c ��� t|j��r|j}n!t|jg|j|j��}|�|��\}}n�#t $r�}tjd|jsdn|jzd� t|��j |��zdz��t|jg|jd��}|�|��\}}Yd}~nd}~wwxYw||fS�Nr[r\r]r^rh) r�r@r%r�rK�_adaptive_sampling_helperrjrbrcr_r`rF)r4rsrtrurds r5�_adaptive_samplingz(LineOver1DRangeSeries._adaptive_samplingSs�� 5��� �"�"� B��I����d�h�Z���D�L�A�A���1�1�!�4�4�D�A�q�q��� 5� 5� 5� �M�2�)-��G�M�M�4�<�I��!�!�$�s�)�)�"4�c�:�:�;�'�'� � � ��$�(��T�Y��8�8�A��1�1�!�4�4�D�A�q�q�q�q�q�q����� 5�����!�t� s�AA� C1�"BC,�,C1c��������td���g�g�������fd��t��jj��}t��jj��}���jj����|������jj|g�����jj|g��d����fS)aZThe adaptive sampling is done by recursively checking if three points are almost collinear. If they are not collinear, then more points are added between those points. References ========== .. [1] Adaptive polygonal approximation of parametric curves, Luiz Henrique de Figueiredo. rOc�v��d� j���dzz}� jdkrZd� �|d��|� �|d��� �|d��z zzz}n|d||d|dz zz}t � |��}� �||g��}|� jkr8��|d����|d��dS|dkr"� |||dz��� |||dz��dS|d��|d�� jdkr$� �|d|dd��}n#� � |d|dd��}tt� |����}td �|D����sgtt|��dz ��D]I} || � || dz�2� || || g|| dz|| dzg|dz���HdSdS|d�!|d�|d�t|||��s"� |||dz��� |||dz��dS��|d����|d��dS) �� Samples recursively if three points are almost collinear. For depth < 6, points are added irrespective of whether they satisfy the collinearity condition or not. The maximum depth allowed is 12. ��������?皙�����?�log� rr&r�Nc3�K�|]}|duV�� dSr-rJ)r1rus r5r6zRLineOver1DRangeSeries._adaptive_sampling_helper.<locals>.sample.<locals>.<genexpr>�s&����5�5��1��9�5�5�5�5�5�5r8)�random�randr��log10rvrr�r��logspacerUr"r�r�r�r��flat)rB�qr�r;�xnew�ynew� new_point�xarray�yarrayr�rsrV�sampler4�x_coords�y_coordss ������r5rFz?LineOver1DRangeSeries._adaptive_sampling_helper.<locals>.sampleus����B�I�N�N�,�,�s�2�2�F��{�e�#�#��B�H�H�Q�q�T�N�N�V�r�x�x��!��~�~�8:����1����8G�.H�H�I�����t�f��!��q��t� �4�4��!�!�T�*�*�D����$���.�.�I��t�z�!�!�����!��%�%�%�����!��%�%�%�%�%�������q�)�U�Q�Y�/�/�/���y�!�U�Q�Y�/�/�/�/�/� �1���!�A�$�,��;�%�'�'��[�[��1��q��t�R�8�8�F�F��[�[��1��q��t�R�8�8�F��c�!�V�n�n�-�-���5�5�f�5�5�5�5�5�K�"�3�v�;�;��?�3�3�K�K�� &�q� � 1�f�Q��U�m�6K�"�F�F�1�I�v�a�y�#9�!'��A����q�1�u� � >��� �K�K�K��K�K�K�K��A�$�,�!�A�$�,�)�A�,�2F���9�a�0�0�3G���q�)�U�Q�Y�/�/�/���y�!�U�Q�Y�/�/�/�/�/�����!��%�%�%�����!��%�%�%�%�%r8r)rrvr�rrr�r�r)r4rs�f_start�f_endrVrFrGrHs`` @@@@r5r1z/LineOver1DRangeSeries._adaptive_sampling_helperfs����������7� #� #������2 &�2 &�2 &�2 &�2 &�2 &�2 &�2 &�2 &�2 &�h!��D�J�O�4�4���q�$�(�-�0�0������ ��(�(�(����� � � ���r�x�x����'�2�3�3����$�(�-��/�0�0�!� 5� 5� 5��(�#�#r8c��td��}|���\}}|�|��|�|��}}|�||��}|�||��}|||fS�NrO)rrrrrqr)r4rVrt�resultrerfs r5�_uniform_samplingz'LineOver1DRangeSeries._uniform_sampling�su�� �7� #� #���N�N�$�$� ��6��7�7�6�?�?�B�G�G�F�O�O�S���!�!�#�q�)�)���!�!�#�q�)�)���#�s�{�r8c �V��td���|jr.|js'|���\}}�fd�||fD��S|���\}}}|j�E�j|����|�� |������<n}|jdkrnq|jdkr|}nc|jdkr�� |dz|dzz��}n9|jdkr�� ||��}ntd |jz���||fS) z<Returns coordinates that needs to be postprocessed. rOc�:��g|]}��|����SrJ�rr s �r5r�z:LineOver1DRangeSeries._get_data_helper.<locals>.<listcomp>�s#���0�0�0�A�B�H�H�Q�K�K�0�0�0r8Nrrrqrxr�ryz&`_return` not recognized. Received: %s) rrFr�r2rNr#rTr`rarb�sqrt�arctan2r�)r4rtrurerfrVs @r5r�z&LineOver1DRangeSeries._get_data_helper�sO����7� #� #�� �=� 1�$�"4� 1��*�*�,�,�D�A�q�0�0�0�0�!�Q��0�0�0� 0��,�,�.�.� ��3�� �<� �CE�&�C�� � �"�*�*�S�"�-�-��*<�*<�=�=�>�>� ?� ?� �\�V� #� #� � �\�V� #� #��C�C� �\�U� "� "��'�'�#�q�&�3��6�/�*�*�C�C� �\�U� "� "��*�*�S�#�&�&�C�C���!%��.�/�/� /��#�v� r8r)rFrGrHrIr�r�r�r�rr�r2r1rNr�r�r�s@r5r�r� s��������R�R�"�"�"�"�"�"�6����X������������$'�'�'�$���&J$�J$�J$�X���������r8r�c�n�eZdZdZd�Zd d�Zd�Zd�Zd�Zd �Z e d ���Z e j d ���Z d S)�ParametricLineBaseSeriesTc���|�t|j��n||_|�t|j��n||_|jdurO|jt|j��kr2t|j��|_t|j��|_td�|jD����r-|js(|jt|j��kr d|_dSdSdSdS)aULogic to set the correct label to be shown on the plot. If `use_cm=True` there will be a colorbar, so we show the parameter. If `use_cm=False`, there might be a legend, so we show the expressions. Parameters ========== label : str label passed in by the pre-processor or the user NFc3�4K�|]}t|��V��dSr-r�r�s r5r6zFParametricLineBaseSeries._set_parametric_line_label.<locals>.<genexpr>�s(����.�.�q�x��{�{�.�.�.�.�.�.r8r�)r�r�r�rr�r�r@r�)r4r�s r5�_set_parametric_line_labelz3ParametricLineBaseSeries._set_parametric_line_label�s���(-�}�c�$�(�m�m�m�%�� �/4�}�E�$�(�O�O�O�%��� �K�5� � �t�{�c�$�(�m�m�'C�'C��d�i�.�.�D�K� %�d�i� 0� 0�D� � �.�.�D�I�.�.�.� .� .� !�� � !��{�c�$�)�n�n�,�,� �� � � � !� !� !� !�,�,r8Frnc�d�|jrbt|j��|jkr>|r(|�t |j��|��St|j��S|jS|r?|jt|j��kr|jS|�|j|��S|jSr-)r�r�r�r�rmrr@r�rqs r5rsz"ParametricLineBaseSeries.get_label�s��� �;� ��4�8�}�}�� �+�+��M��2�2�5���?�?�G�L�L�L��4�8�}�}�$��;� � � G��{�c�$�)�n�n�,�,��(�(��*�*�4�+<�g�F�F� F��{�r8c����|jr2td���|���}�fd�|D��}n|���}|jr[|jrTtd���|\}}}��|dz|dzz��}��||��}|||dg}t|j ��rt|��}|j |�|d<|S)z�Returns coordinates that needs to be postprocessed. Depending on the `adaptive` option, this function will either use an adaptive algorithm or it will uniformly sample the expression over the provided range. rOc�:��g|]}��|����SrJrQr s �r5r�z=ParametricLineBaseSeries._get_data_helper.<locals>.<listcomp> s#���2�2�2�a�b�h�h�q�k�k�2�2�2r8r�r) rFrr2rNr-r�rRrSr�r�r"rh)r4�coordsrtru�_r�r�rVs @r5r�z)ParametricLineBaseSeries._get_data_helpers���� �=� .��w�'�'�B��,�,�.�.�F�2�2�2�2�6�2�2�2�F�F��+�+�-�-�F� �>� (�d�m� (��w�'�'�B��G�A�q�!�����1��q�!�t� �$�$�A�� � �1�a� � �A���F�2�J�'�F� �D�O� $� $� 7��&�\�\�F�-��-�v�6�F�2�J�� r8c ��td��}|���}t|��D]x\}}|�|��|�|��}}|j||�|�||�|������<|||<�yg|dd��|d�S)rrOr&Nr) rrr�rrrqrTr`rarb)r4rVrr�r�rerfs r5rNz*ParametricLineBaseSeries._uniform_samplings��� �7� #� #���.�.�"�"���g�&�&� � �D�A�q��w�w�q�z�z�2�7�7�1�:�:��C�BD�&�C�� � �"�*�*�S�"�-�-��*<�*<�=�=�>�>� ?��G�A�J�J�)������)�g�a�j�)�)r8c�6�|���dS)Nr�rkrs r5r�z-ParametricLineBaseSeries.get_parameter_points)s���}�}���r�"�"r8c�:�|���dd�S)aJ Return lists of coordinates for plotting. Depending on the ``adaptive`` option, this function will either use an adaptive algorithm or it will uniformly sample the expression over the provided range. This function is available for back-compatibility purposes. Consider using ``get_data()`` instead. Returns ======= x : list List of x-coordinates y : list List of y-coordinates z : list List of z-coordinates, only for 3D parametric line plot. Nrr.rs r5r�z#ParametricLineBaseSeries.get_points,s��"�$�$�&�&�s��s�+�+r8c��|jdSrLr�rs r5r�z%ParametricLineBaseSeries.nb_of_points?r&r8c��||_dSr-r�r=s r5r�z%ParametricLineBaseSeries.nb_of_pointsCr(r8Nr�) rFrGrHrcrXrsr�rNr�r�r�r�r�rJr8r5rUrU�s��������M�!�!�!�,����"���6 *� *� *�#�#�#�,�,�,�&����X����������r8rUc�:��eZdZdZdZd�fd� Zd�Zd�Zd�Z�xZ S) r�zZRepresentation for a line consisting of two parametric SymPy expressions over a range.Tr�c ���t��jdi|��t|��r|nt|��|_t|��r|nt|��|_|j|jf|_|g|_t|_ |� dd��|_ |� |��|� ��dS)Nr�TrJ)r�r�r�r�expr_x�expr_yr@r�r�r�r�r�rXrG)r4rfrgr$r�r�r�s �r5r�zParametric2DLineSeries.__init__Ns���������"�"�6�"�"�"� (�� 0� 0�E�f�f�g�f�o�o�� � (�� 0� 0�E�f�f�g�f�o�o�� ��[�$�+�.�� �$�o�� ��� ��j�j��4�0�0�� � �'�'��.�.�.� �������r8c ���|�dt|j���dt|j���dt|j���dt|j|jf������S)Nzparametric cartesian line: (�, �) for r,)r�r�rfrgr�r�r�rs r5rzParametric2DLineSeries.__str__Ysn������ �� � � � � � �� � � � � � ���M�M�M�M� ���T�X�&� '� '� '�  � � � r8c �� t|j��r#t|j��r|j}|j}n6t|jg|j��}t|jg|j��}|�||��\}}}n�#t $r�}tjd|j sdn|j zd� t|��j |��zdz��t|jg|jd��}t|jg|jd��}|�||��\}}}Yd}~nd}~wwxYw|||fSr0) r�rfrgr%r�r1rjrbrcrKr_r`rF)r4�f_x�f_yrtrurBrds r5r2z)Parametric2DLineSeries._adaptive_samplingbsZ�� ?��� �$�$� 8��$�+�)>�)>� 8��k���k������z�4�;�7�7�����z�4�;�7�7���4�4�S�#�>�>�G�A�q�!�!��� ?� ?� ?� �M�2�)-��G�M�M�4�<�I��!�!�$�s�)�)�"4�c�:�:�;�'�'� � � ��D�H�:�t�{�G�<�<�C��D�H�:�t�{�G�<�<�C��4�4�S�#�>�>�G�A�q�!�!�!�!�!�!����� ?�����!�Q�w�s�BB � E�B#D<�<Ec����� � � � �g� g� g� ��� � �� � fd�� t��j��}t��j��}||g}t��j��}t��j��}||g}� �|��� �|��� ��j��� �j�j||d��� � � fS)aWThe adaptive sampling is done by recursively checking if three points are almost collinear. If they are not collinear, then more points are added between those points. References ========== .. [1] Adaptive polygonal approximation of parametric curves, Luiz Henrique de Figueiredo. c �H��td��}d|j���dzz}||||z zz}t�|��}t�|��} |�|| g��} |�jkrM��|d����|d����|��dS|dkr&�|||| |dz���||| ||dz��dS|d�|d�|d��|d��|�||d��} �fd �| D��} �fd �| D��} td �t| | ��D����s�tt| ��dz ��D]n}| |�| |�| |dz�O| |dz�D| || |g}| |dz| |dzg}�| || ||||dz���mdSdS|d�)|d�!|d�|d�t|| |��s&�|||| |dz���||| ||dz��dS��|d����|d����|��dS) r5rOr6r7rr&r�Nr9c�0��g|]}t�|����SrJ�rv)r1r�rls �r5r�zTParametric2DLineSeries._adaptive_sampling_helper.<locals>.sample.<locals>.<listcomp>��#���G�G�G�a�>�#�q�1�1�G�G�Gr8c�0��g|]}t�|����SrJrq)r1r�rms �r5r�zTParametric2DLineSeries._adaptive_sampling_helper.<locals>.sample.<locals>.<listcomp>�rrr8c3�,K�|]\}}|duo|duV��dSr-rJ)r1rtrus r5r6zSParametric2DLineSeries._adaptive_sampling_helper.<locals>.sample.<locals>.<genexpr>�sG����>�>�#�q�!���9�2��d��>�>�>�>�>�>r8) rr;r<rvrr�r�rUr�rr�r�r?)�param_p�param_qrBr@r�rVr;� param_newrArBrC� param_array�x_array�y_arrayr��point_a�point_brlrm�paramrFr4rGrHs �������r5rFz@Parametric2DLineSeries._adaptive_sampling_helper.<locals>.sample�s)����w�'�'�B��B�I�N�N�,�,�s�2�2�F��&�G�g�,=�">�>�I�!�#�y�1�1�D�!�#�y�1�1�D����$���.�.�I��t�z�!�!�����!��%�%�%�����!��%�%�%�� � �W�%�%�%�%�%�������w� �1�i����C�C�C���y�'�9�a����C�C�C�C�C� �Q�4�<�A�a�D�L��q�T�\�a��d�l� �k�k�'�7�B�?�?� �G�G�G�G�;�G�G�G��G�G�G�G�;�G�G�G���>�>�'*�7�G�'<�'<�>�>�>�>�>�7�"�3�w�<�<�!�#3�4�4�7�7��$�Q�Z�3��� �8N�!(��Q���!;���A���@Z�'.�q�z�7�1�:�&>�G�'.�q�1�u�~�w�q�1�u�~�&F�G�"�F�;�q�>�;�q�>�7�#*�E�A�I�7�7�7��7�7�7�7��A�$�,�!�A�$�,���t�|�q��t�|���9�a�0�0�(4���w� �1�i����C�C�C���y�'�9�a����C�C�C�C�C�����!��%�%�%�����!��%�%�%�� � �W�%�%�%�%�%r8r)rvr�r�r�) r4rlrm� f_start_x� f_start_yr��f_end_x�f_end_yr�r}rFrGrHs ``` @@@@r5r1z0Parametric2DLineSeries._adaptive_sampling_helperxs ���������������6 &�6 &�6 &�6 &�6 &�6 &�6 &�6 &�6 &�6 &�6 &�p#�3�� �3�3� �"�3�� �3�3� ��I�&�� ��d�h�/�/�� ��d�h�/�/���� ����� �"�"�"���� �"�"�"� � � �T�Z� � � ���t�z�4�8�U�C��3�3�3���5�(�(r8r) rFrGrHrIr-r�rr2r1r�r�s@r5r�r�Hs�����������I� � � � � � � � � ����,R)�R)�R)�R)�R)�R)�R)r8r�c�.��eZdZdZdZdZdZ�fd�Z�xZS)�Line3DBaseSerieszSA base class for 3D lines. Most of the stuff is derived from Line2DBaseSeries.FTr_c�H��t�����dSr-)r�r�)r4r�s �r5r�zLine3DBaseSeries.__init__�s��� ���������r8) rFrGrHrIr-r)r�r�r�r�s@r5r�r��sS�������;�;��I��I� �D���������r8r�c�<��eZdZdZdZdZd�fd� Zd�Z�fd�Z�xZ S) r�z^Representation for a 3D line consisting of three parametric SymPy expressions and a range.FTr�c �2��t��jdi|��t|��r|nt|��|_t|��r|nt|��|_t|��r|nt|��|_|j|j|jf|_|g|_t|_ d|_ |� dd��|_ |�|��|���d|_d|_d|_dS)NFr�TrJ)r�r�r�rrfrg�expr_zr@r�r�r�rFr�r�rXrG�_xlim�_ylim�_zlim)r4rfrgr�r$r�r�r�s �r5r�zParametric3DLineSeries.__init__�s���������"�"�6�"�"�"� (�� 0� 0�E�f�f�g�f�o�o�� � (�� 0� 0�E�f�f�g�f�o�o�� � (�� 0� 0�E�f�f�g�f�o�o�� ��[�$�+�t�{�;�� �$�o�� ��� ��� ��j�j��4�0�0�� � �'�'��.�.�.� �������� ��� ��� � � r8c� �|�dt|j���dt|j���dt|j���dt|j���dt|j|jf���� ��S)Nz3D parametric cartesian line: (rirjr,)r�r�rfrgr�r�r�r�rs r5rzParametric3DLineSeries.__str__�s������� �� � � � � � �� � � � � � �� � � � � � ���M�M�M�M� ���T�X�&� '� '� '�  � � � r8c���td��}t�����\}}}}|�|��|�|��f|_|�|��|�|��f|_|�|��|�|��f|_||||fSrL)rr�rk�amin�amaxr�r�r�)r4rVrtrur�rBr�s �r5rkzParametric3DLineSeries.get_data�s���� �7� #� #���W�W�%�%�'�'� ��1�a���g�g�a�j�j�"�'�'�!�*�*�-�� ��g�g�a�j�j�"�'�'�!�*�*�-�� ��g�g�a�j�j�"�'�'�!�*�*�-�� ��!�Q��z�r8r) rFrGrHrIr-r)r�rrkr�r�s@r5r�r��s{������� � ��I��I�������" � � ���������r8r�c�2��eZdZdZdZ�fd�Zd�Zd�Z�xZS)�SurfaceBaseSerieszA base class for 3D surfaces.Tc���t��jdi|��|�dd��|_|�d|�dd����|_|�dd��|_|�dd���|_t|j��r|j|_d|_dSdS) Nr�Fr�r�rOr�c��|Sr-rJ)rtrur�s r5r�z,SurfaceBaseSeries.__init__.<locals>.<lambda>s��1�r8rJ)r�r�r�r�r�rOr�r��r4r>r�r�s �r5r�zSurfaceBaseSeries.__init__ s���������"�"�6�"�"�"��j�j��5�1�1�� �� � �:�v�z�z�'�5�/I�/I�J�J�� �#�Z�Z���>�>��� �*�*�\�3D�3D�E�E��� �D�&� '� '� &�"�0�D�O�!%�D� � � � &� &r8c�<�|j}|�t|��n||_|�t|��n||_t |d��st |��ntd�|D����}|r(|jt|��krd|_d|_dSdSdS)Nr�c3�4K�|]}t|��V��dSr-r�r�s r5r6z7SurfaceBaseSeries._set_surface_label.<locals>.<genexpr>&s(����0�0�Q�X�a�[�[�0�0�0�0�0�0r8r�)r@r�r�rr�r�r�r�)r4r�r�� is_lambdas r5�_set_surface_labelz$SurfaceBaseSeries._set_surface_labels���� ��$)�M�c�%�j�j�j�u�� �,1�M�E�%�L�L�L�u���-4�E�:�,F�,F�1�X�e�_�_�_��0�0�%�0�0�0�0�0� � � '�$�+��U���3�3� �� �$&��!�!�!� '� '�3�3r8c� �td��}|j}t|t��r�|�|��}t |��}|jrVttt|� ������}|dkr||d��S|dkr||�Sttt|� ������}|dkr||d��S|dkr ||dd��S||�St|t��r0||� t|j|j����zS||� t|j|j����zS)NrOr&rr�)rrOrnrrir rcr"r��centers_of_faces�get_parameter_meshes� get_meshes�SurfaceOver2DRangeSeriesr�r��nb_of_points_x�nb_of_points_y�nb_of_points_u�nb_of_points_v)r4rVrrsrgr�s r5r�z!SurfaceBaseSeries.get_color_array+sl�� �7� #� #�� � �� �a�� "� "� P�� � �Q���A��!�H�H�E��!� )� ��%5�t�7P�7P�7R�7R�!S�!S�T�T� ��A�:�:��1�Y�q�\�?�?�*��a�Z�Z��1�i�=�(��S�!1�4�?�?�3D�3D�E�E�F�F�I���z�z��q��1����&��!����q�)�B�Q�B�-�(�(��q�)�}�$��$� 8�9�9� P������T�%8�$�:M�!N�!N�O�O�O�O������T�%8�$�:M�!N�!N�O�O�O�Or8) rFrGrHrIrr�r�r�r�r�s@r5r�r�sh�������'�'��L�&�&�&�&�&�" '� '� '�P�P�P�P�P�P�Pr8r�c�&��eZdZdZd�fd� Zed���Zed���Zed���Zed���Z ed���Z ed ���Z ed ���Z e j d ���Z ed ���Zej d ���Zd�Zd�Zd�Z�xZS)r�zRRepresentation for a 3D surface consisting of a SymPy expression and 2D range.r�c �4��t��jdi|��t|��r|nt|��|_||g|_|�|��|���|j|j f|_ |j |j f|_ dS)NrJ)r�r�r�rr@r�r�rG�start_x�end_xr��start_y�end_yr�)r4r@�var_start_end_x�var_start_end_yr�r�r�s �r5r�z!SurfaceOver2DRangeSeries.__init__Is���������"�"�6�"�"�"�$�T�N�N�=�D�D��� � �� �&��8�� � ����&�&�&� �������l�D�J�/�� ��l�D�J�/�� � � r8c�(�|jddSrLr�rs r5�var_xzSurfaceOver2DRangeSeries.var_xS����{�1�~�a� � r8c�(�|jddS�Nr&rr�rs r5�var_yzSurfaceOver2DRangeSeries.var_yWr�r8c�� t|jdd��S#t$r|jddcYSwxYwr��r�r�r�rs r5r�z SurfaceOver2DRangeSeries.start_x[�R�� %����Q���*�+�+� +��� %� %� %��;�q�>�!�$� $� $� $� %�����"�A�Ac�� t|jdd��S#t$r|jddcYSwxYwr�r�rs r5r�zSurfaceOver2DRangeSeries.end_xbr�r�c�� t|jdd��S#t$r|jddcYSwxYw�Nr&r�rs r5r�z SurfaceOver2DRangeSeries.start_yir�r�c�� t|jdd��S#t$r|jddcYSwxYw�Nr&r�r�rs r5r�zSurfaceOver2DRangeSeries.end_ypr�r�c��|jdSrLr�rs r5r�z'SurfaceOver2DRangeSeries.nb_of_points_xwr&r8c�6�|j}||dd�g|_dSr�r��r4r>r�s r5r�z'SurfaceOver2DRangeSeries.nb_of_points_x{� �� �F���Q�q�r�r�U�����r8c��|jdSr�r�rs r5r�z'SurfaceOver2DRangeSeries.nb_of_points_y�r&r8c�@�|j}|d||dg|_dSr�r�r�s r5r�z'SurfaceOver2DRangeSeries.nb_of_points_y��"�� �F���A�$��1�Q�4�����r8c�6�|jrdnd}|�|dt|j���dt|j���dt|j|jf���dt|j���dt|j|j f���� z��S)Nzcartesian surface�contourz: r+r,� and ) rr�r�r@r�r�r�r�r�r�)r4� series_types r5rz SurfaceOver2DRangeSeries.__str__�s���-1�->�M�)�)�I� ���� �K� �� �N�N�N�N� �� �O�O�O�O�S�$�,�� �!;�<�<�<�<� �� �O�O�O�O�S�$�,�� �!;�<�<�<� � � � � r8c�*�|���S)��Return the x,y,z coordinates for plotting the surface. This function is available for back-compatibility purposes. Consider using ``get_data()`` instead. r`rs r5r�z#SurfaceOver2DRangeSeries.get_meshes�s�� �}�}���r8c ��td��}|���}t|��D]x\}}|�|��|�|��}}|j||�|�||�|������<|||<�y|\}}} |j rK|j rD|� ��}||� |��z}||� |��z}|�| ��|�| ��f|_|�||| ��S)aReturn arrays of coordinates for plotting. Returns ======= mesh_x : np.ndarray Discretized x-domain. mesh_y : np.ndarray Discretized y-domain. mesh_z : np.ndarray Results of the evaluation. rO)rrr�rrrqrTr`rarbr�rr��cos�sinr�r�r�r�� r4rVrr�r�rerfrtrur�s r5rkz!SurfaceOver2DRangeSeries.get_data�s!���7� #� #���.�.�"�"���g�&�&� � �D�A�q��w�w�q�z�z�2�7�7�1�:�:��C�BD�&�C�� � �"�*�*�S�"�-�-��*<�*<�=�=�>�>� ?��G�A�J�J����1�a� �=� �T�.� ������A��B�F�F�1�I�I� �A��B�F�F�1�I�I� �A��g�g�a�j�j�"�'�'�!�*�*�-�� ��$�$�Q��1�-�-�-r8r)rFrGrHrIr�r�r�r�r�r�r�r�r�r�r�rr�rkr�r�s@r5r�r�Es����������0�0�0�0�0�0��!�!��X�!��!�!��X�!��%�%��X�%� �%�%��X�%� �%�%��X�%� �%�%��X�%� ����X�������������X����!�!���!� � � ����.�.�.�.�.�.�.r8r�c�2��eZdZdZdZ d�fd� Zed���Zed���Zed���Z ed���Z ed ���Z ed ���Z ed ���Z e jd ���Z ed ���Zejd���Zd�Zd�Zd�Zd�Z�xZS)r�zaRepresentation for a 3D surface consisting of three parametric SymPy expressions and a range.Tr�c ����t��jdi|��t|��r|nt|��|_t|��r|nt|��|_t|��r|nt|��|_|j|j|jf|_||g|_|� dd���|_ |� |��|� ��dS)Nr�c��|Sr-rJ)rtrur�r�r>s r5r�z2ParametricSurfaceSeries.__init__.<locals>.<lambda>�s���r8rJ) r�r�r�rrfrgr�r@r�r�r�r�rG) r4rfrgr��var_start_end_u�var_start_end_vr�r�r�s �r5r�z ParametricSurfaceSeries.__init__�s���������"�"�6�"�"�"� (�� 0� 0�E�f�f�g�f�o�o�� � (�� 0� 0�E�f�f�g�f�o�o�� � (�� 0� 0�E�f�f�g�f�o�o�� ��[�$�+�t�{�;�� �&��8�� � �*�*�\�3J�3J�K�K��� ����&�&�&� �������r8c�(�|jddSrLr�rs r5�var_uzParametricSurfaceSeries.var_u�r�r8c�(�|jddSr�r�rs r5�var_vzParametricSurfaceSeries.var_v�r�r8c�� t|jdd��S#t$r|jddcYSwxYwr�r�rs r5�start_uzParametricSurfaceSeries.start_u�r�r�c�� t|jdd��S#t$r|jddcYSwxYwr�r�rs r5�end_uzParametricSurfaceSeries.end_u�r�r�c�� t|jdd��S#t$r|jddcYSwxYwr�r�rs r5�start_vzParametricSurfaceSeries.start_v�r�r�c�� t|jdd��S#t$r|jddcYSwxYwr�r�rs r5�end_vzParametricSurfaceSeries.end_v�r�r�c��|jdSrLr�rs r5r�z&ParametricSurfaceSeries.nb_of_points_u�r&r8c�6�|j}||dd�g|_dSr�r�r�s r5r�z&ParametricSurfaceSeries.nb_of_points_u�r�r8c��|jdSr�r�rs r5r�z&ParametricSurfaceSeries.nb_of_points_v�r&r8c�@�|j}|d||dg|_dSr�r�r�s r5r�z&ParametricSurfaceSeries.nb_of_points_v�r�r8c�n�|�dt|j���dt|j���dt|j���dt|j���dt|j|jf���dt|j���dt|j |j f������S)Nzparametric cartesian surface: (rirjr,r�) r�r�rfrgr�r�r�r�r�r�r�rs r5rzParametricSurfaceSeries.__str__s������� �� � � � � �c�$�+�.�.�.�.��D�K�0@�0@�0@�0@� �� �O�O�O�O�S�$�,�� �!;�<�<�<�<� �� �O�O�O�O�S�$�,�� �!;�<�<�<�  � � � r8c�:�|���dd�S)Nr_r`rs r5r�z,ParametricSurfaceSeries.get_parameter_meshes s���}�}���q�r�r�"�"r8c�:�|���dd�S)r�Nr_r`rs r5r�z"ParametricSurfaceSeries.get_meshess�� �}�}���r��r�"�"r8c ���td��}|���}t|��D]x\}}|�|��|�|��}}|j||�|�||�|������<|||<�y|dd�\}}} |� |��|� |��f|_ |� |��|� |��f|_ |� | ��|� | ��f|_ |jg|dd��|dd��R�S)a�Return arrays of coordinates for plotting. Returns ======= x : np.ndarray [n2 x n1] x-coordinates. y : np.ndarray [n2 x n1] y-coordinates. z : np.ndarray [n2 x n1] z-coordinates. mesh_u : np.ndarray [n2 x n1] Discretized u range. mesh_v : np.ndarray [n2 x n1] Discretized v range. rOr�N)rrr�rrrqrTr`rarbr�r�r�r�r�r�r�s r5rkz ParametricSurfaceSeries.get_datas8�� �7� #� #���.�.�"�"���g�&�&� � �D�A�q��w�w�q�z�z�2�7�7�1�:�:��C�BD�&�C�� � �"�*�*�S�"�-�-��*<�*<�=�=�>�>� ?��G�A�J�J��!�"�"�+���1�a��g�g�a�j�j�"�'�'�!�*�*�-�� ��g�g�a�j�j�"�'�'�!�*�*�-�� ��g�g�a�j�j�"�'�'�!�*�*�-�� �$�t�$�@�g�a�b�b�k�@�G�B�Q�B�K�@�@�@�@r8r)rFrGrHrIrcr�r�r�r�r�r�r�r�r�r�r�rr�r�rkr�r�s@r5r�r��s�������� � ��M�13� � � � � � ��!�!��X�!��!�!��X�!��%�%��X�%� �%�%��X�%� �%�%��X�%� �%�%��X�%� ����X�������������X����!�!���!� � � �#�#�#�#�#�#�A�A�A�A�A�A�Ar8r�c�*��eZdZdZdZdZ�fd�Z�xZS)� ContourSeriesz"Representation for a contour plot.FTc�,��t��j|i|��|�d|�dd����|_|�dd��|_|�d|�di����|_dS)Nr�r�T�clabels� contour_kwr�)r�r�r�r�� show_clabelsr�r�s �r5r�zContourSeries.__init__>s���������$�)�&�)�)�)����K����F�D�1I�1I�J�J���"�J�J�y�$�7�7��� #�J�J�|� �J�J�~�r� *� *�,�,����r8)rFrGrHrIrr�r�r�r�s@r5r�r�8sH�������,�,��L��J� ,� ,� ,� ,� ,� ,� ,� ,� ,r8r�c�"�eZdZdZdZd�Zd�ZdS)�GenericDataSeriesalRepresents generic numerical data. Notes ===== This class serves the purpose of back-compatibility with the "markers, annotations, fill, rectangles" keyword arguments that represent user-provided numerical data. In particular, it solves the problem of combining together two or more plot-objects with the ``extend`` or ``append`` methods: user-provided numerical data is also taken into consideration because it is stored in this series class. Also note that the current implementation is far from optimal, as each keyword argument is stored into an attribute in the ``Plot`` class, which requires a hard-coded if-statement in the ``MatplotlibBackend`` class. The implementation suggests that it is ok to add attributes and if-statements to provide more and more functionalities for user-provided numerical data (e.g. adding horizontal lines, or vertical lines, or bar plots, etc). However, in doing so one would reinvent the wheel: plotting libraries (like Matplotlib) already implements the necessary API. Instead of adding more keyword arguments and attributes, users interested in adding custom numerical data to a plot should retrieve the figure created by this plotting module. For example, this code: .. plot:: :context: close-figs :include-source: True from sympy import Symbol, plot, cos x = Symbol("x") p = plot(cos(x), markers=[{"args": [[0, 1, 2], [0, 1, -1], "*"]}]) Becomes: .. plot:: :context: close-figs :include-source: True p = plot(cos(x), backend="matplotlib") fig, ax = p._backend.fig, p._backend.ax[0] ax.plot([0, 1, 2], [0, 1, -1], "*") fig Which is far better in terms of readibility. Also, it gives access to the full plotting library capabilities, without the need to reinvent the wheel. Tc�0�||_||_||_dSr-)r`r>r�)r4r�r>r�s r5r�zGenericDataSeries.__init__{s���� ��� �"����r8c��|jSr-)r>rs r5rkzGenericDataSeries.get_data�s ���y�r8N)rFrGrHrIr�r�rkrJr8r5r�r�JsD������-�-�\�J�#�#�#� ����r8r�c����eZdZdZdZdZdZd�fd� Zed���Z e j d���Z ed ���Z e j d ���Z e Z d �Z d �Zd �Zd�Zd�Zd�Zed���Zdd�Z�xZS)�ImplicitSeriesz$Representation for 2D Implicit plot.TFrr�c ���t��jd i|��|�dd��|_||_|�t |��n||_|�t|��n||_||g|_ |j d\|_ |_ |_ |j d\|_ |_|_|�d|�dd����|_|jr|jrt%d���|�dd��}|d krd }n|dkrd}d |z|_|���dS) NrFFrr&rdr7z7Interactive plot with `adaptive=True` is not supported.r�rrJ)r�r�r�rFr@r�r�rr�r�r�r�r�r�r�r��_colorr�rjr�rG)r4r@r�r�r�r�r�r�s �r5r�zImplicitSeries.__init__�sE��������"�"�6�"�"�"�� � �:�u�5�5�� ��� �#(�=�c�$�i�i�i�e�� �+0�=�E�$�K�K�K�e���&��8�� �/3�{�1�~�,�� �D�L�$�*�/3�{�1�~�,�� �D�L�$�*��j�j��&�*�*�\�4�*H�*H�I�I�� � � � %�4�=� %�%�'$�%�%� %�� � �7�A�&�&�� �1�9�9��E�E� �Q�Y�Y��E���Y�� � �������r8c�,�|jr|jS|jSr-)rF�_adaptive_expr�_non_adaptive_exprrs r5r@zImplicitSeries.expr�s�� �=� '��&� &��&�&r8c�H�|�|��|�t|����\}}||_||_t |��|_t|��|_t|ttf��rD|j s=d|_ d}t|t��rd}tjd|zdzdz��t|t��rd|_d|_dS|�||j ��\}}||_||_dS)NTzcontains Boolean functions. zis an unequality. zThe provided expression z/In order to plot the expression, the algorithm z/automatically switched to an adaptive sampling.F)r�� _has_equalityrr�� has_equalityr�r�rr�rnrrrFrbrcr�� _is_equality�_preprocess_meshgrid_expression)r4r@r�re� is_equalitys r5r@zImplicitSeries.expr�s.�� �$�$�T�*�*�*�!�/�/��� � �>�>���l�"���(����$�i�i�� �!�$�K�K��� �d�_�b�1� 2� 2� �D�M� � �D�M�0�C��$��#�#� +�*�� �M�*�S�0�C�D�C�D� � � � �d�O� ,� ,� ,�&*�D� #� %�D� � � �!%� D� D�T�4�=� Y� Y� �D�+�&*�D� #� +�D� � � r8c��|jSr-�r�rs r5r7zImplicitSeries.line_color�s ���{�r8c��||_dSr-r�r=s r5r7zImplicitSeries.line_color�r�r8c�2���d}��fd��g�t|t��r'�|��td��D����rd}nLt|t��st |d��}d}n$t|tt t f��rd}||fS)NFc���|jD]M}t|t��r �|���#t|t��r��|���NdS)z8Recursively expands the arguments of an Boolean FunctionN)r>rnrrr�)� bool_exprry� arg_expand�arg_lists ��r5r�z0ImplicitSeries._has_equality.<locals>.arg_expand�sd��� �~� )� )���c�?�3�3�)��J�s�O�O�O�O���Z�0�0�)��O�O�C�(�(�(��  )� )r8c3�ZK�|]&}t|tttf��V��'dSr-)rnrrrr�s r5r6z/ImplicitSeries._has_equality.<locals>.<genexpr>�s3����V�V��:�a�(�K��!B�C�C�V�V�V�V�V�Vr8Tr)rnrr�rrrr)r4r@r�r�rs @@r5r�zImplicitSeries._has_equality�s������ � )� )� )� )� )� )��� �d�O� ,� ,� � �J�t� � � ��V�V�X�V�V�V�V�V� $�#� ���D�*�-�-� ��D�!�$�$�D��L�L� ��x��h�?� @� @� ��L��\�!�!r8c �Z�d�}|�d��t|j��t|j��t||j��||j��f��t|j��t||j��||j��f��fzS)Nc�T�t|j��dkrt|��n|SrL)r�r�r�r�s r5r�z(ImplicitSeries.__str__.<locals>.<lambda>�s$��#�a�n�"5�"5��":�":�e�A�h�h�h��r8z5Implicit expression: %s for %s over %s and %s over %s) r�r�r�r�r�r�r�r�r�)r4rss r5rzImplicitSeries.__str__�s��� A� A����� C�E�E� ��#� $� $� �� �O�O� ���4�<���!�!�D�J�-�-�0� 1� 1� �� �O�O� ���4�<���!�!�D�J�-�-�0� 1� 1� H � � r8c�h�|jr|���}|�|S|���S)a�Returns numerical data. Returns ======= If the series is evaluated with the `adaptive=True` it returns: interval_list : list List of bounding rectangular intervals to be postprocessed and eventually used with Matplotlib's ``fill`` command. dummy : str A string containing ``"fill"``. Otherwise, it returns 2D numpy arrays to be used with Matplotlib's ``contour`` or ``contourf`` commands: x_array : np.ndarray y_array : np.ndarray z_array : np.ndarray plot_type : str A string specifying which plot command to use, ``"contour"`` or ``"contourf"``. )rFrv�_get_meshes_gridrs r5rkzImplicitSeries.get_data�s<��0 �=� ��&�&�(�(�D���� ��$�$�&�&�&r8c� � �ddlmcmcm� i}t ddd|d���}d�t � ��D��}� fd�|D��}t t||����}t|j |j f|j |g|���}d} |� |��}n^#t$r+}tjd |zd z��d|_Yd}~n.d}~wt"$rtjd ��d|_YnwxYw|S) aN References ========== .. [1] Jeffrey Allen Tupper. Reliable Two-Dimensional Graphing Methods for Mathematical Formulae with Two Free Variables. .. [2] Jeffrey Allen Tupper. Graphing Equations with Generalized Interval Arithmetic. Master's thesis. University of Toronto, 1996 rNFT)�fully_qualified_modules�inline�allow_unknown_functions�user_functionsc�"�g|] }d|v�|dv� |�� S)�__)rr(rJr�s r5r�z1ImplicitSeries._adaptive_eval.<locals>.<listcomp>* s+��c�c�c�a�t�1�}�}�1�Da�;a�;a��;a�;a�;ar8c�0��g|]}t�|����SrJ)�getattr)r1r��lis �r5r�z1ImplicitSeries._adaptive_eval.<locals>.<listcomp>+ s!���-�-�-�1���A���-�-�-r8)rK�printerz�Adaptive meshing could not be applied to the expression, as some functions are not yet implemented in the interval math module: NameError: %s z Proceeding with uniform meshing.zOAdaptive meshing could not be applied to the expression. Using uniform meshing.)�(sympy.plotting.intervalmath.lib_interval�plotting� intervalmath� lib_intervalr*�dirr�rr%r�r�r@�_get_raster_interval� NameErrorrbrcrFr�) r4r rr��valsr�rUrrdrs @r5rvzImplicitSeries._adaptive_eval s}��� >�=�=�=�=�=�=�=�=�=�=�=���%�',��'+�,�'.�'.�/�/�� d�c�3�r�7�7�c�c�c��-�-�-�-��-�-�-�� ��T�4��� !� !�����T�Z�0�$�)�a�S�RY�Z�Z�Z���� "��,�,�T�2�2�D�D��� "� "� "� �M�$�'*�*�3� 3� � � �"�D�M�M�M�M�M�M������ "� "� "� �M�6� 7� 7� 7�"�D�M�M�M�  "���� � s�B&�& D�0!C�(D�Dc� ���td��}|j}g}d�|j|jfD��\}}d�|j|jfD��\}}|�||d��} |�||d��} |j�t| ����dzdz ||z zdz } |j�t| ����dzdz ||z zdz } | | z } | | z } d�t| d d �| dd ���D��} d �t| d d �| dd ���D����fd �| D��}g}�fd �}|dkrLt|��r=||��\}}|� |��|dz }|dkrt|���=|j rJ|D]G}|d}|d}�||��}|dr!|ddur|� ||g���H|dfS)z9Uses interval math to adaptively mesh and obtain the plotrOc�,�g|]}t|����SrJr�r�s r5r�z7ImplicitSeries._get_raster_interval.<locals>.<listcomp>I s��A�A�A�q�%��(�(�A�A�Ar8c�,�g|]}t|����SrJr�r�s r5r�z7ImplicitSeries._get_raster_interval.<locals>.<listcomp>J s��=�=�=�q�%��(�(�=�=�=r8�!r�r&ic�4�g|]\}}t||����SrJr')r1�x1�x2s r5r�z7ImplicitSeries._get_raster_interval.<locals>.<listcomp>_ �&��P�P�P�v�r�2�(�2�r�"�"�P�P�Pr8Nrc�4�g|]\}}t||����SrJr')r1�y1�y2s r5r�z7ImplicitSeries._get_raster_interval.<locals>.<listcomp>` r r8c�"��g|] }�D]}||g��� SrJrJ)r1rtru�yinters �r5r�z7ImplicitSeries._get_raster_interval.<locals>.<listcomp>a s*���@�@�@�A��@�@�A�!�Q��@�@�@�@r8c�\��g}g}|D�] }|d}|d}� ||��}|ddus |ddur�4|dkr|�||g���R|d�|d��|j}|j}t|j|��} t||j��} t|j|��} t||j��} |�| | g��|�| | g��|�| | g��|�| | g����"||fS)ziEvaluates the intervals and subdivides the interval if the expression is partially satisfied.rr&F)TT)r��midr(r�r�)� interval_list�temp_interval_list� plot_list� intervals� intervalx� intervaly� func_eval�avgx�avgyr2r]rr�rUs �r5� refine_pixelsz:ImplicitSeries._get_raster_interval.<locals>.refine_pixelsf s^���"$� ��I�*� 6� 6� �&�a�L� �%�a�L� � �D��I�6�6� ��Q�<�5�(�(�I�a�L�E�,A�,A���,�.�.��$�$�i��%;�<�<�<�<��q�\�)�Y�q�\�-A�$�=�D�$�=�D� ���$�7�7�A� ��y�}�5�5�A� ���$�7�7�A� ��y�}�5�5�A�&�-�-�q�!�f�5�5�5�&�-�-�q�!�f�5�5�5�&�-�-�q�!�f�5�5�5�&�-�-�q�!�f�5�5�5��%�y�0� 0r8rFr�)rr�r�r�r�r�rUr;r<r�r�extendr�r�)r4rUrVr�r(�sx�sy�ex�ey�xsample�ysample�jitterx�jittery�xinterr*r1�plot_list_tempr+r,r-r.r%s ` @r5rz#ImplicitSeries._get_raster_intervalC s����� �7� #� #�� �J��� �A�A�T�\�4�<�$@�A�A�A���B�=�=�T�Z���$<�=�=�=���B��+�+�b�"�b�)�)���+�+�b�"�b�)�)�� �Y�^�^�C��L�L� )� )�A� -�� 1��B�w� �� � � �Y�^�^�C��L�L� )� )�A� -�� 1��B�w� �� � � �7����7���P�P��W�S�b�S�\�7�1�2�2�;�1O�1O�P�P�P��P�P��W�S�b�S�\�7�1�2�2�;�1O�1O�P�P�P��@�@�@�@��@�@�@� �� � 1� 1� 1� 1� 1�>�1�f�f��]�+�+�f�,9�M�-�,H�,H� )�M�>� � � �^� ,� ,� ,��A��A��1�f�f��]�+�+�f� � � =�*� =� =� �%�a�L� �%�a�L� � �D��I�6�6� ��Q�<�=�I�a�L��$=�$=��$�$�i��%;�<�<�<���&� � r8c �R�td��}|���\}}}|�|��|�|��}}|j||�|�||�|������<|jr|||dfS|||dfS)z�Generates the mesh for generating a contour. In the case of equality, ``contour`` function of matplotlib can be used. In other cases, matplotlib's ``contourf`` is used. rOr��contourf) rrrrrqrTr`rarbr�)r4rVrDrE�z_gridrerfs r5rzImplicitSeries._get_meshes_grid� s��� �7� #� #��!%���!1�!1������7�7�6�?�?�B�G�G�F�O�O�S��>@�f��B�I�I�b�j�j��b�m�m�C�&8�&8�9�9� :� :�;� � � 2��6�3� �1� 1��v�s�J�.�.r8c���d}t|t��r|j|jz }d}n6t|t��r|j|jz }n|std���||fS)aIf the expression is a Relational, rewrite it as a single expression. Returns ======= expr : Expr The rewritten expression equality : Boolean Wheter the original expression was an Equality or not. FTzDThe expression is not supported for plotting in uniform meshed plot.)rnr�lhs�rhsr�gts�ltsrj)r@rF�equalitys r5r�z.ImplicitSeries._preprocess_meshgrid_expression� s}���� �d�H� %� %� ��8�d�h�&�D��H�H� ��j� )� )� ��8�d�h�&�D�D�� �%�3��� ��X�~�r8rnc��|dur|jS|jt|j��kr|�|j|��S|jSrp)r�r�r�rmr�rqs r5rszImplicitSeries.get_label� sQ�� �� � ��;� � �;�#�d�1�2�2� 2� 2��*�*�4�+<�g�F�F� F�� � r8rr�)rFrGrHrIrr�r�r�r�r@r�r7rdr�rrkrvrrr�r�rsr�r�s@r5r�r��sY�������.�.��K� �F� �B�������0�'�'��X�'�  �[�,�,��[�,�:����X��������� �E�"�"�"�6  �  �  �'�'�'�>*�*�*�XQ!�Q!�Q!�f /� /� /�����\��4!�!�!�!�!�!�!�!r8r�c��td��}|�|�|dd�|dd�f��d��S)NrOrr&r)r�mean�vstack�rrVs r5r�r�� sD�� �w� � �B� �7�7�2�9�9�e�C�R�C�j�%����)�4�5�5�q� 9� 9�9r8c ���td��}|�|�|dd�dd�f|dd�dd�f|dd�dd�f|dd�dd�ff��d��S)NrOrr&r�)rrH�dstackrJs r5r�r�� s��� �w� � �B� �7�7�2�9�9�e�C�R�C��"��H�o�"�1�2�2�s��s�7�^�"�3�B�3����7�^�"�3�B�3����8�_�� � �"#�  $� $�$r8�����MbP?c�d�td��}||z �t��}||z �t��}|�||��}|j�|��}|j�|��} ||| zz } t | dz��|kS)z0Checks whether three points are almost collinearrOr&)rr�r��dot�linalg�normrx) rtrur�r�rV�vector_a�vector_b� dot_product� vector_a_norm� vector_b_norm� cos_thetas r5r?r?� s��� �w� � �B��A��~�~�e�$�$�H��A��~�~�e�$�$�H��&�&��8�,�,�K��I�N�N�8�,�,�M��I�N�N�8�,�,�M��}�}�<�=�I� �y�1�}� � �� #�#r8c���ddddddd�}|���D]3\}}||���vr|�|��||<�4|ttt fvrbd|���vrK|d|d<t |dd��r*t|d��dkr|dd|d<n�|ttttfvrxd|���vrbt |dd��r<t|d��dkr#|dd|d<|dd|d<n|dx|d<|d<|S)a�Allow the use of the keyword arguments ``n, n1, n2`` to specify the number of discretization points in one and two directions, while keeping back-compatibility with older keyword arguments like, ``nb_of_points, nb_of_points_*, points``. Parameters ========== kwargs : dict Dictionary of keyword arguments passed into a plotting function. pt : type The type of the series, which indicates the kind of plot we are trying to create. r�r�r�)r�r�r�r�r�r�r�rr&) �itemsr��popr�r�r�r�r�r�r�r�r�)r��pt�replace_old_keywordsr�r>s r5r�r�� s~�� ������ ���%�*�*�,�,�&�&���1� �� � � � � � �� � �1� � �F�1�I�� �#�%;�� � � � �&�+�+�-�-� � �!�#�;�F�4�L��v�c�{�J�/�/� .�S����5E�5E��5I�5I�%�c�{�1�~��t� �� �(�-���1� 1� 1� �&�+�+�-�-� � ��v�c�{�J�/�/� :�S����5E�5E��5I�5I�%�c�{�1�~��t� �%�c�{�1�~��t� � �.4�S�k�9��t� �v�d�|� �Mr8)r�NNF)rM)R�collections.abcr�sympy.calculus.utilr�sympy.concreterr�sympy.core.containersr�sympy.core.exprr�sympy.core.functionr �sympy.core.sortingr �sympy.core.symbolr �sympy.functionsr r rrrr�sympy.core.relationalrrrrr�sympy.core.sympifyr�sympy.externalr�sympy.logic.boolalgr�sympy.plotting.utilsrr�sympy.printing.latexr�sympy.printing.pycoder�sympy.printing.precedencer�sympy.sets.setsr r!r"�sympy.simplify.simplifyr#�sympy.utilities.exceptionsr$�sympy.utilities.lambdifyr%rr(rbr*rlrvr|r~r�r�r�rr�rUr�r�r�r�r�r�r�r�r�r�r�r?r�rJr8r5�<module>rrs���$�$�$�$�$�$�1�1�1�1�1�1�'�'�'�'�'�'�'�'�'�'�'�'�'�'� � � � � � �%�%�%�%�%�%�/�/�/�/�/�/�$�$�$�$�$�$�A�A�A�A�A�A�A�A�A�A�A�A�A�A�A�A���������������&�&�&�&�&�&�(�(�(�(�(�(�/�/�/�/�/�/�D�D�D�D�D�D�D�D�&�&�&�&�&�&�3�3�3�3�3�3�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�-�-�-�-�-�-�@�@�@�@�@�@�-�-�-�-�-�-�"�"�"�"�"�"����� B� B� B� B� B�+� B� B� B� *.��5�,%�,%�,%�,%�,%�^���, � � �b �b �b �b �b �b �b �b �J����2���Bm0�m0�m0�m0�m0�z�m0�m0�m0�`9�9�9�9�9�#�9�9�9�xL�L�L�L�L�,�L�L�L�^m�m�m�m�m�/�m�m�m�`B)�B)�B)�B)�B)�5�B)�B)�B)�L � � � � �'� � � �)�)�)�)�)�5�)�)�)�Z:P�:P�:P�:P�:P� �:P�:P�:P�zr.�r.�r.�r.�r.�0�r.�r.�r.�jzA�zA�zA�zA�zA�/�zA�zA�zA�|,�,�,�,�,�,�,�,�,�$7�7�7�7�7� �7�7�7�tP!�P!�P!�P!�P!�Z�P!�P!�P!�n :�:�:� $�$�$� $� $� $� $�)�)�)�)�)r8
Memory