§
    fŠtjN
  ã                   ó®   — 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d	„ eD ¦   «         Zd
„ Zd„ Zd„ Zd„ Zd„ ZdS )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
  V — ŒdS )g       Àg      $@N© )Ú.0Úxs     úg/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/scipy/optimize/tests/test_cython_optimize.pyú	<genexpr>r	      s*   è è € Ð
,Ð
,˜Qˆ4�!�D‘&‰=Ð
,Ð
,Ð
,Ð
,Ð
,Ð
,ó    é
   )ç        r   g      ð?)r   g       @)çü©ñÒMbP?r   r   c                 ó   — g | ]}| d z  ‘Œ	S )gUUUUUUÕ?r   )r   Úa0s     r   ú
<listcomp>r      s   € Ð,Ð,Ð, 2ˆbˆS�gÑÐ,Ð,Ð,r
   c                  óæ   — t          j        t          t          t	          j        dt          t          t          t          t          t          t          ¦  «        ¦  «        t          t          ¬¦  «         d S )NÚbisect©ÚrtolÚatol©ÚnptÚassert_allcloseÚEXPECTEDÚlistr   Úloop_exampleÚA0ÚARGSÚXLOÚXHIÚXTOLÚRTOLÚMITRr   r
   r   Útest_bisectr#   *   óY   € ÝÔÝÝÝÔ ­"­dµC½½dÅDÍ$ÑOÔOñ	
ô 	
õ �ðñ ô ð ð ð r
   c                  óæ   — t          j        t          t          t	          j        dt          t          t          t          t          t          t          ¦  «        ¦  «        t          t          ¬¦  «         d S )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          ¬¦  «         d S )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          ¬¦  «         d S )NÚbrentqr   r   r   r
   r   Útest_brentqr-   K   r$   r
   c                  óš  — 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         ¦  «         d S )	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_outputr8   V   s›   € ÝÔ'Ý	ˆAŒˆ•4‰��c¥4­­tñ5ô 5€FåÔ� œ V¨F¤^½$ÅTÐJÑJÔJÐ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-   r8   r   r
   r   ú<module>r?      sß   ððð ð Ð Ð Ð Ð Ð Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1ð €UÐ
,Ð
, % %¨¡)¤)Ð
,Ñ
,Ô
,Ñ,Ô,€Ø€Ø�€€Sà#Ñ €€dˆDØ,Ð,¨Ð,Ñ,Ô,€ðð ð ðð ð ðð ð ðð ð ð-ð -ð -ð -ð -r
   