o
    FZh	                     @   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   H/var/www/auris/lib/python3.10/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| |)@
        Returns the first derivative of this function.
        r   )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      |  tj|i |S r   )rewriter   evalfr   r   r   r   r   r   _eval_evalf       zcosm1._eval_evalfc                 K   s8   | j \}t|jdi |}|t|ddkr|S t|S NFr
   r   )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rt | jd | jd | jd  | jd  S |dkr)t| jd t | j  S t| |)r   r   r   r/   )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   r   r   )r   r   r   r   r   r   r   r    F   r!   zpowm1._eval_evalfc                 K   sL   | j \}}t|jdi ||jdi |}|t||ddkr!|S t||S r"   )r   r-   r#   r.   )r   r   r   r,   r$   r   r   r   r%   I   s
   
"
zpowm1._eval_simplifyNr&   )	r'   r(   r)   r*   r+   r   r0   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     