U
    9%e	                     @   s   d dl mZmZmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZmZ dddd	ZG d
d deZddddZG dd deZdS )    )AddArgumentIndexErrorFunction)Pow)S)log)cossinTevaluatec                C   s   t t| |dtj |dS Nr
   )r   r   r   One)xr    r   X/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/sympy/codegen/scipy_nodes.py_cosm1   s    r   c                   @   s6   e Zd ZdZdZdddZdd Zdd Zd	d
 ZdS )cosm1z Minus one plus cosine of x, i.e. cos(x) - 1. For use when x is close to zero.

    Helper class for use with e.g. scipy.special.cosm1
    See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.cosm1.html
       c                 C   s"   |dkrt | j  S t| |dS )@
        Returns the first derivative of this function.
        r   N)r	   argsr   selfZargindexr   r   r   fdiff   s    zcosm1.fdiffc                 K   s   t |S N)r   )r   r   kwargsr   r   r   _eval_rewrite_as_cos   s    zcosm1._eval_rewrite_as_cosc                 O   s   |  tj||S r   )rewriter   evalfr   r   r   r   r   r   _eval_evalf    s    zcosm1._eval_evalfc                 K   s8   | j \}t|jf |}|t|ddkr,|S t|S d S NFr
   )r   r   simplifyr   )r   r   r   	candidater   r   r   _eval_simplify#   s
    zcosm1._eval_simplifyN)r   )	__name__
__module____qualname____doc__nargsr   r   r   r#   r   r   r   r   r      s   
	r   c                C   s   t t| ||dtj |dS r   )r   r   r   r   )r   yr   r   r   r   _powm1,   s    r*   c                   @   s6   e Zd ZdZdZdddZdd Zdd	 Zd
d ZdS )powm1z Minus one plus x to the power of y, i.e. x**y - 1. For use when x is close to one or y is close to zero.

    Helper class for use with e.g. scipy.special.powm1
    See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.powm1.html
       r   c                 C   s`   |dkr2t | jd | jd | jd  | jd  S |dkrRt| jd t | j  S t| |dS )r   r   r   r,   N)r   r   r   r   r   r   r   r   r   8   s
    *zpowm1.fdiffc                 K   s
   t ||S r   )r*   )r   r   r)   r   r   r   r   _eval_rewrite_as_PowC   s    zpowm1._eval_rewrite_as_Powc                 O   s   |  tj||S r   )r   r   r   r   r   r   r   r   F   s    zpowm1._eval_evalfc                 K   sH   | j \}}t|jf ||jf |}|t||ddkr:|S t||S d S r    )r   r*   r!   r+   )r   r   r   r)   r"   r   r   r   r#   I   s
    
zpowm1._eval_simplifyN)r   )	r$   r%   r&   r'   r(   r   r-   r   r#   r   r   r   r   r+   0   s   
r+   N)Zsympy.core.functionr   r   r   Zsympy.core.powerr   Zsympy.core.singletonr   Z&sympy.functions.elementary.exponentialr   Z(sympy.functions.elementary.trigonometricr   r	   r   r   r*   r+   r   r   r   r   <module>   s    