odespy.RungeKutta

class odespy.RungeKutta.BogackiShampine(f, **kwargs)[source]

Bases: odespy.RungeKutta.RungeKutta2level

Adaptive Bogacki-Shampine Runge-Kutta method of order (3, 2). Implementated in the general Python framework in the RungeKutta module.

Required input arguments:

Name Description
f Right-hand side f(u,t) defining the ODE.

Optional input arguments:

Name Description
f_args Extra positional arguments to f: f(u, t, *f_args, **f_kwargs). (default: ())
f_kwargs Extra keyword arguments to f: f(u, t, *f_args, **f_kwargs). (default: {})
complex_valued True if f is complex valued. (default: False)
disk_storage Indicates whether u is stored in memory or in file. If string, it is the filename; if False or “”, u is kept in memory; if True, a default filename tmp_odspy.dat is used. (default: False)
verbose Integer reflecting output of intermediate quantities. (default: 0)
u_exact Function of t returning exact solution. (default: None)
rtol Relative tolerance for solution. (default: 1e-06)
atol Absolute tolerance for solution. (default: 1e-08)
first_step Suggested first time step size for an adaptive algorithm.
min_step Minimum step size for an adaptive algorithm.
max_step Maximum step size for an adaptive algorithm.

Methods

adjust_parameters() This method allows subclasses to adjust (modify or add) entries in the self._parameters dictionary.
advance() Advance from t[n] to t[n+1] in (small) adaptive steps.
check_conditional_parameters() This function is used to check whether conditional parameters are provided when specified condition fulfilled.
check_extra(**kwargs) A parameter may have a keyword extra_check for user-given functions that performs consistency checks on the parameter.
check_input_range(**kwargs) Check whether all existing inputs are in right specified range.
check_input_types(**kwargs) Check whether all existing inputs are of right specified type.
compile_string_functions(f, **kwargs) Compile functions which are supplied as Fortran strings.
constant_time_step() Check if self.t has a uniform partition.
get([parameter_name, print_info]) Return value of specified input parameters.
get_order() Return the order of current method, both for non-adaptive
get_parameter_info([print_info]) Return a dictionary containing all properties of all legal parameters in current subclass (i.e., the parameters in self._parameters).
has_u_t_all() Return True if self.u_all and self.t_all, defined in
initialize() Subclass-specific initialization.
initialize_for_solve()
set([strict]) Assign values to one or more parameters, specified as keyword arguments.
set_initial_condition(U0) Function set_initial_condition() is used to set initial value of
solve(time_points[, terminate]) Compute discrete solution u of the ODE problem at time points
switch_to(solver_target[, print_info]) Create a new solver instance which switch to another subclass with same values of common attributes.
validate_data() This function is used for extra checking and validating of attributes before the computations start.
__module__ = 'odespy.RungeKutta'
quick_description = 'Adaptive Bogacki-Shampine RK method of order (3, 2)'
class odespy.RungeKutta.CashKarp(f, **kwargs)[source]

Bases: odespy.RungeKutta.RungeKutta2level

Adaptive Cash-Karp Runge-Kutta method of order (5, 4). Implementated in the general Python framework in the RungeKutta module.

Required input arguments:

Name Description
f Right-hand side f(u,t) defining the ODE.

Optional input arguments:

Name Description
f_args Extra positional arguments to f: f(u, t, *f_args, **f_kwargs). (default: ())
f_kwargs Extra keyword arguments to f: f(u, t, *f_args, **f_kwargs). (default: {})
complex_valued True if f is complex valued. (default: False)
disk_storage Indicates whether u is stored in memory or in file. If string, it is the filename; if False or “”, u is kept in memory; if True, a default filename tmp_odspy.dat is used. (default: False)
verbose Integer reflecting output of intermediate quantities. (default: 0)
u_exact Function of t returning exact solution. (default: None)
rtol Relative tolerance for solution. (default: 1e-06)
atol Absolute tolerance for solution. (default: 1e-08)
first_step Suggested first time step size for an adaptive algorithm.
min_step Minimum step size for an adaptive algorithm.
max_step Maximum step size for an adaptive algorithm.

Methods

adjust_parameters() This method allows subclasses to adjust (modify or add) entries in the self._parameters dictionary.
advance() Advance from t[n] to t[n+1] in (small) adaptive steps.
check_conditional_parameters() This function is used to check whether conditional parameters are provided when specified condition fulfilled.
check_extra(**kwargs) A parameter may have a keyword extra_check for user-given functions that performs consistency checks on the parameter.
check_input_range(**kwargs) Check whether all existing inputs are in right specified range.
check_input_types(**kwargs) Check whether all existing inputs are of right specified type.
compile_string_functions(f, **kwargs) Compile functions which are supplied as Fortran strings.
constant_time_step() Check if self.t has a uniform partition.
get([parameter_name, print_info]) Return value of specified input parameters.
get_order() Return the order of current method, both for non-adaptive
get_parameter_info([print_info]) Return a dictionary containing all properties of all legal parameters in current subclass (i.e., the parameters in self._parameters).
has_u_t_all() Return True if self.u_all and self.t_all, defined in
initialize() Subclass-specific initialization.
initialize_for_solve()
set([strict]) Assign values to one or more parameters, specified as keyword arguments.
set_initial_condition(U0) Function set_initial_condition() is used to set initial value of
solve(time_points[, terminate]) Compute discrete solution u of the ODE problem at time points
switch_to(solver_target[, print_info]) Create a new solver instance which switch to another subclass with same values of common attributes.
validate_data() This function is used for extra checking and validating of attributes before the computations start.
__module__ = 'odespy.RungeKutta'
quick_description = 'Adaptive Cash-Karp RK method of order (5, 4)'
class odespy.RungeKutta.DormandPrince(f, **kwargs)[source]

Bases: odespy.RungeKutta.RungeKutta2level

Dormand&Prince Runge-Kutta method of order (5, 4). Implementated in the general Python framework in the RungeKutta module.

Required input arguments:

Name Description
f Right-hand side f(u,t) defining the ODE.

Optional input arguments:

Name Description
f_args Extra positional arguments to f: f(u, t, *f_args, **f_kwargs). (default: ())
f_kwargs Extra keyword arguments to f: f(u, t, *f_args, **f_kwargs). (default: {})
complex_valued True if f is complex valued. (default: False)
disk_storage Indicates whether u is stored in memory or in file. If string, it is the filename; if False or “”, u is kept in memory; if True, a default filename tmp_odspy.dat is used. (default: False)
verbose Integer reflecting output of intermediate quantities. (default: 0)
u_exact Function of t returning exact solution. (default: None)
rtol Relative tolerance for solution. (default: 1e-06)
atol Absolute tolerance for solution. (default: 1e-08)
first_step Suggested first time step size for an adaptive algorithm.
min_step Minimum step size for an adaptive algorithm.
max_step Maximum step size for an adaptive algorithm.

Methods

adjust_parameters() This method allows subclasses to adjust (modify or add) entries in the self._parameters dictionary.
advance() Advance from t[n] to t[n+1] in (small) adaptive steps.
check_conditional_parameters() This function is used to check whether conditional parameters are provided when specified condition fulfilled.
check_extra(**kwargs) A parameter may have a keyword extra_check for user-given functions that performs consistency checks on the parameter.
check_input_range(**kwargs) Check whether all existing inputs are in right specified range.
check_input_types(**kwargs) Check whether all existing inputs are of right specified type.
compile_string_functions(f, **kwargs) Compile functions which are supplied as Fortran strings.
constant_time_step() Check if self.t has a uniform partition.
get([parameter_name, print_info]) Return value of specified input parameters.
get_order() Return the order of current method, both for non-adaptive
get_parameter_info([print_info]) Return a dictionary containing all properties of all legal parameters in current subclass (i.e., the parameters in self._parameters).
has_u_t_all() Return True if self.u_all and self.t_all, defined in
initialize() Subclass-specific initialization.
initialize_for_solve()
set([strict]) Assign values to one or more parameters, specified as keyword arguments.
set_initial_condition(U0) Function set_initial_condition() is used to set initial value of
solve(time_points[, terminate]) Compute discrete solution u of the ODE problem at time points
switch_to(solver_target[, print_info]) Create a new solver instance which switch to another subclass with same values of common attributes.
validate_data() This function is used for extra checking and validating of attributes before the computations start.
__module__ = 'odespy.RungeKutta'
quick_description = 'Dormand & Prince RK method of order (5, 4)'
class odespy.RungeKutta.Fehlberg(f, **kwargs)[source]

Bases: odespy.RungeKutta.RungeKutta2level

Adaptive Runge-Kutta-Fehlberg method of order (4, 5). Implementated in the general Python framework in the RungeKutta module.

Required input arguments:

Name Description
f Right-hand side f(u,t) defining the ODE.

Optional input arguments:

Name Description
f_args Extra positional arguments to f: f(u, t, *f_args, **f_kwargs). (default: ())
f_kwargs Extra keyword arguments to f: f(u, t, *f_args, **f_kwargs). (default: {})
complex_valued True if f is complex valued. (default: False)
disk_storage Indicates whether u is stored in memory or in file. If string, it is the filename; if False or “”, u is kept in memory; if True, a default filename tmp_odspy.dat is used. (default: False)
verbose Integer reflecting output of intermediate quantities. (default: 0)
u_exact Function of t returning exact solution. (default: None)
rtol Relative tolerance for solution. (default: 1e-06)
atol Absolute tolerance for solution. (default: 1e-08)
first_step Suggested first time step size for an adaptive algorithm.
min_step Minimum step size for an adaptive algorithm.
max_step Maximum step size for an adaptive algorithm.

Methods

adjust_parameters() This method allows subclasses to adjust (modify or add) entries in the self._parameters dictionary.
advance() Advance from t[n] to t[n+1] in (small) adaptive steps.
check_conditional_parameters() This function is used to check whether conditional parameters are provided when specified condition fulfilled.
check_extra(**kwargs) A parameter may have a keyword extra_check for user-given functions that performs consistency checks on the parameter.
check_input_range(**kwargs) Check whether all existing inputs are in right specified range.
check_input_types(**kwargs) Check whether all existing inputs are of right specified type.
compile_string_functions(f, **kwargs) Compile functions which are supplied as Fortran strings.
constant_time_step() Check if self.t has a uniform partition.
get([parameter_name, print_info]) Return value of specified input parameters.
get_order() Return the order of current method, both for non-adaptive
get_parameter_info([print_info]) Return a dictionary containing all properties of all legal parameters in current subclass (i.e., the parameters in self._parameters).
has_u_t_all() Return True if self.u_all and self.t_all, defined in
initialize() Subclass-specific initialization.
initialize_for_solve()
set([strict]) Assign values to one or more parameters, specified as keyword arguments.
set_initial_condition(U0) Function set_initial_condition() is used to set initial value of
solve(time_points[, terminate]) Compute discrete solution u of the ODE problem at time points
switch_to(solver_target[, print_info]) Create a new solver instance which switch to another subclass with same values of common attributes.
validate_data() This function is used for extra checking and validating of attributes before the computations start.
__module__ = 'odespy.RungeKutta'
quick_description = 'Adaptive Runge-Kutta-Fehlberg (4,5) method'
class odespy.RungeKutta.MyRungeKutta(f, **kwargs)[source]

Bases: odespy.RungeKutta.RungeKutta2level

User-supplied RungeKutta method, which is defined by providing butcher-table in an 2d-array. Method order should be provided if it is known. If not, the order would be estimated automatically with function get_order().

Required input arguments:

Name Description
f Right-hand side f(u,t) defining the ODE.
butcher_tableau 2d-array which contains the butcher table for user- supplied Runge-Kutta method. (n,n) array for 1-level Runge-Kutta methods.(n+1,n) array for 2-level Runge- Kutta methods.

Optional input arguments:

Name Description
f_args Extra positional arguments to f: f(u, t, *f_args, **f_kwargs). (default: ())
f_kwargs Extra keyword arguments to f: f(u, t, *f_args, **f_kwargs). (default: {})
complex_valued True if f is complex valued. (default: False)
disk_storage Indicates whether u is stored in memory or in file. If string, it is the filename; if False or “”, u is kept in memory; if True, a default filename tmp_odspy.dat is used. (default: False)
verbose Integer reflecting output of intermediate quantities. (default: 0)
u_exact Function of t returning exact solution. (default: None)
rtol Relative tolerance for solution. (default: 1e-06)
atol Absolute tolerance for solution. (default: 1e-08)
first_step Suggested first time step size for an adaptive algorithm.
min_step Minimum step size for an adaptive algorithm.
max_step Maximum step size for an adaptive algorithm.
method_order Method order for user-defined method if known.A integer for 1-level methods, or a pair of integer for 2-levels methods.

Methods

adjust_parameters() This method allows subclasses to adjust (modify or add) entries in the self._parameters dictionary.
advance() Advance from t[n] to t[n+1] in (small) adaptive steps.
check_conditional_parameters() This function is used to check whether conditional parameters are provided when specified condition fulfilled.
check_extra(**kwargs) A parameter may have a keyword extra_check for user-given functions that performs consistency checks on the parameter.
check_input_range(**kwargs) Check whether all existing inputs are in right specified range.
check_input_types(**kwargs) Check whether all existing inputs are of right specified type.
compile_string_functions(f, **kwargs) Compile functions which are supplied as Fortran strings.
constant_time_step() Check if self.t has a uniform partition.
get([parameter_name, print_info]) Return value of specified input parameters.
get_order() Return the order of current method, both for non-adaptive
get_parameter_info([print_info]) Return a dictionary containing all properties of all legal parameters in current subclass (i.e., the parameters in self._parameters).
has_u_t_all() Return True if self.u_all and self.t_all, defined in
initialize() Subclass-specific initialization.
initialize_for_solve()
set([strict]) Assign values to one or more parameters, specified as keyword arguments.
set_initial_condition(U0) Function set_initial_condition() is used to set initial value of
solve(time_points[, terminate]) Compute discrete solution u of the ODE problem at time points
switch_to(solver_target[, print_info]) Create a new solver instance which switch to another subclass with same values of common attributes.
validate_data()
__module__ = 'odespy.RungeKutta'
validate_data()[source]
class odespy.RungeKutta.RungeKutta1(f, **kwargs)[source]

Bases: odespy.RungeKutta.RungeKutta1level

Explicit Forward Euler method implemented in the general RungeKutta Python framework.

Required input arguments:

Name Description
f Right-hand side f(u,t) defining the ODE.

Optional input arguments:

Name Description
f_args Extra positional arguments to f: f(u, t, *f_args, **f_kwargs). (default: ())
f_kwargs Extra keyword arguments to f: f(u, t, *f_args, **f_kwargs). (default: {})
complex_valued True if f is complex valued. (default: False)
disk_storage Indicates whether u is stored in memory or in file. If string, it is the filename; if False or “”, u is kept in memory; if True, a default filename tmp_odspy.dat is used. (default: False)
verbose Integer reflecting output of intermediate quantities. (default: 0)
u_exact Function of t returning exact solution. (default: None)

Methods

adjust_parameters() This method allows subclasses to adjust (modify or add) entries in the self._parameters dictionary.
advance() Advance the solution one time step: t[n] to t[n+1].
check_conditional_parameters() This function is used to check whether conditional parameters are provided when specified condition fulfilled.
check_extra(**kwargs) A parameter may have a keyword extra_check for user-given functions that performs consistency checks on the parameter.
check_input_range(**kwargs) Check whether all existing inputs are in right specified range.
check_input_types(**kwargs) Check whether all existing inputs are of right specified type.
compile_string_functions(f, **kwargs) Compile functions which are supplied as Fortran strings.
constant_time_step() Check if self.t has a uniform partition.
get([parameter_name, print_info]) Return value of specified input parameters.
get_order() Return the order of the current method.
get_parameter_info([print_info]) Return a dictionary containing all properties of all legal parameters in current subclass (i.e., the parameters in self._parameters).
has_u_t_all() Return True if self.u_all and self.t_all, defined in
initialize() Subclass-specific initialization.
initialize_for_solve() Setting values of internal attributes to be used in iteration.
set([strict]) Assign values to one or more parameters, specified as keyword arguments.
set_initial_condition(U0) Function set_initial_condition() is used to set initial value of
solve(time_points[, terminate]) Compute discrete solution u of the ODE problem at time points
switch_to(solver_target[, print_info]) Create a new solver instance which switch to another subclass with same values of common attributes.
validate_data() This function is used for extra checking and validating of attributes before the computations start.
__module__ = 'odespy.RungeKutta'
quick_description = 'Explicit 1st-order Runge-Kutta method'
class odespy.RungeKutta.RungeKutta1level(f, **kwargs)[source]

Bases: odespy.solvers.Solver

Superclass for explicit 1-level Runge-Kutta methods. Subclasses are RungeKutta4, Rungekutta2, RungeKutta3, RugeKutta1 (Forward Euler).

Required input arguments:

Name Description
f Right-hand side f(u,t) defining the ODE.

Optional input arguments:

Name Description
f_args Extra positional arguments to f: f(u, t, *f_args, **f_kwargs). (default: ())
f_kwargs Extra keyword arguments to f: f(u, t, *f_args, **f_kwargs). (default: {})
complex_valued True if f is complex valued. (default: False)
disk_storage Indicates whether u is stored in memory or in file. If string, it is the filename; if False or “”, u is kept in memory; if True, a default filename tmp_odspy.dat is used. (default: False)
verbose Integer reflecting output of intermediate quantities. (default: 0)
u_exact Function of t returning exact solution. (default: None)

Methods

adjust_parameters() This method allows subclasses to adjust (modify or add) entries in the self._parameters dictionary.
advance() Advance the solution one time step: t[n] to t[n+1].
check_conditional_parameters() This function is used to check whether conditional parameters are provided when specified condition fulfilled.
check_extra(**kwargs) A parameter may have a keyword extra_check for user-given functions that performs consistency checks on the parameter.
check_input_range(**kwargs) Check whether all existing inputs are in right specified range.
check_input_types(**kwargs) Check whether all existing inputs are of right specified type.
compile_string_functions(f, **kwargs) Compile functions which are supplied as Fortran strings.
constant_time_step() Check if self.t has a uniform partition.
get([parameter_name, print_info]) Return value of specified input parameters.
get_order() Return the order of the current method.
get_parameter_info([print_info]) Return a dictionary containing all properties of all legal parameters in current subclass (i.e., the parameters in self._parameters).
has_u_t_all() Return True if self.u_all and self.t_all, defined in
initialize() Subclass-specific initialization.
initialize_for_solve() Setting values of internal attributes to be used in iteration.
set([strict]) Assign values to one or more parameters, specified as keyword arguments.
set_initial_condition(U0) Function set_initial_condition() is used to set initial value of
solve(time_points[, terminate]) Compute discrete solution u of the ODE problem at time points
switch_to(solver_target[, print_info]) Create a new solver instance which switch to another subclass with same values of common attributes.
validate_data() This function is used for extra checking and validating of attributes before the computations start.
__module__ = 'odespy.RungeKutta'
advance()[source]

Advance the solution one time step: t[n] to t[n+1].

get_order()[source]

Return the order of the current method.

class odespy.RungeKutta.RungeKutta2(f, **kwargs)[source]

Bases: odespy.RungeKutta.RungeKutta1level

Standard Runge-Kutta method of order 2. Implementated in the general Python framework in the RungeKutta module.

Required input arguments:

Name Description
f Right-hand side f(u,t) defining the ODE.

Optional input arguments:

Name Description
f_args Extra positional arguments to f: f(u, t, *f_args, **f_kwargs). (default: ())
f_kwargs Extra keyword arguments to f: f(u, t, *f_args, **f_kwargs). (default: {})
complex_valued True if f is complex valued. (default: False)
disk_storage Indicates whether u is stored in memory or in file. If string, it is the filename; if False or “”, u is kept in memory; if True, a default filename tmp_odspy.dat is used. (default: False)
verbose Integer reflecting output of intermediate quantities. (default: 0)
u_exact Function of t returning exact solution. (default: None)

Methods

adjust_parameters() This method allows subclasses to adjust (modify or add) entries in the self._parameters dictionary.
advance() Advance the solution one time step: t[n] to t[n+1].
check_conditional_parameters() This function is used to check whether conditional parameters are provided when specified condition fulfilled.
check_extra(**kwargs) A parameter may have a keyword extra_check for user-given functions that performs consistency checks on the parameter.
check_input_range(**kwargs) Check whether all existing inputs are in right specified range.
check_input_types(**kwargs) Check whether all existing inputs are of right specified type.
compile_string_functions(f, **kwargs) Compile functions which are supplied as Fortran strings.
constant_time_step() Check if self.t has a uniform partition.
get([parameter_name, print_info]) Return value of specified input parameters.
get_order() Return the order of the current method.
get_parameter_info([print_info]) Return a dictionary containing all properties of all legal parameters in current subclass (i.e., the parameters in self._parameters).
has_u_t_all() Return True if self.u_all and self.t_all, defined in
initialize() Subclass-specific initialization.
initialize_for_solve() Setting values of internal attributes to be used in iteration.
set([strict]) Assign values to one or more parameters, specified as keyword arguments.
set_initial_condition(U0) Function set_initial_condition() is used to set initial value of
solve(time_points[, terminate]) Compute discrete solution u of the ODE problem at time points
switch_to(solver_target[, print_info]) Create a new solver instance which switch to another subclass with same values of common attributes.
validate_data() This function is used for extra checking and validating of attributes before the computations start.
__module__ = 'odespy.RungeKutta'
quick_description = 'Explicit 2nd-order Runge-Kutta method'
class odespy.RungeKutta.RungeKutta2level(f, **kwargs)[source]

Bases: odespy.solvers.Adaptive

Superclass for 2-levels adaptive Runge-Kutta methods: DormandPrince, Fehlberg, CashKarp, BogackiShampine, MyRungeKutta (user-supplied RungeKutta methods).

NOTE: This class should be superclass for level-1 methods. A subclass AdaptiveRungeKutta can act as superclass for the level-2 methods. get_order can be in RungeKutta.

Required input arguments:

Name Description
f Right-hand side f(u,t) defining the ODE.

Optional input arguments:

Name Description
f_args Extra positional arguments to f: f(u, t, *f_args, **f_kwargs). (default: ())
f_kwargs Extra keyword arguments to f: f(u, t, *f_args, **f_kwargs). (default: {})
complex_valued True if f is complex valued. (default: False)
disk_storage Indicates whether u is stored in memory or in file. If string, it is the filename; if False or “”, u is kept in memory; if True, a default filename tmp_odspy.dat is used. (default: False)
verbose Integer reflecting output of intermediate quantities. (default: 0)
u_exact Function of t returning exact solution. (default: None)
rtol Relative tolerance for solution. (default: 1e-06)
atol Absolute tolerance for solution. (default: 1e-08)
first_step Suggested first time step size for an adaptive algorithm.
min_step Minimum step size for an adaptive algorithm.
max_step Maximum step size for an adaptive algorithm.

Methods

adjust_parameters() This method allows subclasses to adjust (modify or add) entries in the self._parameters dictionary.
advance() Advance from t[n] to t[n+1] in (small) adaptive steps.
check_conditional_parameters() This function is used to check whether conditional parameters are provided when specified condition fulfilled.
check_extra(**kwargs) A parameter may have a keyword extra_check for user-given functions that performs consistency checks on the parameter.
check_input_range(**kwargs) Check whether all existing inputs are in right specified range.
check_input_types(**kwargs) Check whether all existing inputs are of right specified type.
compile_string_functions(f, **kwargs) Compile functions which are supplied as Fortran strings.
constant_time_step() Check if self.t has a uniform partition.
get([parameter_name, print_info]) Return value of specified input parameters.
get_order() Return the order of current method, both for non-adaptive
get_parameter_info([print_info]) Return a dictionary containing all properties of all legal parameters in current subclass (i.e., the parameters in self._parameters).
has_u_t_all() Return True if self.u_all and self.t_all, defined in
initialize() Subclass-specific initialization.
initialize_for_solve()
set([strict]) Assign values to one or more parameters, specified as keyword arguments.
set_initial_condition(U0) Function set_initial_condition() is used to set initial value of
solve(time_points[, terminate]) Compute discrete solution u of the ODE problem at time points
switch_to(solver_target[, print_info]) Create a new solver instance which switch to another subclass with same values of common attributes.
validate_data() This function is used for extra checking and validating of attributes before the computations start.
__module__ = 'odespy.RungeKutta'
advance()[source]

Advance from t[n] to t[n+1] in (small) adaptive steps.

get_order()[source]

Return the order of current method, both for non-adaptive and adaptive methods.

initialize_for_solve()[source]
class odespy.RungeKutta.RungeKutta3(f, **kwargs)[source]

Bases: odespy.RungeKutta.RungeKutta1level

Standard Runge-Kutta method of order 3. Implementated in the general Python framework in the RungeKutta module.

Required input arguments:

Name Description
f Right-hand side f(u,t) defining the ODE.

Optional input arguments:

Name Description
f_args Extra positional arguments to f: f(u, t, *f_args, **f_kwargs). (default: ())
f_kwargs Extra keyword arguments to f: f(u, t, *f_args, **f_kwargs). (default: {})
complex_valued True if f is complex valued. (default: False)
disk_storage Indicates whether u is stored in memory or in file. If string, it is the filename; if False or “”, u is kept in memory; if True, a default filename tmp_odspy.dat is used. (default: False)
verbose Integer reflecting output of intermediate quantities. (default: 0)
u_exact Function of t returning exact solution. (default: None)

Methods

adjust_parameters() This method allows subclasses to adjust (modify or add) entries in the self._parameters dictionary.
advance() Advance the solution one time step: t[n] to t[n+1].
check_conditional_parameters() This function is used to check whether conditional parameters are provided when specified condition fulfilled.
check_extra(**kwargs) A parameter may have a keyword extra_check for user-given functions that performs consistency checks on the parameter.
check_input_range(**kwargs) Check whether all existing inputs are in right specified range.
check_input_types(**kwargs) Check whether all existing inputs are of right specified type.
compile_string_functions(f, **kwargs) Compile functions which are supplied as Fortran strings.
constant_time_step() Check if self.t has a uniform partition.
get([parameter_name, print_info]) Return value of specified input parameters.
get_order() Return the order of the current method.
get_parameter_info([print_info]) Return a dictionary containing all properties of all legal parameters in current subclass (i.e., the parameters in self._parameters).
has_u_t_all() Return True if self.u_all and self.t_all, defined in
initialize() Subclass-specific initialization.
initialize_for_solve() Setting values of internal attributes to be used in iteration.
set([strict]) Assign values to one or more parameters, specified as keyword arguments.
set_initial_condition(U0) Function set_initial_condition() is used to set initial value of
solve(time_points[, terminate]) Compute discrete solution u of the ODE problem at time points
switch_to(solver_target[, print_info]) Create a new solver instance which switch to another subclass with same values of common attributes.
validate_data() This function is used for extra checking and validating of attributes before the computations start.
__module__ = 'odespy.RungeKutta'
quick_description = 'Explicit 3rd-order Runge-Kutta method'
class odespy.RungeKutta.RungeKutta4(f, **kwargs)[source]

Bases: odespy.RungeKutta.RungeKutta1level

Standard Runge-Kutta method of order 4. Implementated in the general Python framework in the RungeKutta module.

Required input arguments:

Name Description
f Right-hand side f(u,t) defining the ODE.

Optional input arguments:

Name Description
f_args Extra positional arguments to f: f(u, t, *f_args, **f_kwargs). (default: ())
f_kwargs Extra keyword arguments to f: f(u, t, *f_args, **f_kwargs). (default: {})
complex_valued True if f is complex valued. (default: False)
disk_storage Indicates whether u is stored in memory or in file. If string, it is the filename; if False or “”, u is kept in memory; if True, a default filename tmp_odspy.dat is used. (default: False)
verbose Integer reflecting output of intermediate quantities. (default: 0)
u_exact Function of t returning exact solution. (default: None)

Methods

adjust_parameters() This method allows subclasses to adjust (modify or add) entries in the self._parameters dictionary.
advance() Advance the solution one time step: t[n] to t[n+1].
check_conditional_parameters() This function is used to check whether conditional parameters are provided when specified condition fulfilled.
check_extra(**kwargs) A parameter may have a keyword extra_check for user-given functions that performs consistency checks on the parameter.
check_input_range(**kwargs) Check whether all existing inputs are in right specified range.
check_input_types(**kwargs) Check whether all existing inputs are of right specified type.
compile_string_functions(f, **kwargs) Compile functions which are supplied as Fortran strings.
constant_time_step() Check if self.t has a uniform partition.
get([parameter_name, print_info]) Return value of specified input parameters.
get_order() Return the order of the current method.
get_parameter_info([print_info]) Return a dictionary containing all properties of all legal parameters in current subclass (i.e., the parameters in self._parameters).
has_u_t_all() Return True if self.u_all and self.t_all, defined in
initialize() Subclass-specific initialization.
initialize_for_solve() Setting values of internal attributes to be used in iteration.
set([strict]) Assign values to one or more parameters, specified as keyword arguments.
set_initial_condition(U0) Function set_initial_condition() is used to set initial value of
solve(time_points[, terminate]) Compute discrete solution u of the ODE problem at time points
switch_to(solver_target[, print_info]) Create a new solver instance which switch to another subclass with same values of common attributes.
validate_data() This function is used for extra checking and validating of attributes before the computations start.
__module__ = 'odespy.RungeKutta'
quick_description = 'Explicit 4th-order Runge-Kutta method'

Previous topic

odespy.runtests