numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
|
Class of test problem of free fall in air resistance. More...
#include <num_prob_collect/ode/free_fall_in_resistance_problem.h>
Public Types | |
using | jacobian_type = Eigen::Matrix2d |
Type of Jacobian. | |
using | scalar_type = double |
Type of scalars. | |
using | variable_type = Eigen::Vector2d |
Type of variables. | |
Public Member Functions | |
free_fall_in_resistance_problem (scalar_type k, scalar_type g) | |
Constructor. | |
auto | diff_coeff () const noexcept -> const variable_type & |
Get the differential coefficient. | |
void | evaluate_on (scalar_type, const variable_type &variable, num_collect::ode::evaluation_type) |
Evaluate on a (time, variable) pair. | |
auto | jacobian () const noexcept -> const jacobian_type & |
Get the Jacobian. | |
Static Public Attributes | |
static constexpr auto | allowed_evaluations |
Allowed evaluations. | |
Private Attributes | |
variable_type | diff_coeff_ {} |
Differential coefficient. | |
scalar_type | g_ |
Gravity. | |
jacobian_type | jacobian_ {} |
Jacobian. | |
scalar_type | k_ |
Coefficient of resistance. | |
Class of test problem of free fall in air resistance.
This solves the following equation of motion:
\[ \ddot{x} = -k \dot{x} - g \]
Here, k and g are constants.
In this class, the following equation is used to solve the above equation:
\[ \frac{d}{dt} \begin{pmatrix} \dot{x} \\ x \end{pmatrix} = \begin{pmatrix} -k \dot{x} - g \\ \dot{x} \end{pmatrix} \]
When the initial variable is (0, 0), the solution is the following:
\[ \begin{pmatrix} \dot{x} \\ x \end{pmatrix} = \begin{pmatrix} \frac{g}{k}e^{-kt} - \frac{g}{k} \\ -\frac{g}{k^2}e^{-kt} - \frac{g}{k}t + \frac{g}{k^2} \end{pmatrix} \]
Definition at line 53 of file free_fall_in_resistance_problem.h.
using num_prob_collect::ode::free_fall_in_resistance_problem::jacobian_type = Eigen::Matrix2d |
Type of Jacobian.
Definition at line 62 of file free_fall_in_resistance_problem.h.
Type of scalars.
Definition at line 59 of file free_fall_in_resistance_problem.h.
using num_prob_collect::ode::free_fall_in_resistance_problem::variable_type = Eigen::Vector2d |
Type of variables.
Definition at line 56 of file free_fall_in_resistance_problem.h.
|
inline |
Constructor.
[in] | k | Coefficient of resistance. |
[in] | g | Gravity. |
Definition at line 74 of file free_fall_in_resistance_problem.h.
|
inlinenodiscardnoexcept |
Get the differential coefficient.
Definition at line 95 of file free_fall_in_resistance_problem.h.
|
inline |
Evaluate on a (time, variable) pair.
[in] | variable | Variable. |
Definition at line 84 of file free_fall_in_resistance_problem.h.
|
inlinenodiscardnoexcept |
Get the Jacobian.
Definition at line 104 of file free_fall_in_resistance_problem.h.
|
staticconstexpr |
Allowed evaluations.
Definition at line 65 of file free_fall_in_resistance_problem.h.
|
private |
Differential coefficient.
Definition at line 116 of file free_fall_in_resistance_problem.h.
|
private |
Gravity.
Definition at line 113 of file free_fall_in_resistance_problem.h.
|
private |
Jacobian.
Definition at line 119 of file free_fall_in_resistance_problem.h.
|
private |
Coefficient of resistance.
Definition at line 110 of file free_fall_in_resistance_problem.h.