{ } Raw JSON

bundles / scipy 1.17.1 / scipy / integrate / _bvp / construct_global_jac

function

scipy.integrate._bvp:construct_global_jac

source: /scipy/integrate/_bvp.py :159

Signature

def   construct_global_jac ( n m k i_jac j_jac h df_dy df_dy_middle df_dp df_dp_middle dbc_dya dbc_dyb dbc_dp )

Summary

Construct the Jacobian of the collocation system.

Extended Summary

There are n * m + k functions: m - 1 collocations residuals, each containing n components, followed by n + k boundary condition residuals.

There are n * m + k variables: m vectors of y, each containing n components, followed by k values of vector p.

For example, let m = 4, n = 2 and k = 1, then the Jacobian will have the following sparsity structure:

1 1 2 2 0 0 0 0 5 1 1 2 2 0 0 0 0 5 0 0 1 1 2 2 0 0 5 0 0 1 1 2 2 0 0 5 0 0 0 0 1 1 2 2 5 0 0 0 0 1 1 2 2 5

3 3 0 0 0 0 4 4 6 3 3 0 0 0 0 4 4 6 3 3 0 0 0 0 4 4 6

Zeros denote identically zero values, other values denote different kinds of blocks in the matrix (see below). The blank row indicates the separation of collocation residuals from boundary conditions. And the blank column indicates the separation of y values from p values.

Refer to [1] (p. 306) for the formula of n x n blocks for derivatives of collocation residuals with respect to y.

Parameters

n : int

Number of equations in the ODE system.

m : int

Number of nodes in the mesh.

k : int

Number of the unknown parameters.

i_jac, j_jac : ndarray

Row and column indices returned by compute_jac_indices. They represent different blocks in the Jacobian matrix in the following order (see the scheme above):

  • 1: m - 1 diagonal n x n blocks for the collocation residuals.

  • 2: m - 1 off-diagonal n x n blocks for the collocation residuals.

  • 3(n + k) x n block for the dependency of the boundary conditions on ya.

  • 4: (n + k) x n block for the dependency of the boundary conditions on yb.

  • 5: (m - 1) * n x k block for the dependency of the collocation residuals on p.

  • 6: (n + k) x k block for the dependency of the boundary conditions on p.

df_dy : ndarray, shape (n, n, m)

Jacobian of f with respect to y computed at the mesh nodes.

df_dy_middle : ndarray, shape (n, n, m - 1)

Jacobian of f with respect to y computed at the middle between the mesh nodes.

df_dp : ndarray with shape (n, k, m) or None

Jacobian of f with respect to p computed at the mesh nodes.

df_dp_middle : ndarray with shape (n, k, m - 1) or None

Jacobian of f with respect to p computed at the middle between the mesh nodes.

dbc_dya, dbc_dyb : ndarray, shape (n, n)

Jacobian of bc with respect to ya and yb.

dbc_dp : ndarray with shape (n, k) or None

Jacobian of bc with respect to p.

Returns

J : csc_matrix, shape (n * m + k, n * m + k)

Jacobian of the collocation system in a sparse form.

Aliases

  • scipy.integrate._bvp.construct_global_jac