�
H�g�) � � � d Z ddlmZmZ ddlmZ ddlmZ G d� de� � Z dd gd
dd
d
g d
fd�Z
d
� Zg d�Zd� Z
dd gdd gdd
dd
d
d
fd�Zdd gdd gdddd
d
d
fd�Ze
e _
ee _ e
e _
ee _ ee _ d
S )z
Plotting (requires matplotlib)
� )�
hsv_to_rgb�
hls_to_rgb� )�
NoConvergence)�xrangec � � e Zd ZeeeefZdS )�VisualizationMethodsN)�__name__�
__module__�__qualname__�
ValueError�ArithmeticError�ZeroDivisionErrorr �plot_ignore� � �d/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/mpmath/visualization.pyr r s � � � � � ���0A�=�Q�K�K�Kr r ������ N�� c �t � |rd}d} |s-ddl }
|
� � � } | � d� � }t |t t
f� � s|g}|\ }}g d�}
t
|� � D �]�\ }}| � ||||z
t |� � z � � }g }g }d}t t |� � � � D �]}} |dk r'|D ]$}||dz
|k r|| |k rt ��% ||| � � }| � |� � st |� � dk rt �t |d� � rv|j rot |j � � }t |j � � }|sd }|� |� � g }|� t || � � ||f� � n\|rd}|� |� � g }t |d
� � r|j }|� t || � � |f� � ��U# | j $ r |r|� |� � g }Y ��{w xY w|r|� |� � |D ]�}d� |D � � }d� |D � � }|s�|
|t |
� � z }t |d � � d
k rEd� |D � � }|� ||d|z d
�� � |� ||d|z d
�� � ��|� |||d
�� � �����|� d� |D � � � � |r|� d� |D � � � � |� d� � |� d� � |� d � � | r1|r|
� ||�� � dS |
� � � dS dS )a�
Shows a simple 2D plot of a function `f(x)` or list of functions
`[f_0(x), f_1(x), \ldots, f_n(x)]` over a given interval
specified by *xlim*. Some examples::
plot(lambda x: exp(x)*li(x), [1, 4])
plot([cos, sin], [-4, 4])
plot([fresnels, fresnelc], [-4, 4])
plot([sqrt, cbrt], [-4, 4])
plot(lambda t: zeta(0.5+t*j), [-20, 20])
plot([floor, ceil, abs, sign], [-5, 5])
Points where the function raises a numerical exception or
returns an infinite value are removed from the graph.
Singularities can also be excluded explicitly
as follows (useful for removing erroneous vertical lines)::
plot(cot, ylim=[-5, 5]) # bad
plot(cot, ylim=[-5, 5], singularities=[-pi, 0, pi]) # good
For parts where the function assumes complex values, the
real part is plotted with dashes and the imaginary part
is plotted with dots.
.. note :: This function requires matplotlib (pylab).
Nr �o )�b�r�g�m�kFr g�u �<�7~�imagT�realc � � g | ]
}|d ��S �r r ��.0�ss r �
<listcomp>zplot.<locals>.<listcomp>X � � �'�'�'�!��1��'�'�'r c � � g | ]
}|d ��S )r r r"