| Server IP : 93.86.61.54 / Your IP : 216.73.216.60 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3/dist-packages/sympy/assumptions/__pycache__/ |
Upload File : |
o
�8Vad � @ s� d Z ddlmZmZ ddlmZmZmZ ddlm Z G dd� de�Z
dd� ZG d d
� d
e e
d�Zdd
d�Z
ddd�Zddd�ZdS )a2
Functions and wrapper object to call assumption property and predicate
query with same syntax.
In SymPy, there are two assumption systems. Old assumption system is
defined in sympy/core/assumptions, and it can be accessed by attribute
such as ``x.is_even``. New assumption system is definded in
sympy/assumptions, and it can be accessed by predicates such as
``Q.even(x)``.
Old assumption is fast, while new assumptions can freely take local facts.
In general, old assumption is used in evaluation method and new assumption
is used in refinement method.
In most cases, both evaluation and refinement follow the same process, and
the only difference is which assumption system is used. This module provides
``is_[...]()`` functions and ``AssumptionsWrapper()`` class which allows
using two systems with same syntax so that parallel code implementation can be
avoided.
Examples
========
For multiple use, use ``AssumptionsWrapper()``.
>>> from sympy import Q, Symbol
>>> from sympy.assumptions.wrapper import AssumptionsWrapper
>>> x = Symbol('x')
>>> _x = AssumptionsWrapper(x, Q.even(x))
>>> _x.is_integer
True
>>> _x.is_odd
False
For single use, use ``is_[...]()`` functions.
>>> from sympy.assumptions.wrapper import is_infinite
>>> a = Symbol('a')
>>> print(is_infinite(a))
None
>>> is_infinite(a, Q.finite(a))
False
� )�ask�Q)�_assume_defined�as_property�ManagedProperties)�Basicc s e Zd ZdZ� fdd�Z� ZS )�AssumptionsWrapperMetazK
Metaclass to give _eval_is_[...] attributes to AssumptionsWrapper
c sD t D ]}dt|� }t| |t|�� qt� j| g|�R i |�� d S )Nz_eval_%s)r r �setattr�make_eval_method�super�__init__)�cls�args�kws�fact�pname�� __class__� �;/usr/lib/python3/dist-packages/sympy/assumptions/wrapper.pyr 8 s zAssumptionsWrapperMeta.__init__)�__name__�
__module__�__qualname__�__doc__r �
__classcell__r r r r r 4 s r c s � fdd�}|S )Nc s8 zt t� �}t|| j�| j�}|W S ty Y d S w �N)�getattrr r �expr�assumptions�AttributeError)�self�pred�ret�r r r �getit@ s
�zmake_eval_method.<locals>.getitr )r r$ r r# r r
? s r
c s"