bundles / scipy 1.17.1 / scipy / integrate / _ivp / bdf / BDF
class
scipy.integrate._ivp.bdf:BDF
source: /scipy/integrate/_ivp/bdf.py :72
Signature
class BDF ( fun , t0 , y0 , t_bound , max_step = inf , rtol = 0.001 , atol = 1e-06 , jac = None , jac_sparsity = None , vectorized = False , first_step = None , ** extraneous ) Members
Summary
Implicit method based on backward-differentiation formulas.
Extended Summary
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: callableRight-hand side of the system: the time derivative of the state
yat timet. The calling signature isfun(t, y), wheretis a scalar andyis an ndarray withlen(y) = len(y0).funmust return an array of the same shape asy. Seevectorizedfor more information.t0: floatInitial time.
y0: array_like, shape (n,)Initial state.
t_bound: floatBoundary time - the integration won't continue beyond it. It also determines the direction of the integration.
first_step: float or None, optionalInitial step size. Default is
Nonewhich means that the algorithm should choose.max_step: float, optionalMaximum 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, optionalRelative and absolute tolerances. The solver keeps the local error estimates less than
atol + rtol * abs(y). Herertolcontrols a relative accuracy (number of correct digits), whileatolcontrols absolute accuracy (number of correct decimal places). To achieve the desiredrtol, setatolto be smaller than the smallest value that can be expected fromrtol * abs(y)so thatrtoldominates the allowable error. Ifatolis larger thanrtol * abs(y)the number of correct digits is not guaranteed. Conversely, to achieve the desiredatolsetrtolsuch thatrtol * abs(y)is always smaller thanatol. If components of y have different scales, it might be beneficial to set differentatolvalues for different components by passing array_like with shape (n,) foratol. Default values are 1e-3 forrtoland 1e-6 foratol.jac: {None, array_like, sparse_matrix, callable}, optionalJacobian 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}, optionalDefines a sparsity structure of the Jacobian matrix for a finite-difference approximation. Its shape must be (n, n). This argument is ignored if
jacis notNone. 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, optionalWhether
funcan be called in a vectorized fashion. Default is False.If
vectorizedis False,funwill always be called withyof shape(n,), wheren = len(y0).If
vectorizedis True,funmay be called withyof shape(n, k), wherekis an integer. In this case,funmust behave such thatfun(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 ofy).Setting
vectorized=Trueallows for faster finite difference approximation of the Jacobian by this method, but may result in slower execution overall in some circumstances (e.g. smalllen(y0)).
Attributes
n: intNumber of equations.
status: stringCurrent status of the solver: 'running', 'finished' or 'failed'.
t_bound: floatBoundary time.
direction: floatIntegration direction: +1 or -1.
t: floatCurrent time.
y: ndarrayCurrent state.
t_old: floatPrevious time. None if no steps were made yet.
step_size: floatSize of the last successful step. None if no steps were made yet.
nfev: intNumber of evaluations of the right-hand side.
njev: intNumber of evaluations of the Jacobian.
nlu: intNumber of LU decompositions.
Aliases
-
scipy.integrate.BDF