numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
changing_mass_exponential_problem.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
20#pragma once
21
22#include <cmath>
23
27
28namespace num_prob_collect::ode {
29
34public:
36 using variable_type = double;
37
39 using scalar_type = double;
40
42 using jacobian_type = double;
43
45 using mass_type = double;
46
48 static constexpr auto allowed_evaluations =
50 .diff_coeff = true, .jacobian = true, .mass = true};
51
57 void evaluate_on(double /*time*/, double variable,
58 num_collect::ode::evaluation_type /*evaluations*/) {
59 const double exp_x = std::exp(variable);
60 diff_coeff_ = variable * exp_x;
61 jacobian_ = exp_x + diff_coeff_;
62 mass_ = exp_x;
63 }
64
70 [[nodiscard]] auto diff_coeff() const -> const double& {
71 return diff_coeff_;
72 }
73
79 [[nodiscard]] auto jacobian() const noexcept -> const jacobian_type& {
80 return jacobian_;
81 }
82
88 [[nodiscard]] auto mass() const noexcept -> const mass_type& {
89 return mass_;
90 }
91
92private:
94 double diff_coeff_{};
95
97 double mass_{};
98
100 double jacobian_{};
101};
102
104 changing_mass_exponential_problem>);
106 changing_mass_exponential_problem>);
107
108} // namespace num_prob_collect::ode
Class of test problem to calculate exponential function.
auto diff_coeff() const -> const double &
Get the differential coefficient.
auto mass() const noexcept -> const mass_type &
Get the mass.
void evaluate_on(double, double variable, num_collect::ode::evaluation_type)
Evaluate on a (time, variable) pair.
auto jacobian() const noexcept -> const jacobian_type &
Get the Jacobian.
Concept of problems of differentiable ordinary differential equations.
Concept of problems of ordinary differential equations with mass.
Definition of differentiable_problem concept.
Definition of evaluation_type enumeration.
Definition of mass_problem concept.
Namespace of ordinary differential equation problems.
Definition namespaces.h:28
Struct to specify types of evaluations.