�
��g�/ � � � d dl mZ d dlmZ d dlmZ d dlmZ d dlm Z d dl
mZ d dlm
Z
d dlmZ d d lmZ d d
lmZ d dlmZ d� Zdd�Zd� Zdd�Zd� Zd� Zd� ZdS )� ��Tuple)�Basic)�Expr)�AppliedUndef)�
Relational)�Dummy)�sympify)�BooleanFunction)�ImageSet)� FiniteSet)�Indexedc �F � t | t t t f� � s| g} t d� | D � � � � rt � � S t � � j d� | D � � � } |j d� | D � � � }|p t � � j d� | D � � � S )a Returns the free symbols of a symbolic expression.
If the expression contains any of these elements, assume that they are
the "free symbols" of the expression:
* indexed objects
* applied undefined function (useful for sympy.physics.mechanics module)
c 3 �4 K � | ]}t |� � V � �d S �N��callable��.0�es �d/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/plotting/utils.py� <genexpr>z$_get_free_symbols.<locals>.<genexpr> s( � � � �
&�
&�1�8�A�;�;�
&�
&�
&�
&�
&�
&� c �B � g | ]}|� t � � ��S � )�atomsr r s r �
<listcomp>z%_get_free_symbols.<locals>.<listcomp> s$ � �9�9�9�a�����)�)�9�9�9r c �B � g | ]}|� t � � ��S r )r r r s r r z%_get_free_symbols.<locals>.<listcomp> s$ � �=�=�=�!�����-�-�=�=�=r c � � g | ] }|j ��
S r ��free_symbolsr s r r z%_get_free_symbols.<locals>.<listcomp> s � � ?� ?� ?�A��� ?� ?� ?r )�
isinstance�list�tuple�set�all�union)�exprs�frees r �_get_free_symbolsr* s� � � �e�d�E�3�/�0�0� ����
�
&�
&��
&�
&�
&�&�&� ��u�u���3�5�5�;�9�9�5�9�9�9�:�D��4�:�=�=�u�=�=�=�>�D��@�;�3�5�5�;� ?� ?�� ?� ?� ?�@�@r �
c �� �� | � t � � }|D ]J}t |� � �t �fd�t d|� � D � � � }| � ||� � } �K| S )a� Extract numerical solutions from a set solution (computed by solveset,
linsolve, nonlinsolve). Often, it is not trivial do get something useful
out of them.
Parameters
==========
n : int, optional
In order to replace ImageSet with FiniteSet, an iterator is created
for each ImageSet contained in `set_sol`, starting from 0 up to `n`.
Default value: 10.
c �. �� g | ]}t �� � ��S r )�next)r �n�its �r r z$extract_solution.<locals>.<listcomp>1 s �� �6�6�6�Q��R���6�6�6r r )�findr �iterr
�range�subs)�set_solr/ �images�im�sr0 s @r �extract_solutionr9 ! sq �� � �\�\�(�
#�
#�F�� &� &��
�"�X�X���6�6�6�6�%��1�+�+�6�6�6�7���,�,�r�1�%�%����Nr c � � t | t � � r| S t | � � } t | � � D ]�\ }}t |t t f� � rt t
|� � ddi�| |<