numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_prob_collect::ode::free_fall_in_resistance_problem Class Reference

Class of test problem of free fall in air resistance. More...

#include <num_prob_collect/ode/free_fall_in_resistance_problem.h>

+ Collaboration diagram for num_prob_collect::ode::free_fall_in_resistance_problem:

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.
 

Detailed Description

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.

Member Typedef Documentation

◆ jacobian_type

Type of Jacobian.

Definition at line 62 of file free_fall_in_resistance_problem.h.

◆ scalar_type

◆ variable_type

Type of variables.

Definition at line 56 of file free_fall_in_resistance_problem.h.

Constructor & Destructor Documentation

◆ free_fall_in_resistance_problem()

num_prob_collect::ode::free_fall_in_resistance_problem::free_fall_in_resistance_problem ( scalar_type k,
scalar_type g )
inline

Constructor.

Parameters
[in]kCoefficient of resistance.
[in]gGravity.

Definition at line 74 of file free_fall_in_resistance_problem.h.

Member Function Documentation

◆ diff_coeff()

auto num_prob_collect::ode::free_fall_in_resistance_problem::diff_coeff ( ) const -> const variable_type&
inlinenodiscardnoexcept

Get the differential coefficient.

Returns
Differential coefficient.

Definition at line 95 of file free_fall_in_resistance_problem.h.

◆ evaluate_on()

void num_prob_collect::ode::free_fall_in_resistance_problem::evaluate_on ( scalar_type ,
const variable_type & variable,
num_collect::ode::evaluation_type  )
inline

Evaluate on a (time, variable) pair.

Parameters
[in]variableVariable.

Definition at line 84 of file free_fall_in_resistance_problem.h.

◆ jacobian()

auto num_prob_collect::ode::free_fall_in_resistance_problem::jacobian ( ) const -> const jacobian_type&
inlinenodiscardnoexcept

Get the Jacobian.

Returns
Jacobian.

Definition at line 104 of file free_fall_in_resistance_problem.h.

Member Data Documentation

◆ allowed_evaluations

auto num_prob_collect::ode::free_fall_in_resistance_problem::allowed_evaluations
staticconstexpr
Initial value:
=
num_collect::ode::evaluation_type{.diff_coeff = true, .jacobian = true}
Struct to specify types of evaluations.

Allowed evaluations.

Definition at line 65 of file free_fall_in_resistance_problem.h.

◆ diff_coeff_

variable_type num_prob_collect::ode::free_fall_in_resistance_problem::diff_coeff_ {}
private

Differential coefficient.

Definition at line 116 of file free_fall_in_resistance_problem.h.

◆ g_

scalar_type num_prob_collect::ode::free_fall_in_resistance_problem::g_
private

Gravity.

Definition at line 113 of file free_fall_in_resistance_problem.h.

◆ jacobian_

jacobian_type num_prob_collect::ode::free_fall_in_resistance_problem::jacobian_ {}
private

Jacobian.

Definition at line 119 of file free_fall_in_resistance_problem.h.

◆ k_

scalar_type num_prob_collect::ode::free_fall_in_resistance_problem::k_
private

Coefficient of resistance.

Definition at line 110 of file free_fall_in_resistance_problem.h.


The documentation for this class was generated from the following file: