In this section, we introduce some central concepts from object-oriented programming: abstract classes, subclasses, and inheritance. To guide you through these concepts, we consider another mathematical example: one-step methods for solving a differential equation.
The generic form of an ordinary initial value problem is as follows:
![](https://static.packt-cdn.com/products/9781838822323/graphics/assets/984b6f95-b6c1-45b0-b4b9-a33b4a888ee6.png)
The data is the right-hand side function , the initial value
, and the interval of interest
.
The solution to this problem is a function . A numerical algorithm gives this solution as a vector
of discrete values
being approximations to
. Here,
and
are discretized values of the independent variable
, which in physical models often represents time.
A one-step method constructs the solution values by the recursion steps:
Here, is a step function that characterizes the individual methods, see also [28]:
-
Explicit Euler:
_
-
Midpoint rule:
-
Runge–Kutta 4:
with
What we did here is the typical way of describing...