Routine Name: Logistic Equation
Author: Kyle Hovey
Language: C++
Description/Purpose:
A logistic equation is a solution \(P\) to the differential equation:
The solution of which can be massaged to the form:
This code takes the free parameters for the logistic equation and returns a function that takes a templated time variable and returns a value of the same type at time t
.
Input:
The free parameters that define the logistic equation: \( \{ \alpha, \beta, P_o \} \), as well as a type T
that the function should be defined over.
Output:
A function that takes a parameter t
of type T
and returns the value of the specified logisic equation evaluated at t
.
Usage/Example:
To use this function, you have to include it in the file you need to call it from.
Output:
Implementation/Code:
I made this function as abstract as possible. I probably could have gone with partial function application to bind \( \alpha \), \( \beta \), and \( P_o \), but C++ does not have a very clean way of doing this yet. Instead, I created a small factory for the logistic equation that took the free parameters and returns a function that is a logistic map.