
    (phN
                         S r SSKJr  SSKJr  \" S \" S5       5       5      rSr	Su  r
rSu  rrr\ V s/ s H  o * S	-  PM
     sn rS
 rS rS rS rS rgs  sn f )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              #   2   #    U  H  nS US-  -
  v   M     g7f)g       g      $@N ).0xs     \/var/www/html/venv/lib/python3.13/site-packages/scipy/optimize/tests/test_cython_optimize.py	<genexpr>r	      s     
,)Q4!D&=)s   
   )        r   g      ?)r   g       @)MbP?r   r
   gUUUUUU?c                      [         R                  " [        [        [        R
                  " S[        [        [        [        [        [        [        5      5      [        [        S9  g )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                      [         R                  " [        [        [        R
                  " S[        [        [        [        [        [        [        5      5      [        [        S9  g )Nridderr   r   r   r   r   test_ridderr$   5   r!   r   c                      [         R                  " [        [        [        R
                  " S[        [        [        [        [        [        [        5      5      [        [        S9  g )Nbrenthr   r   r   r   r   test_brenthr'   @   r!   r   c                      [         R                  " [        [        [        R
                  " S[        [        [        [        [        [        [        5      5      [        [        S9  g )Nbrentqr   r   r   r   r   test_brentqr*   K   r!   r   c                  n   [         R                  " [        S   4[        -   [        [
        [        [        [        5      n [        R                  " [        S   U S   [        [        S9  [        R                  " SU S   5        [        R                  " SU S   5        [        R                  " SU S   5        g )	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=      sz     1 
,%)
,,S# dD)+,2Sg,-u -s   A