https://github.com/thomasthelen/logistic-map
Small class that represents a logistic mapping.
https://github.com/thomasthelen/logistic-map
chaos logistic-map math mathematics
Last synced: 3 months ago
JSON representation
Small class that represents a logistic mapping.
- Host: GitHub
- URL: https://github.com/thomasthelen/logistic-map
- Owner: ThomasThelen
- Created: 2019-05-16T21:35:55.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-24T17:53:48.000Z (over 5 years ago)
- Last Synced: 2025-01-10T21:47:49.734Z (4 months ago)
- Topics: chaos, logistic-map, math, mathematics
- Language: C++
- Homepage:
- Size: 6.84 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Logistic Map
[](https://www.codefactor.io/repository/github/thomasthelen/logistic-map)
## Background
The logistic mapping is an easy recurrence relation that can be used to explore chaos.
This is a small program that generates the output of the relation (shown below), and then plots it.


## Explanation
The code can be broken into plotting code and the math code.
### Plotting Code
I used gnuplot to plot the time series. C++ is notorious for having crappy, hard to use plotting libraries. The decision to use gnuplot is questionable, but I'm not going to re-write it.We open a pipe to gnuplot, see [here](https://github.com/ThomasThelen/Logistic-Map/blob/master/main.cpp#L9) and pipe the data to the process in the [Plot](https://github.com/ThomasThelen/Logistic-Map/blob/master/main.cpp#L40) method.
### Math Code
The math is fairly simple. The [LogisticMap](https://github.com/ThomasThelen/Logistic-Map/blob/master/main.cpp#L11) class represents a logistic map.The heavy lifting is done in `void LogisticMap::ComputeX()`, which just computes the successive value by the rules of the logistic mapping.
## Use
Chances are, you're looking at this as an example of how to impliment the logistic map. You're probably not here to actually run this code. But. If you want to, just create the `LogisticMap` object, call `ComputeX` on it, and then optionally plot with `Plot`.