+
    /i]D                         ^ RI t^ RIHtHt ^ RIHtHtHt ^ RI	H
t
 ^ RIHt ^RIHtHtHtHtHtHtHtHt ^RIHtHt ^t^tRt^
tR	 tR
 tR t ! R R]4      t  ! R R]4      t!R# )    N)	lu_factorlu_solve)issparse
csc_matrixeye)splu)group_columns)validate_max_stepvalidate_tolselect_initial_stepnormEPSnum_jacvalidate_first_stepwarn_extraneous)	OdeSolverDenseOutputg?c                N   \         P                  ! ^V ^,           4      R,          p\         P                  ! ^V ^,           4      p\         P                  ! V ^,           V ^,           34      pV^,
          W,          ,
          V,          VR&   ^V^ &   \         P                  ! V^ R7      # )z6Compute the matrix for changing the differences array.axisNNNN)   NNr   )nparangezeroscumprod)orderfactorIJMs   &&   V/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/integrate/_ivp/bdf.py	compute_Rr%      s}    
		!UQY(A
		!UQYA
%!)UQY'(AQ#q(AfIAaD::aa      c                    \        W4      p\        V^4      pVP                  V4      p\        P                  ! VP                  V RV^,            4      V RV^,           % R# )z<Change differences array in-place when step size is changed.N)r%   dotr   T)Dr   r    RURUs   &&&   r$   change_Dr.      sM    % A%A	
qBFF244:EAI/AjuqyMr&   c	                R   ^ p	VP                  4       p
RpRp\        \        4       F  pV ! W4      p\        P                  ! \        P
                  ! V4      4      '       g    MV! WSV,          V,
          V	,
          4      p\        W,          4      pVf   RpM	VV,          pVe8   V^8  g/   V\        V,
          ,          ^V,
          ,          V,          V8  d    MAW,          p
W,          p	V^ 8X  g!   Ve!   V^V,
          ,          V,          V8  d   Rp MTpK  	  VX^,           W3# )z5Solve the algebraic system resulting from BDF method.NFT)copyrangeNEWTON_MAXITERr   allisfiniter   )funt_new	y_predictcpsiLUsolve_luscaletoldydy_norm_old	convergedkfdydy_normrates   &&&&&&&&&         r$   solve_bdf_systemrG   $   s   	AAKI>"Mvvbkk!n%%ba%#+/*rz"D[(D$!)!+,D9GCcI		qL TQX%6%@3%FI3 #6 a!eQ!!r&   c                   n   a a ] tR t^Ht oRt]P                  RRRRRR3V 3R lltR tR t	R	 t
R
tVtV ;t# )BDFa9  Implicit method based on backward-differentiation formulas.

This is a variable order method with the order varying automatically from
1 to 5. The general framework of the BDF algorithm is described in [1]_.
This class implements a quasi-constant step size as explained in [2]_.
The error estimation strategy for the constant-step BDF is derived in [3]_.
An accuracy enhancement using modified formulas (NDF) [2]_ is also implemented.

Can be applied in the complex domain.

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.
first_step : float or None, optional
    Initial step size. Default is ``None`` which means that the algorithm
    should choose.
max_step : float, optional
    Maximum allowed step size. Default is np.inf, i.e., the step size is not
    bounded and determined solely by the solver.
rtol, atol : float and array_like, optional
    Relative and absolute tolerances. The solver keeps the local error
    estimates less than ``atol + rtol * abs(y)``. Here `rtol` controls a
    relative accuracy (number of correct digits), while `atol` controls
    absolute accuracy (number of correct decimal places). To achieve the
    desired `rtol`, set `atol` to be smaller than the smallest value that
    can be expected from ``rtol * abs(y)`` so that `rtol` dominates the
    allowable error. If `atol` is larger than ``rtol * abs(y)`` the
    number of correct digits is not guaranteed. Conversely, to achieve the
    desired `atol` set `rtol` such that ``rtol * abs(y)`` is always smaller
    than `atol`. If components of y have different scales, it might be
    beneficial to set different `atol` values for different components by
    passing array_like with shape (n,) for `atol`. Default values are
    1e-3 for `rtol` and 1e-6 for `atol`.
jac : {None, array_like, sparse_matrix, callable}, optional
    Jacobian matrix of the right-hand side of the system with respect to y,
    required by this method. The Jacobian matrix has shape (n, n) and its
    element (i, j) is equal to ``d f_i / d y_j``.
    There are three ways to define the Jacobian:

        * If array_like or sparse_matrix, the Jacobian is assumed to
          be constant.
        * If callable, the Jacobian is assumed to depend on both
          t and y; it will be called as ``jac(t, y)`` as necessary.
          For the 'Radau' and 'BDF' methods, the return value might be a
          sparse matrix.
        * If None (default), the Jacobian will be approximated by
          finite differences.

    It is generally recommended to provide the Jacobian rather than
    relying on a finite-difference approximation.
jac_sparsity : {None, array_like, sparse matrix}, optional
    Defines a sparsity structure of the Jacobian matrix for a
    finite-difference approximation. Its shape must be (n, n). This argument
    is ignored if `jac` is not `None`. If the Jacobian has only few non-zero
    elements in *each* row, providing the sparsity structure will greatly
    speed up the computations [4]_. A zero entry means that a corresponding
    element in the Jacobian is always zero. If None (default), the Jacobian
    is assumed to be dense.
vectorized : bool, optional
    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 this method, but may result in slower
    execution overall in some circumstances (e.g. small ``len(y0)``).

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 evaluations of the right-hand side.
njev : int
    Number of evaluations of the Jacobian.
nlu : int
    Number of LU decompositions.

References
----------
.. [1] G. D. Byrne, A. C. Hindmarsh, "A Polyalgorithm for the Numerical
       Solution of Ordinary Differential Equations", ACM Transactions on
       Mathematical Software, Vol. 1, No. 1, pp. 71-96, March 1975.
.. [2] L. F. Shampine, M. W. Reichelt, "THE MATLAB ODE SUITE", SIAM J. SCI.
       COMPUTE., Vol. 18, No. 1, pp. 1-22, January 1997.
.. [3] E. Hairer, G. Wanner, "Solving Ordinary Differential Equations I:
       Nonstiff Problems", Sec. III.2.
.. [4] A. Curtis, M. J. D. Powell, and J. Reid, "On the estimation of
       sparse Jacobian matrices", Journal of the Institute of Mathematics
       and its Applications, 13, pp. 117-120, 1974.
gMbP?gư>NFc                  <a  \        V4       \        SS `	  WW4V
R R7       \        V4      S n        \        WgS P                  4      w  S n        S n        S P                  S P                  S P                  4      pVfV   \        S P                  S P                  S P                  WEVS P                  ^S P                  S P                  4
      S n        M\        WV4      S n        RS n        RS n        \%        ^
\&        ,          V,          \)        RVR,          4      4      S n        RS n        S P/                  W4      w  S n        S n        \5        S P2                  4      '       d7   V 3R lpR p\7        S P                  RS P                  P8                  R7      pM?V 3R	 lpR
 p\:        P<                  ! S P                  S P                  P8                  R7      pVS n        VS n         VS n!        \:        PD                  ! . RO4      p\:        PF                  ! ^ \:        PH                  ! ^\:        PJ                  ! ^\L        ^,           4      ,          4      34      S n'        ^V,
          S PN                  ,          S n(        VS PN                  ,          ^\:        PJ                  ! ^\L        ^,           4      ,          ,           S n)        \:        PT                  ! \L        ^,           S P                  3S P                  P8                  R7      pS P                  V^ &   VS P                  ,          S P                  ,          V^&   VS n+        ^S n,        ^ S n-        RS n.        R# )T)support_complexNgQ?      ?c                 L   < S;P                   ^,          un         \        V 4      # r   )nlur   Aselfs   &r$   luBDF.__init__.<locals>.lu   s    AAwr&   c                 $    V P                  V4      # N)solver:   bs   &&r$   r;   BDF.__init__.<locals>.solve_lu   s    xx{"r&   csc)formatdtypec                 P   < S;P                   ^,          un         \        V RR7      # )r   T)overwrite_a)rO   r   rP   s   &r$   rS   rT      s    A 55r&   c                     \        WR R7      # )T)overwrite_b)r   rX   s   &&r$   r;   rZ      s    488r&   r]   )r   gGzǿgqqgugsh|?r   )/r   super__init__r
   max_stepr   nrtolatolr5   tr?   r   	directionh_absr   	h_abs_olderror_norm_oldmaxr   min
newton_tol
jac_factor_validate_jacjacr"   r   r   r]   r   identityrS   r;   r!   arrayhstackcumsumr   	MAX_ORDERgammaalphaerror_constemptyr*   r   n_equal_stepsr:   )rR   r5   t0y0t_boundre   rg   rh   rs   jac_sparsity
vectorized
first_step
extraneousrC   rS   r;   r!   kappar*   	__class__s   f&&&&&&&&&&&,      r$   rd   BDF.__init__   s_    	
#"z)- 	 	/)(3+D?	49HHTVVTVV$,TXXtvvtvv-4-1^^Q-1YY		CDJ
 -ZWEDJ"b3hos4/EF--c@$&DFF# DFF5=A69 DFF$&&,,7A @AYY299Q1i!m1L-L#MNO
%i4::-
 4::-BIIaQ4O0OOHHi!mTVV,DFFLLAvv!4::~.!
r&   c                  a aaa S P                   pS P                  oSfC   Se,   \        S4      '       d   \        S4      o\	        S4      pSV3oV V3R lpV! VS4      pWV3# \        S4      '       d   S! VS4      pS ;P                  ^,          un        \        V4      '       d!   \        VSP                  R7      pVV V3R lpM*\        P                  ! VSP                  R7      pVV V3R lpVP                  S P                  S P                  38w  d3   \        RS P                  S P                  3 RVP                   R24      h WV3# \        S4      '       d   \        SSP                  R7      pM"\        P                  ! SSP                  R7      pVP                  S P                  S P                  38w  d3   \        RS P                  S P                  3 RVP                   R24      hR pWV3# )Nc           	         < S;P                   ^,          un         SP                  W4      p\        SP                  WVSP                  SP
                  S4      w  pSn        V# rN   )njev
fun_singler   fun_vectorizedrh   rq   )ri   r?   rC   r"   rR   sparsitys   &&  r$   jac_wrapped&BDF._validate_jac.<locals>.jac_wrapped  sR    		Q	OOA)%,T-@-@!-1YY-5&7"4? r&   rb   c                 p   < S;P                   ^,          un         \        S! W4      SP                  R7      # r   rb   )r   r   r]   ri   r?   rs   rR   r   s   &&r$   r   r     s%    IINI%c!irxx@@r&   c                    < S;P                   ^,          un         \        P                  ! S! W4      SP                  R7      # r   )r   r   asarrayr]   r   s   &&r$   r   r   !  s)    IINI::c!irxx@@r&   z `jac` is expected to have shape z, but actually has .)ri   r?   r   r   r	   callabler   r]   r   r   shaperf   
ValueError)rR   rs   r   r~   groupsr   r"   r   s   fff    @r$   rr   BDF._validate_jac  s   VVVV;#H%%)(3H&x0$f- B#A> ~= c]]BAIINI{{q1A A JJq1A ww466466** #CTVVTVVDTCU V667ggYa"A B B + ~ }}s"((3JJs"((3ww466466** #CTVVTVVDTCU V667ggYa"A B BK~r&   c                   V P                   pV P                  pV P                  p^
\        P                  ! \        P
                  ! WP                  \        P                  ,          4      V,
          4      ,          pV P                  V8  d1   Tp\        W P                  W0P                  ,          4       ^ V n        MMV P                  V8  d1   Tp\        W P                  W@P                  ,          4       ^ V n        MV P                  pV P                  pV P                  pV P                  pV P                  p	V P                  p
V P                   pV P"                  pV P$                  pV P&                  RJ pRpV'       Eg   WT8  d   RV P(                  3# WPP                  ,          pVV,           pV P                  VV P*                  ,
          ,          ^ 8  dD   V P*                  p\        W(\        P                  ! VV,
          4      V,          4       ^ V n        RpVV,
          p\        P                  ! V4      p\        P,                  ! VRV^,            ^ R7      pWg\        P                  ! V4      ,          ,           p\        P.                  ! V^V^,            P0                  V
^V^,            4      W,          ,          pRpVW,          ,          pV'       g   Vf*   V P3                  V P4                  VV,          ,
          4      p\7        V P8                  VVVVWP:                  VV P<                  4	      w  ppppV'       d   Kt  V'       d   MV P'                  VV4      pRpRpK  V'       g$   RpVV,          p\        W(V4       ^ V n        RpEK  R^\>        ,          ^,           ,          ^\>        ,          X,           ,          pWg\        P                  ! X4      ,          ,           pW,          X,          p\A        VV,          4      pV^8  dL   \C        \D        VVR	V^,           ,          ,          ,          4      pVV,          p\        W(V4       ^ V n        EK  RpEK  V ;P                  ^,          un        XV n         XV n#        WPn        Wn        Wn        XW(^,           ,          ,
          W(^,           &   VW(^,           &   \I        \K        V^,           4      4       F&  pVV;;,          VV^,           ,          ,          uu&   K(  	  V P                  V^,           8  d   R
# V^8  d0   W^,
          ,          W(,          ,          p\A        VX,          4      p M\        P                  p V\L        8  d7   W^,           ,          W(^,           ,          ,          p!\A        V!X,          4      p"M\        P                  p"\        PN                  ! V XV".4      p#\        PP                  ! RR7      ;_uu_ 4        V#R	\        PR                  ! W^,           4      ,          ,          p$RRR4       \        PT                  ! X$4      ^,
          p%VV%,          pWn
        \W        \X        X\        PB                  ! V$4      ,          4      pV ;P                  V,          un        \        W(V4       ^ V n        RV n        R
#   + '       g   i     L; i)
   NFr   TrL   g?ignore)divide)TN)-ri   r*   re   r   abs	nextafterrj   infrk   r.   r   r}   rh   rg   rz   ry   r{   r"   r:   rs   TOO_SMALL_STEPr   sumr(   r)   rS   r!   rG   r5   r;   rp   r2   r   rn   
MIN_FACTORr?   reversedr1   rx   ru   errstater   argmaxro   
MAX_FACTOR)&rR   ri   r*   re   min_steprk   rh   rg   r   rz   ry   r{   r"   r:   current_jacstep_acceptedhr6   r7   r<   r9   rA   r8   n_itery_newr>   r    safetyerror
error_normierror_merror_m_normerror_perror_p_normerror_normsfactorsdelta_orders&   &                                     r$   
_step_implBDF._step_impl5  s   FFFF==r||A~~/FG!KLL:: EQ

Hzz$9:!"DZZ("EQ

Hzz$9:!"DJJEyyyy





&&FFWWhh$&-d1111&AEE~~!56:266%!)#4u#<=%&"	AFF1IEq%!)}15I"&&"333E&&1eai**E!UQY,?@5<OCIEL A:!a%0B.>HHeY3MM4??/,+	65! !y"	2AB"&K6*%&"A.23q>7I9?8@ AF "&&-//E&*Eeem,JA~Z#jR5195E&FFH6*%&" !%a
 1QY<'!)!)%	*+AaDAa!eHD , 	)19!!),qx7G%0L66L9!!),q|;G%0L66Lhhj,GH[[))!b299UAI+F&FGG * ii(1,
Z"&&/!9:

f
6" *)s   5,Z55[	c           
         \        V P                  V P                  V P                  V P                  ,          V P
                  V P                  R V P
                  ^,            P                  4       4      # rV   )BdfDenseOutputt_oldri   rk   rj   r   r*   r0   )rR   s   &r$   _dense_output_implBDF._dense_output_impl  sQ    djj$&&$**t~~2M"jj$&&$**q.*A*F*F*HJ 	Jr&   )r*   r!   r"   r:   rz   rh   r{   rm   ry   rk   rl   rs   rq   rS   re   r}   rp   r   rg   r;   ri   r?   )__name__
__module____qualname____firstlineno____doc__r   r   rd   rr   r   r   __static_attributes____classdictcell____classcell__r   __classdict__s   @@r$   rI   rI   H   sB     {z 79ff4d!d:x1fM^J Jr&   rI   c                   8   a a ] tR tRt oV 3R ltR tRtVtV ;t# )r   i  c                  < \         SV `  W4       W@n        V P                  V\        P
                  ! V P                  4      ,          ,
          V n        V^\        P
                  ! V P                  4      ,           ,          V n        WPn        R# )r   N)	rc   rd   r   ri   r   r   t_shiftdenomr*   )rR   r   ri   r   r   r*   r   s   &&&&&&r$   rd   BdfDenseOutput.__init__  sZ    "
vvBIIdjj$9 99!bii

334
r&   c                   VP                   ^ 8X  d;   WP                  ,
          V P                  ,          p\        P                  ! V4      pMIWP                  R,          ,
          V P                  R,          ,          p\        P                  ! V^ R7      p\        P
                  ! V P                  R,          P                  V4      pVP                   ^8X  d   W@P                  ^ ,          ,          pV# W@P                  R,          ,          pV# )r   r   r   r   )r   r   N)ndimr   r   r   r   r(   r*   r)   )rR   ri   xpr?   s   &&   r$   
_call_implBdfDenseOutput._call_impl  s    66Q;\\!TZZ/A

1A\\'**djj.AAA

11%AFF466":<<#66Q;NA  
##Ar&   )r*   r   r   r   )	r   r   r   r   rd   r   r   r   r   r   s   @@r$   r   r     s      r&   r   )"numpyr   scipy.linalgr   r   scipy.sparser   r   r   scipy.sparse.linalgr   scipy.optimize._numdiffr	   commonr
   r   r   r   r   r   r   r   baser   r   rx   r2   r   r   r%   r.   rG   rI   r    r&   r$   <module>r      sn     , 2 2 $ 1& & & ) 	

!0!"H~J) ~JB[ r&   