
    Qi	                     h    d dl mZ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 Zd Zd	 Zd
S )    )FunctionDefinedFunctionsympify)tanh)cossin)limit)xc                  `   t           t          fD ]}  G d d|           } |t                                        t          dd          t	          t                                        t          dd          k    sJ t           |t                    t          z  t          d          dk    sJ dS )zCreate our new "sin" function.c                   ,    e Zd ZddZed             ZdS )*test_function_series1.<locals>.my_function   c                 6    t          | j        d                   S Nr   )r   argsselfargindexs     /var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/sympy/functions/elementary/tests/test_interface.pyfdiffz0test_function_series1.<locals>.my_function.fdiff   s    49Q<(((    c                 N    t          |          }|dk    rt          d          S d S r   r   clsargs     r   evalz/test_function_series1.<locals>.my_function.eval   )    cll!88"1::% 8r   Nr   __name__
__module____qualname__r   classmethodr    r   r   my_functionr      sC        ) ) ) ) & & [& & &r   r&   r   
   r   N)r   r   r   seriesr	   r
   )Fr&   s     r   test_function_series1r*      s     ( 2 2		& 		& 		& 		& 		&! 		& 		& 		& {1~~$$Q2..#a&&--1b2I2IIIII[[^^A%q!,,111112 2r   c                      t           t          fD ]l}  G d d|           } |t                                        t          dd          t	          t                                        t          dd          k    sJ mdS )zCreate our new "cos" function.c                   ,    e Zd ZddZed             ZdS )+test_function_series2.<locals>.my_function2r   c                 8    t          | j        d                    S r   )r	   r   r   s     r   r   z1test_function_series2.<locals>.my_function2.fdiff+   s    DIaL))))r   c                 N    t          |          }|dk    rt          d          S d S )Nr   r   r   r   s     r   r   z0test_function_series2.<locals>.my_function2.eval.   r   r   Nr   r    r%   r   r   my_function2r-   )   sC        * * * * & & [& & &r   r0   r   r'   N)r   r   r   r(   r   )r)   r0   s     r   test_function_series2r1   $   s     ( K K		& 		& 		& 		& 		&1 		& 		& 		& |A%%aB//3q66==Ar3J3JJJJJJK Kr   c                  
   t           t          fD ]r}  G fdd|           t          t                    } t                    }|                    t          dd          |                    t          dd          k    sJ sd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                   2    e Zd Zd fd	Zed             ZdS )%test_function_series3.<locals>.mytanhr   c                 <    d | j         d                   dz  z
  S )Nr   r      )r   )r   r   mytanhs     r   r   z+test_function_series3.<locals>.mytanh.fdiffG   s#    66$)A,//222r   c                 N    t          |          }|dk    rt          d          S d S r   r   r   s     r   r   z*test_function_series3.<locals>.mytanh.evalJ   r   r   Nr   r    )r7   s   r   r7   r4   E   sN        3 3 3 3 3 3 & & [& & &r   r7   r      N)r   r   r   r   r(   )r)   efr7   s      @r   test_function_series3r<   8   s     ( 6 6		& 		& 		& 		& 		& 		& 		&Q 		& 		& 		& GGF1IIxx1a  AHHQ1$5$5555556 6r   N)sympy.core.functionr   r   sympy.core.sympifyr   %sympy.functions.elementary.hyperbolicr   (sympy.functions.elementary.trigonometricr   r	   sympy.series.limitsr
   	sympy.abcr   r*   r1   r<   r%   r   r   <module>rC      s    : 9 9 9 9 9 9 9 & & & & & & 6 6 6 6 6 6 ? ? ? ? ? ? ? ? % % % % % %      2 2 2*K K K(6 6 6 6 6r   