
    tKgN
                         d Z ddlmZ ddlmZ  ed  ed      D              ZdZ	d\  Z
Zd\  ZZZeD  cg c]  } |  d	z  
 c} Zd
 Zd Zd Zd Zd Zyc c} w )a8  
Test Cython optimize zeros API functions: ``bisect``, ``ridder``, ``brenth``,
and ``brentq`` in `scipy.optimize.cython_optimize`, by finding the roots of a
3rd order polynomial given a sequence of constant terms, ``a0``, and fixed 1st,
2nd, and 3rd order terms in ``args``.

.. math::

    f(x, a0, args) =  ((args[2]*x + args[1])*x + args[0])*x + a0

The 3rd order polynomial function is written in Cython and called in a Python
wrapper named after the zero function. See the private ``_zeros`` Cython module
in `scipy.optimize.cython_optimze` for more information.
    N)_zerosc              #   ,   K   | ]  }d |dz  z
    yw)g       g      $@N ).0xs     m/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/scipy/optimize/tests/test_cython_optimize.py	<genexpr>r	      s     
,)Q4!D&=)s   
   )        r   g      ?)r   g       @)MbP?r   r
   gUUUUUU?c                      t        j                  t        t        t	        j
                  dt        t        t        t        t        t        t                    t        t               y )Nbisectrtolatolnptassert_allcloseEXPECTEDlistr   loop_exampleA0ARGSXLOXHIXTOLRTOLMITRr       r   test_bisectr    *   >    "dCdD$O	
 r   c                      t        j                  t        t        t	        j
                  dt        t        t        t        t        t        t                    t        t               y )Nridderr   r   r   r   r   test_ridderr$   5   r!   r   c                      t        j                  t        t        t	        j
                  dt        t        t        t        t        t        t                    t        t               y )Nbrenthr   r   r   r   r   test_brenthr'   @   r!   r   c                      t        j                  t        t        t	        j
                  dt        t        t        t        t        t        t                    t        t               y )Nbrentqr   r   r   r   r   test_brentqr*   K   r!   r   c                  j   t        j                  t        d   ft        z   t        t
        t        t        t              } t        j                  t        d   | d   t        t               t        j                  d| d          t        j                  d| d          t        j                  d| d          y )	Nr   rootr      
iterations   funcalls	error_num)r   full_output_exampler   r   r   r   r   r   r   r   r   r   assert_equal)outputs    r   test_brentq_full_outputr5   V   s    ''	A4c4t5FVF^$TJQ|,-Qz*+Q{+,r   )__doc__numpy.testingtestingr   scipy.optimize.cython_optimizer   tupleranger   r   r   r   r   r   r   r   r    r$   r'   r*   r5   )a0s   0r   <module>r=      s|     1 
,%)
,,S# dD)+,2bSg,-u -s   A