num_jac(fun, t, y, f, threshold, factor, sparsity=None)
This function computes finite difference approximation to the Jacobian matrix of :None:None:`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).
Right-hand side of the system implemented in a vectorized fashion.
Current time.
Current state.
Value of the right hand side at (t, y).
Threshold for y
value used for computing the step size as factor * np.maximum(np.abs(y), threshold)
. Typically, the value of absolute tolerance (atol) for a solver should be passed as threshold
.
Factor to use for computing the step size. Pass None for the very evaluation, then use the value returned from this function.
Sparsity structure of the Jacobian, :None:None:`structure`
must be csc_matrix.
Jacobian matrix.
Suggested :None:None:`factor`
for the next evaluation.
Finite differences Jacobian approximation tailored for ODE solvers.
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them