<< Events Options, features and user functions Options (kinsol) >>

Scilab Help >> Differential Equations > SUite of Nonlinear and DIfferential/ALgebraic equation - SUNDIALS solvers > Options, features and user functions > Jacobian

Jacobian

Specifying a user-supplied Jacobian or its approximation

Syntax

... = solver( ... , jacobian = jacFn)
... = solver( ... , jacobian = jacFn, jacBand = [ml,mu])
... = solver( ... , jacBand = [ml,mu])
... = solver( ... , jacPattern = jacSp)
... = solver( ... , jacobian = jacFn, jacNonZeros = nnz, jacFormat = jFmt)

Arguments

jacFn

A Scilab function, a list, a string, a matrix (dense or sparse).

[ml,mu]

A vector of two positive integers [mu,ml] giving respectively the upper and lower half bandwidth of the Jacobian.

jacSp

A sparse matrix with the same sparsity pattern as the true Jacobian.

nnz

An integer, the number of non-zeros terms when the Jacobian is sparse and given as the output of a DLL entrypoint.

jFmt

A string "CSC" (the default) or "CSR" giving the sparse Jacobian format when given as the output of a DLL entrypoint.

Description

When an ODE, DAE or nonlinear equations solver method need to solve a linear system with a direct method, the Jacobian matrix of the right hand side of the system is by default approximated by finite differences. When the Jacobian is unknown but has a band structure, setting the jacBand option will allow the approximation scheme to use only mu+ml+1 calls of the right hand side, which can help the solver effort if the number of equations is large.

However, solver iterations can be accelerated and precision can be improved further by giving the true Jacobian with the jacobian option. Note that using any of the above 3 options (jacobian, jacBand, jacPattern, jacNonZeros) without specifying a method automatically selects the default one needing a Jacobian. For example specifying a Jacobian selects the BDF method in a cvode call and the inexact Newton method in a kinsol call. In addition, note that when using arkode with an implicit/explicit method jacFn denotes the Jacobian of the stiff right hand side only, which is set by the stiffRhs option (see the arkode help page). Below we consider nonlinear equations, ODEs and DAEs in three different sections as the Jacobian is defined differently, but in all situations:

General information about the different ways of providing a user function (and eventual user parameters) is given in the User Functions help page.

User nonlinear equations Jacobian

In that case we deal with the Jacobian of the Nonlinear Algebraic Equations System

with respect to y and jacFn can be:

User ODE Jacobian

In that case we deal with the Jacobian of the right-hand side of the ODE

with respect to y and jacFn can be:

User DAE Jacobian

In that case the user function is supposed to compute

where the DAE is given by and c is an arbitrary scalar. The option value jacFn can be:

See also


Report an issue
<< Events Options, features and user functions Options (kinsol) >>