numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
external_exponential_problem.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 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
26
27namespace num_prob_collect::ode {
28
34public:
36 using variable_type = double;
37
39 using scalar_type = double;
40
42 using jacobian_type = double;
43
45 static constexpr auto allowed_evaluations =
47 .diff_coeff = true, .jacobian = true, .time_derivative = true};
48
54 void evaluate_on(double time, double /*variable*/,
55 num_collect::ode::evaluation_type /*evaluations*/) {
56 diff_coeff_ = std::exp(time);
58 }
59
65 [[nodiscard]] auto diff_coeff() const -> const double& {
66 return diff_coeff_;
67 }
68
74 [[nodiscard]] auto jacobian() const noexcept -> const jacobian_type& {
75 return jacobian_;
76 }
77
83 [[nodiscard]] auto time_derivative() const noexcept
84 -> const variable_type& {
85 return time_derivative_;
86 }
87
88private:
90 double diff_coeff_{};
91
93 double jacobian_{1.0};
94
97};
98
100 external_exponential_problem>);
101
102} // namespace num_prob_collect::ode
Class of test problem to calculate exponential function using external time-dependent term....
static constexpr auto allowed_evaluations
Allowed evaluations.
auto diff_coeff() const -> const double &
Get the differential coefficient.
auto time_derivative() const noexcept -> const variable_type &
Get the partial derivative with respect to time.
void evaluate_on(double time, double, num_collect::ode::evaluation_type)
Evaluate on a (time, variable) pair.
double time_derivative_
Partial derivative with respect to time.
auto jacobian() const noexcept -> const jacobian_type &
Get the Jacobian.
Concept of problems of ordinary differential equations differentiable by time variable.
Definition of evaluation_type enumeration.
Namespace of ordinary differential equation problems.
Definition namespaces.h:28
Struct to specify types of evaluations.
Definition of time_differentiable_problem concept.