GNU Octave 2.1.x 日本語マニュアル/微分方程式
23　微分方程式　

Octaveは微分方程式を解くための組み込み関数を2つ持っています。 両方ともFortranで書かれた信頼性の高いODE(常微分方程式:Ordinary Differential Equation)ソルバーに基づいています。
23　微分方程式　

The function lsode can be used to solve ODEs of the form dx dt = f(x; t) using Hindmarsh’s ODE solver Lsode.
23　微分方程式　

[Loadable Function]
23　微分方程式　

Solve the set of differential equations
23　微分方程式　

d x d t = f ( x ; t ) {\displaystyle dxdt=f(x;t)}
23　微分方程式　

with
23　微分方程式　

x(t0) = x0
23　微分方程式　

The solution is returned in the matrix x, with each row corresponding to an elementof the vector t.
23　微分方程式　

The first element of t should be t0 and should correspond to the initialstate of the system x 0, so that the first row of the output is x 0.
23　微分方程式　

The first argument, fcn, is a string that names the function to call to compute the vector of right hand sides for the set of equations. The function must have the form
23　微分方程式　

x d o t = f ( x , t ) {\displaystyle xdot=f(x,t)}
23　微分方程式　

in which xdot and x are vectors and t is a scalar.
23　微分方程式　

If fcn is a two-element string array, the first element names the function f described above, and the second element names a function to compute the Jacobian of f. The Jacobian function must have the form
23　微分方程式　

j a c = j ( x , t ) {\displaystyle jac=j(x,t)}
23　微分方程式　

in which jac is the matrix of partial derivatives
23　微分方程式　

The second and third arguments specify the intial state of the system, x0, and the initial value of the independent variable t0.
23　微分方程式　

The fourth argument is optional, and may be used to specify a set of times that the ODE solver should not integrate past.
23　微分方程式　

It is useful for avoiding difficulties with singularities and points where there is a discontinuity in the derivative.
23　微分方程式　

After a successful computation, the value of istate will be 2 (consistent with the Fortran version of Lsode).
23　微分方程式　

If the computation is not successful, istate will be something other than 2 and msg will contain additional information.
23　微分方程式　

You can use the function lsode_options to set optional parameters for lsode.
23　微分方程式　

[Loadable Function]
23　微分方程式　

When called with two arguments, this function allows you set options parameters for the function lsode. Given one argument, lsode_options returns the value of the corresponding option. If no arguments are supplied, the names of all the available options and their current values are displayed.
23　微分方程式　

Options include
23　微分方程式　

"absolute tolerance"
23　微分方程式　

Absolute tolerance. May be either vector or scalar. If a vector, it must match the dimension of the state vector.
23　微分方程式　

"relative tolerance"
23　微分方程式　

Relative tolerance parameter. Unlike the absolute tolerance, this parameter may only be a scalar.
23　微分方程式　

The local error test applied at each integration step is abs (local error in x(i)) <= rtol * abs (y(i)) + atol(i)
23　微分方程式　

"integration method"
23　微分方程式　

A string specifing the method of integration to use to solve the ODE system. Valid values are
23　微分方程式　

"adams"
23　微分方程式　

"non-stiff"
23　微分方程式　

No Jacobian used (even if it is available).
23　微分方程式　

"bdf"
23　微分方程式　

"stiff" Use stiff backward differentiation formula (BDF) method. If a function to compute the Jacobian is not supplied, lsode will compute a finite difference approximation of the Jacobian matrix.
23　微分方程式　

"initial step size"
23　微分方程式　

The step size to be attempted on the first step (default is determined automatically).
23　微分方程式　

"maximum order"
23　微分方程式　

Restrict the maximum order of the solution method. If using the Adams method, this option must be between 1 and 12. Otherwise, it must be between 1 and 5, inclusive.
23　微分方程式　

"maximum step size"
23　微分方程式　

Setting the maximum stepsize will avoid passing over very large regions (default is not specified).
23　微分方程式　

"minimum step size"
23　微分方程式　

The minimum absolute step size allowed (default is 0).
23　微分方程式　

"step limit"
23　微分方程式　

Maximum number of steps allowed (default is 100000).
23　微分方程式　

Here is an example of solving a set of three differential equations using lsode. Given the function
23　微分方程式　

and the initial condition x0 = [ 4; 1.1; 4 ], the set of equations can be integrated using the command
23　微分方程式　

If you try this, you will see that the value of the result changes dramatically between t = 0 and 5, and again around t = 305. A more efficient set of output points might be
23　微分方程式　

See Alan C. Hindmarsh, ODEPACK, A Systematized Collection of ODE Solvers, in Scientific Computing, R. S. Stepleman, editor, (1983) for more information about the inner workings of lsode.
23　微分方程式　

The function daspk can be used to solve DAEs of the form
23　微分方程式　

0 = f(x ̇ ; x; t); x(t = 0) = x0; x ̇ (t = 0) = x ̇ 0
23　微分方程式　

using Petzold’s DAE solver Daspk.
23　微分方程式　

[Loadable Function]
23　微分方程式　

Solve the set of differential-algebraic equations
23　微分方程式　

0 = f(x; x ̇ ; t)
23　微分方程式　

with
23　微分方程式　

x(t0) = x0; x ̇ (t0) = x ̇ 0
23　微分方程式　

The solution is returned in the matrices x and xdot, with each row in the result matrices corresponding to one of the elements in the vector t. The first element of t should be t0 and correspond to the initial state of the system x 0 and its derivative xdot 0, so that the first row of the output x is x 0 and the first row of the output xdot is xdot 0.
23　微分方程式　

The first argument, fcn, is a string that names the function to call to compute the vector of residuals for the set of equations. It must have the form
23　微分方程式　

res = f (x, xdot, t)
23　微分方程式　

in which x, xdot, and res are vectors, and t is a scalar. If fcn is a two-element string array, the first element names the function f described above, and the second element names a function to compute the modified Jacobian
23　微分方程式　

J = @f @x + c @f @x ̇
23　微分方程式　

The modified Jacobian function must have the form
23　微分方程式　

jac = j (x, xdot, t, c)
23　微分方程式　

The second and third arguments to daspk specify the initial condition of the states and their derivatives, and the fourth argument specifies a vector of output times at which the solution is desired, including the time corresponding to the initial condition. The set of initial states and derivatives are not strictly required to be consistent. If they are not consistent, you must use the daspk_options function to provide additional information so that daspk can compute a consistent starting point. The fifth argument is optional, and may be used to specify a set of times that the DAE solver should not integrate past. It is useful for avoiding difficulties with singularities and points where there is a discontinuity in the derivative. After a successful computation, the value of istate will be greater than zero (consistent with the Fortran version of Daspk). If the computation is not successful, the value of istate will be less than zero and msg will contain additional information. You can use the function daspk_options to set optional parameters for daspk.
23　微分方程式　

[Loadable Function]
23　微分方程式　

When called with two arguments, this function allows you set options parameters for the function daspk. Given one argument, daspk_options returns the value of the corresponding option. If no arguments are supplied, the names of all the available options and their current values are displayed. Options include
23　微分方程式　

"absolute tolerance"
23　微分方程式　

Absolute tolerance. May be either vector or scalar. If a vector, it must match the dimension of the state vector, and the relative tolerance must also be a vector of the same length.
23　微分方程式　

"relative tolerance"
23　微分方程式　

Relative tolerance. May be either vector or scalar. If a vector, it must match the dimension of the state vector, and the absolute tolerance must also be a vector of the same length. The local error test applied at each integration step is
23　微分方程式　

abs (local error in x(i)) <= rtol(i) * abs (Y(i)) + atol(i)
23　微分方程式　

"compute consistent initial condition"
23　微分方程式　

Denoting the differential variables in the state vector by ‘Y_d’ and the algebraic variables by ‘Y_a’, ddaspk can solve one of two initialization problems:
23　微分方程式　

1. Given Y d, calculate Y a and Y’ d
23　微分方程式　

2. Given Y’, calculate Y.
23　微分方程式　

In either case, initial values for the given components are input, and initial guesses for the unknown components must also be provided as input. Set this option to 1 to solve the first problem, or 2 to solve the second (the default default is 0, so you must provide a set of initial conditions that are consistent). If this option is set to a nonzero value, you must also set the "algebraic variables" option to declare which variables in the problem are algebraic.
23　微分方程式　

"use initial condition heuristics"
23　微分方程式　

Set to a nonzero value to use the initial condition heuristics options described below.
23　微分方程式　

"initial condition heuristics"
23　微分方程式　

A vector of the following parameters that can be used to control the initial condition calculation. MXNIT Maximum number of Newton iterations (default is 5). MXNJ Maximum number of Jacobian evaluations (default is 6). MXNH Maximum number of values of the artificial stepsize parameter to be tried if the "compute consistent initial condition" option has been set to 1 (default is 5). Note that the maximum number of Newton iterations allowed in all is MXNIT*MXNJ*MXNH if the "compute consistent initial condition" option has been set to 1 and MXNIT*MXNJ if it is set to 2. LSOFF Set to a nonzero value to disable the linesearch algorithm (default is 0). STPTOL Minimum scaled step in linesearch algorithm (default is eps^(2/3)). EPINIT Swing factor in the Newton iteration convergence test. The test is applied to the residual vector, premultiplied by the approximate Jacobian. For convergence, the weighted RMS norm of this vector (scaled by the error weights) must be less than EPINIT*EPCON, where EPCON = 0.33 is the analogous test constant used in the time steps. The default is EPINIT = 0.01.
23　微分方程式　

"print initial condition info"
23　微分方程式　

Set this option to a nonzero value to display detailed information about the initial condition calculation (default is 0).
23　微分方程式　

"exclude algebraic variables from error test"
23　微分方程式　

Set to a nonzero value to exclude algebraic variables from the error test. You must also set the "algebraic variables" option to declare which variables in the problem are algebraic (default is 0).
23　微分方程式　

"algebraic variables"
23　微分方程式　

A vector of the same length as the state vector. A nonzero element indicates that the corresponding element of the state vector is an algebraic variable (i.e., its derivative does not appear explicitly in the equation set. This option is required by the compute consistent initial condition" and "exclude algebraic variables from error test" options.
23　微分方程式　

"enforce inequality constraints"
23　微分方程式　

Set to one of the following values to enforce the inequality constraints specified by the "inequality constraint types" option (default is 0).
23　微分方程式　

1. To have constraint checking only in the initial condition calculation. 2. To enforce constraint checking during the integration. 3. To enforce both options 1 and 2.
23　微分方程式　

"inequality constraint types"
23　微分方程式　

A vector of the same length as the state specifying the type of inequality constraint. Each element of the vector corresponds to an element of the state and should be assigned one of the following codes
23　微分方程式　

-2 Less than zero.
23　微分方程式　

-1 Less than or equal to zero.
23　微分方程式　

0 Not constrained.
23　微分方程式　

1 Greater than or equal to zero.
23　微分方程式　

2 Greater than zero.
23　微分方程式　

This option only has an effect if the "enforce inequality constraints" option is nonzero.
23　微分方程式　

"initial step size"
23　微分方程式　

Differential-algebraic problems may occaisionally suffer from severe scaling difficulties on the first step. If you know a great deal about the scaling of your problem, you can help to alleviate this problem by specifying an initial stepsize (default is computed automatically).
23　微分方程式　

"maximum order"
23　微分方程式　

Restrict the maximum order of the solution method. This option must be between 1 and 5, inclusive (default is 5).
23　微分方程式　

"maximum step size"
23　微分方程式　

Setting the maximum stepsize will avoid passing over very large regions (default is not specified). Octave also includes Dassl, an earlier version of Daspk, and dasrt, which can be used to solve DAEs with constraints (stopping conditions).
23　微分方程式　

[Loadable Function]
23　微分方程式　

Solve the set of differential-algebraic equations
23　微分方程式　

0 = f(x; x ̇ ; t)
23　微分方程式　

with
23　微分方程式　

x(t0) = x0; x ̇ (t0) = x ̇ 0
23　微分方程式　

with functional stopping criteria (root solving). The solution is returned in the matrices x and xdot, with each row in the result matrices corresponding to one of the elements in the vector t out. The first element of t should be t0 and correspond to the initial state of the system x 0 and its derivative xdot 0, so that the first row of the output x is x 0 and the first row of the output xdot is xdot 0. The vector t provides an upper limit on the length of the integration. If the stopping condition is met, the vector t out will be shorter than t, and the final element of t out will be the point at which the stopping condition was met, and may not correspond to any element of the vector t. The first argument, fcn, is a string that names the function to call to compute the vector of residuals for the set of equations. It must have the form
23　微分方程式　

res = f (x, xdot, t)
23　微分方程式　

in which x, xdot, and res are vectors, and t is a scalar. If fcn is a two-element string array, the first element names the function f described above, and the second element names a function to compute the modified Jacobian
23　微分方程式　

J = @f @x + c @f @x ̇
23　微分方程式　

The modified Jacobian function must have the form
23　微分方程式　

jac = j (x, xdot, t, c)
23　微分方程式　

The optional second argument names a function that defines the constraint functions whose roots are desired during the integration. This function must have the form
23　微分方程式　

g_out = g (x, t)
23　微分方程式　

and return a vector of the constraint function values. If the value of any of the constraint functions changes sign, Dasrt will attempt to stop the integration at the point of the sign change. If the name of the constraint function is omitted, dasrt solves the same problem as daspk or dassl. Note that because of numerical errors in the constraint functions due to roundoff and integration error, Dasrt may return false roots, or return the same root at two or more nearly equal values of T. If such false roots are suspected, the user should consider smaller error tolerances or higher precision in the evaluation of the constraint functions.
23　微分方程式　

If a root of some constraint function defines the end of the problem, the input to Dasrt should nevertheless allow integration to a point slightly past that root, so that Dasrt can locate the root by interpolation. The third and fourth arguments to dasrt specify the initial condition of the states and their derivatives, and the fourth argument specifies a vector of output times at which the solution is desired, including the time corresponding to the initial condition. The set of initial states and derivatives are not strictly required to be consistent. In practice, however, Dassl is not very good at determining a consistent set for you, so it is best if you ensure that the initial values result in the function evaluating to zero. The sixth argument is optional, and may be used to specify a set of times that the DAE solver should not integrate past. It is useful for avoiding difficulties with singularities and points where there is a discontinuity in the derivative. After a successful computation, the value of istate will be greater than zero (consistent with the Fortran version of Dassl). If the computation is not successful, the value of istate will be less than zero and msg will contain additional information. You can use the function dasrt_options to set optional parameters for dasrt.
23　微分方程式　

[Loadable Function]
23　微分方程式　

When called with two arguments, this function allows you set options parameters for the function dasrt. Given one argument, dasrt_options returns the value of the corresponding option. If no arguments are supplied, the names of all the available options and their current values are displayed. Options include
23　微分方程式　

"absolute tolerance"
23　微分方程式　

Absolute tolerance. May be either vector or scalar. If a vector, it must match the dimension of the state vector, and the relative tolerance must also be a vector of the same length. "relative tolerance" Relative tolerance. May be either vector or scalar. If a vector, it must match the dimension of the state vector, and the absolute tolerance must also be a vector of the same length. The local error test applied at each integration step is abs (local error in x(i)) <= rtol(i) * abs (Y(i)) + atol(i)
23　微分方程式　

"initial step size"
23　微分方程式　

Differential-algebraic problems may occaisionally suffer from severe scaling difficulties on the first step. If you know a great deal about the scaling of your problem, you can help to alleviate this problem by specifying an initial stepsize. "maximum order" Restrict the maximum order of the solution method. This option must be between 1 and 5, inclusive.
23　微分方程式　

"maximum step size"
23　微分方程式　

Setting the maximum stepsize will avoid passing over very large regions. "step limit" Maximum number of integration steps to attempt on a single call to the underlying Fortran code. See K. E. Brenan, et al., Numerical Solution of Initial-Value Problems in Differential- Algebraic Equations, North-Holland (1989) for more information about the implementation of Dassl.