Bases: odespy.problems.Problem
Harmonic oscillator (u’’ + w*u = 0) expressed as a complex ODE: u’ = i*w*u.
Methods
default_parameters([resolution_per_period]) | |
f(u, t) | |
get_initial_condition() | Return vector of initial conditions. |
jac(u, t) | |
terminate(u, t, step_number) | Default terminate function, always returning False. |
u_exact(t) | |
verify(u, t[, atol, rtol]) | Return True if u at time points t coincides with an exact |
Bases: odespy.problems.Problem
Methods
default_parameters() | |
f(u, t) | |
f_with_args(u, t, a, b) | |
f_with_kwargs(u, t[, a, b]) | |
get_initial_condition() | Return vector of initial conditions. |
jac(u, t) | |
jac_with_args(u, t, a, b) | |
jac_with_kwargs(u, t[, a, b]) | |
terminate(u, t, step_number) | Default terminate function, always returning False. |
u_exact(t) | |
verify(u, t[, atol, rtol]) | Return True if u at time points t coincides with an exact |
Bases: odespy.problems.Problem
Methods
default_parameters() | Compute suitable time_points, atol/rtol, etc. |
f(u, t) | |
get_initial_condition() | Return vector of initial conditions. |
jac(u, t) | |
terminate(u, t, step_number) | Default terminate function, always returning False. |
u_exact(t) | |
verify(u, t[, atol, rtol]) | Return True if u at time points t coincides with an exact |
Bases: odespy.problems.Problem
Methods
default_parameters() | Compute suitable time_points, atol/rtol, etc. |
f(u, t) | |
get_initial_condition() | Return vector of initial conditions. |
jac(u, t) | |
terminate(u, t, step_number) | Default terminate function, always returning False. |
u_exact(t) | |
verify(u, t[, atol, rtol]) | Return True if u at time points t coincides with an exact |
Bases: odespy.problems.Problem
Linear solution of a nonlinear ODE, which is normally exactly reproduced by a numerical method.
Methods
default_parameters() | |
f(u, t) | |
get_initial_condition() | Return vector of initial conditions. |
jac(u, t) | |
terminate(u, t, step_number) | Default terminate function, always returning False. |
u_exact(t) | |
verify(u, t[, atol, rtol]) | Return True if u at time points t coincides with an exact |
Bases: odespy.problems.Linear1
Linear solution of nonlinear 2x2 system, which is normally exactly reproduced by a numerical method.
Methods
default_parameters() | |
f(u, t) | |
get_initial_condition() | Return vector of initial conditions. |
jac(u, t) | |
spcrad(u, t) | |
terminate(u, t, step_number) | Default terminate function, always returning False. |
u_exact(t) | |
verify(u, t[, atol, rtol]) | Return True if u at time points t coincides with an exact |
Bases: odespy.problems.Linear2
Linear solution of trivial 2x2 system, which is normally exactly reproduced by a numerical method.
Methods
default_parameters() | |
f(u, t) | |
get_initial_condition() | Return vector of initial conditions. |
jac(u, t) | |
spcrad(u, t) | |
terminate(u, t, step_number) | Default terminate function, always returning False. |
u_exact(t) | |
verify(u, t[, atol, rtol]) | Return True if u at time points t coincides with an exact |
Bases: odespy.problems.Problem
Methods
default_parameters([resolution_per_period]) | |
f(u, t) | |
get_initial_condition() | Return vector of initial conditions. |
jac(u, t) | |
kinetic_energy(u) | |
potential_energy(u) | |
terminate(u, t, step_number) | Default terminate function, always returning False. |
u_exact(t) | |
verify(u, t[, atol, rtol]) | Return True if u at time points t coincides with an exact |
Bases: odespy.problems.Problem
Methods
default_parameters() | Compute suitable time_points, atol/rtol, etc. |
f(u, t) | |
get_initial_condition() | Return vector of initial conditions. |
jac(u, t) | |
terminate(u, t, step_number) | Default terminate function, always returning False. |
u_exact(t) | |
verify(u, t[, atol, rtol]) | Return True if u at time points t coincides with an exact |
The user derives a subclass and implements the right-hand side function:
def f(self, u, t):
"""Python function for the right-hand side of the ODE u'=f(u,t)."""
Optionally, the Jacobian can be computed:
def jac(self, u, t):
"""Python function for the Jacobian of the right-hand side: df/du."""
Some solvers also allow constraings (DAE problems):
def constraints(self, u, t):
"""Python function for additional constraints: g(u,t)=0."""
Some problem classes will also define command-line arguments:
def define_command_line_arguments(self, parser):
"""
Initialize an argparse object for reading command-line
option-value pairs. `parser` is an ``argparse`` object.
"""
Other functions, for which there are default implementations in the superclass, are u_exact for returning the exact solution (if known), verify for checking that a numerical solution is correct (within a tolerance of the analytical solution),
See the tutorial for examples on subclasses of Problem.
Methods
default_parameters() | Compute suitable time_points, atol/rtol, etc. |
get_initial_condition() | Return vector of initial conditions. |
terminate(u, t, step_number) | Default terminate function, always returning False. |
u_exact(t) | Implementation of the exact solution. |
verify(u, t[, atol, rtol]) | Return True if u at time points t coincides with an exact |
Compute suitable time_points, atol/rtol, etc. for the particular problem. Useful for quick generation of test cases, demos, unit tests, etc.
Return vector of initial conditions. Not necessary to implement in subclass if the initial condition is stored in self.U0 (this method then returns that condition).
Bases: odespy.problems.Problem
Methods
default_parameters() | Compute suitable time_points, atol/rtol, etc. |
f(u, t) | |
get_initial_condition() | Return vector of initial conditions. |
jac(u, t) | |
terminate(u, t, step_number) | Default terminate function, always returning False. |
u_exact(t) | |
verify(u, t[, atol, rtol]) | Return True if u at time points t coincides with an exact |
Bases: odespy.problems.Problem
Classical van der Pool oscillator:
\[y'' = \mu (1 - y^2) y' - y\]with initial conditions \(y(0)=2, y'(0)=1\). The equation is rewritten as a system
\[\begin{split}u_0' &= u_1, \ u_1' &= \mu (1-u_0^2)u_1 - u_0\end{split}\]with a Jacobian
\[\begin{split}\left(egin{array}{cc} 0 & 1\ -2\mu u_0 - 1 & \mu (1-u_0^2) \end{array}\end{split}\]
ight)
Methods
default_parameters([resolution_per_period]) | |
f(u, t) | |
f_with_args(u, t, mu) | |
f_with_kwargs(u, t[, mu]) | |
get_initial_condition() | Return vector of initial conditions. |
jac(u, t) | |
jac_with_args(u, t, mu) | |
jac_with_kwargs(u, t[, mu]) | |
str_f_f77() | Return f(u,t) as Fortran source code string. |
str_jac_f77_fadau5() | Return Jacobian Fortran source code string for Radau5. |
str_jac_f77_lsode_dense() | Return Fortran source for dense Jacobian matrix in LSODE format. |
terminate(u, t, step_number) | Default terminate function, always returning False. |
u_exact(t) | |
verify(u, t[, atol, rtol]) | Return True if u at time points t coincides with an exact |