bundles / scipy 1.17.1 / scipy / integrate / _ivp / common / num_jac
function
scipy.integrate._ivp.common:num_jac
Signature
def num_jac ( fun , t , y , f , threshold , factor , sparsity = None ) Summary
Finite differences Jacobian approximation tailored for ODE solvers.
Extended Summary
This function computes finite difference approximation to the Jacobian matrix of fun with respect to y using forward differences. The Jacobian matrix has shape (n, n) and its element (i, j) is equal to d f_i / d y_j.
A special feature of this function is the ability to correct the step size from iteration to iteration. The main idea is to keep the finite difference significantly separated from its round-off error which approximately equals EPS * np.abs(f). It reduces a possibility of a huge error and assures that the estimated derivative are reasonably close to the true values (i.e., the finite difference approximation is at least qualitatively reflects the structure of the true Jacobian).
Parameters
fun: callableRight-hand side of the system implemented in a vectorized fashion.
t: floatCurrent time.
y: ndarray, shape (n,)Current state.
f: ndarray, shape (n,)Value of the right hand side at (t, y).
threshold: floatThreshold for
yvalue used for computing the step size asfactor * np.maximum(np.abs(y), threshold). Typically, the value of absolute tolerance (atol) for a solver should be passed asthreshold.factor: ndarray with shape (n,) or NoneFactor to use for computing the step size. Pass None for the very evaluation, then use the value returned from this function.
sparsity: tuple (structure, groups) or NoneSparsity structure of the Jacobian,
structuremust be csc_matrix.
Returns
J: ndarray or csc_matrix, shape (n, n)Jacobian matrix.
factor: ndarray, shape (n,)Suggested
factorfor the next evaluation.
Aliases
-
scipy.integrate._ivp.bdf.num_jac