⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ode-initval.texi

📁 开放gsl矩阵运算
💻 TEXI
📖 第 1 页 / 共 2 页
字号:
@cindex differential equations, initial value problems@cindex initial value problems, differential equations@cindex ordinary differential equations, initial value problem@cindex ODEs, initial value problemsThis chapter describes functions for solving ordinary differentialequation (ODE) initial value problems.  The library provides a varietyof low-level methods, such as Runge-Kutta and Bulirsch-Stoer routines,and higher-level components for adaptive step-size control.  Thecomponents can be combined by the user to achieve the desired solution,with full access to any intermediate steps.These functions are declared in the header file @file{gsl_odeiv.h}.@menu* Defining the ODE System::     * Stepping Functions::          * Adaptive Step-size Control::  * Evolution::                   * ODE Example programs::        * ODE References and Further Reading::  @end menu@node Defining the ODE System@section Defining the ODE SystemThe routines solve the general @math{n}-dimensional first-order system,@tex\beforedisplay$${dy_i(t) \over dt} = f_i (t, y_1(t), \dots y_n(t))$$\afterdisplay@end tex@ifinfo@exampledy_i(t)/dt = f_i(t, y_1(t), ..., y_n(t))@end example@end ifinfo@noindentfor @math{i = 1, \dots, n}.  The stepping functions rely on the vectorof derivatives @math{f_i} and the Jacobian matrix, @c{$J_{ij} = \partial f_i(t, y(t)) / \partial y_j$}@math{J_@{ij@} = df_i(t,y(t)) / dy_j}. A system of equations is defined using the @code{gsl_odeiv_system}datatype.@deftp {Data Type} gsl_odeiv_systemThis data type defines a general ODE system with arbitrary parameters.@table @code@item int (* @var{function}) (double t, const double y[], double dydt[], void * params)This function should store the elements of@c{$f(t,y,\hbox{\it params})$}@math{f(t,y,params)} in the array @var{dydt},for arguments (@var{t},@var{y}) and parameters @var{params}@item  int (* @var{jacobian}) (double t, const double y[], double * dfdy, double dfdt[], void * params);This function should store the elements of @math{f(t,y,params)} inthe array @var{dfdt} and the Jacobian matrix @c{$J_{ij}$}@math{J_@{ij@}} in the the array@var{dfdy} regarded as a row-ordered matrix @code{J(i,j) = dfdy[i * dim + j]}where @code{dim} is the dimension of the system.@item size_t @var{dimension};This is the dimension of the system of equations@item void * @var{params}This is a pointer to the arbitrary parameters of the system.@end table@end deftp@node Stepping Functions@section Stepping FunctionsThe lowest level components are the @dfn{stepping functions} whichadvance a solution from time @math{t} to @math{t+h} for a fixedstep-size @math{h} and estimate the resulting local error.@deftypefun {gsl_odeiv_step *} gsl_odeiv_step_alloc (const gsl_odeiv_step_type * @var{T}, size_t @var{dim})This function returns a pointer to a newly allocated instance of astepping function of type @var{T} for a system of @var{dim} dimensions.@end deftypefun@deftypefun int gsl_odeiv_step_reset (gsl_odeiv_step * @var{s})This function resets the stepping function @var{s}.  It should be usedwhenever the next use of @var{s} will not be a continuation of aprevious step.@end deftypefun@deftypefun void gsl_odeiv_step_free (gsl_odeiv_step * @var{s})This function frees all the memory associated with the stepping function@var{s}.@end deftypefun@deftypefun {const char *} gsl_odeiv_step_name (const gsl_odeiv_step * @var{s})This function returns a pointer to the name of the stepping function.For example,@exampleprintf("step method is '%s'\n",        gsl_odeiv_step_name (s));@end example@noindentwould print something like @code{step method is 'rk4'}.@end deftypefun@deftypefun {unsigned int} gsl_odeiv_step_order (const gsl_odeiv_step * @var{s})This function returns the order of the stepping function on the previousstep.  This order can vary if the stepping function itself is adaptive.@end deftypefun@deftypefun int gsl_odeiv_step_apply (gsl_odeiv_step * @var{s}, double @var{t}, double @var{h}, double y[], double yerr[], const double dydt_in[], double dydt_out[], const gsl_odeiv_system * @var{dydt})This function applies the stepping function @var{s} to the system ofequations defined by @var{dydt}, using the step size @var{h} to advancethe system from time @var{t} and state @var{y} to time @var{t}+@var{h}.The new state of the system is stored in @var{y} on output, with anestimate of the absolute error in each component stored in @var{yerr}.If the argument @var{dydt_in} is not null it should point an arraycontaining the derivatives for the system at time @var{t} on input. Thisis optional as the derivatives will be computed internally if they arenot provided, but allows the reuse of existing derivative information.On output the new derivatives of the system at time @var{t}+@var{h} willbe stored in @var{dydt_out} if it is not null.@end deftypefunThe following algorithms are available,@deffn {Step Type} gsl_odeiv_step_rk2@cindex RK2, Runge-Kutta Method@cindex Runge-Kutta methods, ordinary differential equationsEmbedded 2nd order Runge-Kutta with 3rd order error estimate.@end deffn@deffn {Step Type} gsl_odeiv_step_rk4@cindex RK4, Runge-Kutta Method4th order (classical) Runge-Kutta.@end deffn@deffn {Step Type} gsl_odeiv_step_rkf45@cindex Fehlberg method, differential equations@cindex RKF45, Runge-Kutta-Fehlberg methodEmbedded 4th order Runge-Kutta-Fehlberg method with 5th order errorestimate.  This method is a good general-purpose integrator.@end deffn@deffn {Step Type} gsl_odeiv_step_rkck @cindex Runge-Kutta Cash-Karp method@cindex Cash-Karp, Runge-Kutta methodEmbedded 4th order Runge-Kutta Cash-Karp method with 5th order errorestimate.@end deffn@deffn {Step Type} gsl_odeiv_step_rk8pd  @cindex Runge-Kutta Prince-Dormand method@cindex Prince-Dormand, Runge-Kutta methodEmbedded 8th order Runge-Kutta Prince-Dormand method with 9th ordererror estimate.@end deffn@deffn {Step Type} gsl_odeiv_step_rk2imp  Implicit 2nd order Runge-Kutta at Gaussian points@end deffn@deffn {Step Type} gsl_odeiv_step_rk4imp  Implicit 4th order Runge-Kutta at Gaussian points@end deffn@deffn {Step Type} gsl_odeiv_step_bsimp   @cindex Bulirsch-Stoer method@cindex Bader and Deuflhard, Bulirsch-Stoer method.@cindex Deuflhard and Bader, Bulirsch-Stoer method.Implicit Bulirsch-Stoer method of Bader and Deuflhard.@end deffn@deffn {Step Type} gsl_odeiv_step_gear1 @cindex Gear method, differential equationsM=1 implicit Gear method @end deffn@deffn {Step Type} gsl_odeiv_step_gear2 M=2 implicit Gear method@end deffn@node Adaptive Step-size Control@section Adaptive Step-size Control@cindex Adaptive step-size control, differential equationsThe control function examines the proposed change to the solution andits error estimate produced by a stepping function and attempts todetermine the optimal step-size for a user-specified level of error.@deftypefun {gsl_odeiv_control *} gsl_odeiv_control_standard_new (double @var{eps_abs}, double @var{eps_rel}, double @var{a_y}, double @var{a_dydt})The standard control object is a four parameter heuristic based onabsolute and relative errors @var{eps_abs} and @var{eps_rel}, andscaling factors @var{a_y} and @var{a_dydt} for the system state@math{y(t)} and derivatives @math{y'(t)} respectively.The step-size adjustment procedure for this method begins by computingthe desired error level @math{D_i} for each component,@tex\beforedisplay$$D_i = \epsilon_{abs} + \epsilon_{rel} * (a_{y} |y_i| + a_{dydt} h |y'_i|)$$\afterdisplay@end tex@ifinfo@exampleD_i = eps_abs + eps_rel * (a_y |y_i| + a_dydt h |y'_i|)@end example@end ifinfo@noindentand comparing it with the observed error @math{E_i = |yerr_i|}.  If theobserved error @var{E} exceeds the desired error level @var{D} by morethan 10% for any component then the method reduces the step-size by anappropriate factor,@tex\beforedisplay$$h_{new} = h_{old} * S * (D/E)^{1/q}$$\afterdisplay@end tex@ifinfo@exampleh_new = h_old * S * (D/E)^(1/q)@end example@end ifinfo@noindentwhere @math{q} is the consistency order of method (e.g. @math{q=4} for4(5) embedded RK), and @math{S} is a safety factor of 0.9. The ratio@math{D/E} is taken to be the maximum of the ratios@math{D_i/E_i}. If the observed error @math{E} is less than 50% of the desired errorlevel @var{D} for the maximum ratio @math{D_i/E_i} then the algorithmtakes the opportunity to increase the step-size to bring the error inline with the desired level,@tex\beforedisplay$$h_{new} = h_{old} * S * (E/D)^{1/(q+1)}$$\afterdisplay@end tex@ifinfo@exampleh_new = h_old * S * (E/D)^(1/(q+1))@end example@end ifinfo@noindentThis encompasses all the standard error scaling methods.@end deftypefun@deftypefun {gsl_odeiv_control *} gsl_odeiv_control_y_new (double @var{eps_abs}, double @var{eps_rel})This function creates a new control object which will keep the localerror on each step within an absolute error of @var{eps_abs} andrelative error of @var{eps_rel} with respect to the solution @math{y_i(t)}.This is equivalent to the standard control object with @var{a_y}=1 and@var{a_dydt}=0.@end deftypefun@deftypefun {gsl_odeiv_control *} gsl_odeiv_control_yp_new (double @var{eps_abs}, double @var{eps_rel})This function creates a new control object which will keep the localerror on each step within an absolute error of @var{eps_abs} and

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -