
    (ph7(                     P    S SK rS r " S S5      r " S S5      r " S S\5      rg)	    Nc                   ^ ^ [         R                  " U5      n[         R                  " UR                  [         R                  5      (       a  U(       d  [        S5      e[        mO[        mUR                  TSS9nUR                  S:w  a  [        S5      e[         R                  " U5      R                  5       (       d  [        S5      eUU 4S jnX14$ )z=Helper function for checking arguments common to all solvers.zX`y0` is complex, but the chosen solver does not support integration in a complex domain.F)copy   z`y0` must be 1-dimensional.z8All components of the initial state `y0` must be finite.c                 :   > [         R                  " T" X5      TS9$ )N)dtype)npasarray)tyr   funs     L/var/www/html/venv/lib/python3.13/site-packages/scipy/integrate/_ivp/base.pyfun_wrapped$check_arguments.<locals>.fun_wrapped   s    zz#a)511    )r   r	   
issubdtyper   complexfloating
ValueErrorcomplexfloatastypendimisfiniteall)r   y0support_complexr   r   s   `   @r   check_argumentsr      s    	BB	}}RXXr1122 L M M	5u	%B	ww!|677;;r?  STT2 ?r   c                   P    \ rS rSrSrSr SS jr\S 5       rS r	S r
S rS	 rS
rg)	OdeSolver   a  Base class for ODE solvers.

In order to implement a new solver you need to follow the guidelines:

    1. A constructor must accept parameters presented in the base class
       (listed below) along with any other parameters specific to a solver.
    2. A constructor must accept arbitrary extraneous arguments
       ``**extraneous``, but warn that these arguments are irrelevant
       using `common.warn_extraneous` function. Do not pass these
       arguments to the base class.
    3. A solver must implement a private method `_step_impl(self)` which
       propagates a solver one step further. It must return tuple
       ``(success, message)``, where ``success`` is a boolean indicating
       whether a step was successful, and ``message`` is a string
       containing description of a failure if a step failed or None
       otherwise.
    4. A solver must implement a private method `_dense_output_impl(self)`,
       which returns a `DenseOutput` object covering the last successful
       step.
    5. A solver must have attributes listed below in Attributes section.
       Note that ``t_old`` and ``step_size`` are updated automatically.
    6. Use `fun(self, t, y)` method for the system rhs evaluation, this
       way the number of function evaluations (`nfev`) will be tracked
       automatically.
    7. For convenience, a base class provides `fun_single(self, t, y)` and
       `fun_vectorized(self, t, y)` for evaluating the rhs in
       non-vectorized and vectorized fashions respectively (regardless of
       how `fun` from the constructor is implemented). These calls don't
       increment `nfev`.
    8. If a solver uses a Jacobian matrix and LU decompositions, it should
       track the number of Jacobian evaluations (`njev`) and the number of
       LU decompositions (`nlu`).
    9. By convention, the function evaluations used to compute a finite
       difference approximation of the Jacobian should not be counted in
       `nfev`, thus use `fun_single(self, t, y)` or
       `fun_vectorized(self, t, y)` when computing a finite difference
       approximation of the Jacobian.

Parameters
----------
fun : callable
    Right-hand side of the system: the time derivative of the state ``y``
    at time ``t``. The calling signature is ``fun(t, y)``, where ``t`` is a
    scalar and ``y`` is an ndarray with ``len(y) = len(y0)``. ``fun`` must
    return an array of the same shape as ``y``. See `vectorized` for more
    information.
t0 : float
    Initial time.
y0 : array_like, shape (n,)
    Initial state.
t_bound : float
    Boundary time --- the integration won't continue beyond it. It also
    determines the direction of the integration.
vectorized : bool
    Whether `fun` can be called in a vectorized fashion. Default is False.

    If ``vectorized`` is False, `fun` will always be called with ``y`` of
    shape ``(n,)``, where ``n = len(y0)``.

    If ``vectorized`` is True, `fun` may be called with ``y`` of shape
    ``(n, k)``, where ``k`` is an integer. In this case, `fun` must behave
    such that ``fun(t, y)[:, i] == fun(t, y[:, i])`` (i.e. each column of
    the returned array is the time derivative of the state corresponding
    with a column of ``y``).

    Setting ``vectorized=True`` allows for faster finite difference
    approximation of the Jacobian by methods 'Radau' and 'BDF', but
    will result in slower execution for other methods. It can also
    result in slower overall execution for 'Radau' and 'BDF' in some
    circumstances (e.g. small ``len(y0)``).
support_complex : bool, optional
    Whether integration in a complex domain should be supported.
    Generally determined by a derived solver class capabilities.
    Default is False.

Attributes
----------
n : int
    Number of equations.
status : string
    Current status of the solver: 'running', 'finished' or 'failed'.
t_bound : float
    Boundary time.
direction : float
    Integration direction: +1 or -1.
t : float
    Current time.
y : ndarray
    Current state.
t_old : float
    Previous time. None if no steps were made yet.
step_size : float
    Size of the last successful step. None if no steps were made yet.
nfev : int
    Number of the system's rhs evaluations.
njev : int
    Number of the Jacobian evaluations.
nlu : int
    Number of LU decompositions.
z8Required step size is less than spacing between numbers.c                   ^  S T l         UT l        [        XU5      u  T l        T l        UT l        UT l        U(       a  U 4S jnT R                  nOT R                  nU 4S jnU 4S jnUT l        UT l        UT l	        XB:w  a  [        R                  " XB-
  5      OST l        T R                  R                  T l        ST l        ST l        ST l        ST l        g )Nc                 P   > TR                  XS S 2S 4   5      R                  5       $ N)_funravelr
   r   selfs     r   
fun_single&OdeSolver.__init__.<locals>.fun_single   s#    yyagJ/5577r   c                    > [         R                  " U5      n[        UR                  5       H  u  p4TR	                  X5      US S 2U4'   M     U$ r"   )r   
empty_like	enumerateTr#   )r
   r   fiyir&   s        r   fun_vectorized*OdeSolver.__init__.<locals>.fun_vectorized   s@    MM!$&qss^EA"ii.AadG ,r   c                 P   > T=R                   S-  sl         TR                  X5      $ )Nr   )nfevr'   r%   s     r   r   OdeSolver.__init__.<locals>.fun   s    IINI??1((r   r   runningr   )t_oldr
   r   r#   r   t_bound
vectorizedr   r'   r0   r   sign	directionsizenstatusr3   njevnlu)	r&   r   t0r   r7   r8   r   r'   r0   s	   `        r   __init__OdeSolver.__init__   s    
+C_E	46$8!YYNJ	) $,29-.Q		r   c                 x    U R                   c  g [        R                  " U R                  U R                   -
  5      $ r"   )r6   r   absr
   r&   s    r   	step_sizeOdeSolver.step_size   s+    ::66$&&4::-..r   c                    U R                   S:w  a  [        S5      eU R                  S:X  d  U R                  U R                  :X  a-  U R                  U l        U R                  U l        SnSU l         U$ U R                  nU R                  5       u  p1U(       d	  SU l         U$ X l        U R                  U R                  U R                  -
  -  S:  a  SU l         U$ )zPerform one integration step.

Returns
-------
message : string or None
    Report from the solver. Typically a reason for a failure if
    `self.status` is 'failed' after the step was taken or None
    otherwise.
r5   z/Attempt to step on a failed or finished solver.r   Nfinishedfailed)r=   RuntimeErrorr<   r
   r7   r6   
_step_implr:   )r&   messager
   successs       r   stepOdeSolver.step   s     ;;)#  ) * * 66Q;$&&DLL0DJ\\DFG$DK  A#0G& 	 
>>TVVdll%:;q@",DKr   c                     U R                   c  [        S5      eU R                  S:X  d  U R                  U R                   :X  a+  [	        U R                   U R                  U R
                  5      $ U R                  5       $ )zCompute a local interpolant over the last successful step.

Returns
-------
sol : `DenseOutput`
    Local interpolant over the last successful step.
z;Dense output is available after a successful step was made.r   )r6   rK   r<   r
   ConstantDenseOutputr   _dense_output_implrE   s    r   dense_outputOdeSolver.dense_output   sf     ::  0 1 1 66Q;$&&DJJ.&tzz466466BB**,,r   c                     [         er"   NotImplementedErrorrE   s    r   rL   OdeSolver._step_impl       !!r   c                     [         er"   rW   rE   s    r   rS   OdeSolver._dense_output_impl   rZ   r   )r#   r:   r   r'   r0   r<   r3   r>   r?   r=   r
   r7   r6   r8   r   N)F)__name__
__module____qualname____firstlineno____doc__TOO_SMALL_STEPrA   propertyrF   rO   rT   rL   rS   __static_attributes__ r   r   r   r      sE    cH PN "'#J / /B-$""r   r   c                   *    \ rS rSrSrS rS rS rSrg)DenseOutput   a/  Base class for local interpolant over step made by an ODE solver.

It interpolates between `t_min` and `t_max` (see Attributes below).
Evaluation outside this interval is not forbidden, but the accuracy is not
guaranteed.

Attributes
----------
t_min, t_max : float
    Time range of the interpolation.
c                 \    Xl         X l        [        X!5      U l        [	        X!5      U l        g r"   )r6   r
   mint_minmaxt_max)r&   r6   r
   s      r   rA   DenseOutput.__init__   s"    
]
]
r   c                     [         R                  " U5      nUR                  S:  a  [        S5      eU R	                  U5      $ )a  Evaluate the interpolant.

Parameters
----------
t : float or array_like with shape (n_points,)
    Points to evaluate the solution at.

Returns
-------
y : ndarray, shape (n,) or (n, n_points)
    Computed values. Shape depends on whether `t` was a scalar or a
    1-D array.
r   z#`t` must be a float or a 1-D array.)r   r	   r   r   
_call_implr&   r
   s     r   __call__DenseOutput.__call__   s7     JJqM66A:BCCq!!r   c                     [         er"   rW   rq   s     r   rp   DenseOutput._call_impl  rZ   r   )r
   rm   rk   r6   N)	r]   r^   r_   r`   ra   rA   rr   rp   rd   re   r   r   rg   rg      s    
#"&"r   rg   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )rR   i  zConstant value interpolator.

This class used for degenerate integration cases: equal integration limits
or a system with 0 equations.
c                 0   > [         TU ]  X5        X0l        g r"   )superrA   value)r&   r6   r
   ry   	__class__s       r   rA   ConstantDenseOutput.__init__  s    "
r   c                     UR                   S:X  a  U R                  $ [        R                  " U R                  R                  S   UR                  S   45      nU R                  S S 2S 4   US S & U$ )Nr   )r   ry   r   emptyshape)r&   r
   rets      r   rp   ConstantDenseOutput._call_impl  s\    66Q;::((DJJ,,Q/<=CZZ4(CFJr   )ry   )	r]   r^   r_   r`   ra   rA   rp   rd   __classcell__)rz   s   @r   rR   rR     s    
 r   rR   )numpyr   r   r   rg   rR   re   r   r   <module>r      s1    0J" J"Z&" &"R+ r   