solve_newton(n, m, h, col_fun, bc, jac, y, p, B, bvp_tol, bc_tol)
This is a simple Newton method with a backtracking line search. As advised in , an affine-invariant criterion function F = ||J^-1 r||^2 is used, where J is the Jacobian matrix at the current iteration and r is the vector or collocation residuals (values of the system lhs).
The method alters between full Newton iterations and the fixed-Jacobian iterations based
There are other tricks proposed in , but they are not used as they don't seem to improve anything significantly, and even break the convergence on some test problems I tried.
All important parameters of the algorithm are defined inside the function.
Number of equations in the ODE system.
Number of nodes in the mesh.
Mesh intervals.
Function computing collocation residuals.
Function computing boundary condition residuals.
Function computing the Jacobian of the whole system (including collocation and boundary condition residuals). It is supposed to return csc_matrix.
Initial guess for the function values at the mesh nodes.
Initial guess for the unknown parameters.
Matrix to force the S y(a) = 0 condition for a problems with the singular term. If None, the singular term is assumed to be absent.
Tolerance to which we want to solve a BVP.
Tolerance to which we want to satisfy the boundary conditions.
Final iterate for the function values at the mesh nodes.
Final iterate for the unknown parameters.
True, if the LU decomposition failed because Jacobian turned out to be singular.
Solve the nonlinear collocation system by a Newton method.
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