U
    L?h                     @   sh   d dl mZ d dlmZ d dlmZ d dlmZmZ d dl	m
Z
 d dlmZ dd Zd	d
 Zdd ZdS )    )Functionsympify)tanh)cossin)limit)xc                  C   sX   G dd dt } | ttddtttddks8tt| tt tddksTtdS )zCreate our new "sin" function.c                   @   s"   e Zd ZdddZedd ZdS )z*test_function_series1.<locals>.my_function   c                 S   s   t | jd S Nr   )r   argsselfZargindex r   a/var/www/html/venv/lib/python3.8/site-packages/sympy/functions/elementary/tests/test_interface.pyfdiff   s    z0test_function_series1.<locals>.my_function.fdiffc                 S   s   t |}|dkrt dS d S r   r   clsargr   r   r   eval   s    z/test_function_series1.<locals>.my_function.evalN)r
   __name__
__module____qualname__r   classmethodr   r   r   r   r   my_function   s   
r   r   
   r
   N)r   r	   seriesr   AssertionErrorr   )r   r   r   r   test_function_series1   s    (r   c                  C   s<   G dd dt } | ttddtttddks8tdS )zCreate our new "cos" function.c                   @   s"   e Zd ZdddZedd ZdS )z+test_function_series2.<locals>.my_function2r
   c                 S   s   t | jd  S r   )r   r   r   r   r   r   r   #   s    z1test_function_series2.<locals>.my_function2.fdiffc                 S   s   t |}|dkrt dS d S )Nr   r
   r   r   r   r   r   r   &   s    z0test_function_series2.<locals>.my_function2.evalN)r
   r   r   r   r   r   my_function2!   s   
r    r   r   N)r   r	   r   r   r   )r    r   r   r   test_function_series2   s    r!   c                     sH   G  fdddt  tt}  t}| tdd|tddksDtdS )a_  
    Test our easy "tanh" function.

    This test tests two things:
      * that the Function interface works as expected and it's easy to use
      * that the general algorithm for the series expansion works even when the
        derivative is defined recursively in terms of the original function,
        since tanh(x).diff(x) == 1-tanh(x)**2
    c                       s&   e Zd Zd fdd	Zedd ZdS )z%test_function_series3.<locals>.mytanhr
   c                    s   d | j d d  S )Nr
   r      )r   r   mytanhr   r   r   =   s    z+test_function_series3.<locals>.mytanh.fdiffc                 S   s   t |}|dkrt dS d S r   r   r   r   r   r   r   @   s    z*test_function_series3.<locals>.mytanh.evalN)r
   r   r   r#   r   r   r$   ;   s   r$   r      N)r   r   r	   r   r   )efr   r#   r   test_function_series30   s    r(   N)Zsympy.core.functionr   Zsympy.core.sympifyr   Z%sympy.functions.elementary.hyperbolicr   Z(sympy.functions.elementary.trigonometricr   r   Zsympy.series.limitsr   Z	sympy.abcr	   r   r!   r(   r   r   r   r   <module>   s   