Metadata-Version: 2.1
Name: lorenzpy
Version: 0.0.2
Summary: A Python package to simulate and measure chaotic dynamical systems.
Author-email: Dennis Duncan <DuncDennis@gmail.com>
Maintainer-email: Dennis Duncan <DuncDennis@gmail.com>
License: MIT License
        
        Copyright (c) 2023 DuncDennis
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: homepage, https://github.com/DuncDennis/lorenzpy
Project-URL: repository, https://github.com/DuncDennis/lorenzpy
Project-URL: documentation, https://duncdennis.github.io/lorenzpy/
Project-URL: changelog, https://github.com/DuncDennis/lorenzpy/blob/main/CHANGELOG.md
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.22.0
Requires-Dist: scipy>=1.10.0
Provides-Extra: dev
Requires-Dist: pytest==7.2.0; extra == "dev"
Requires-Dist: pytest-cov==4.0; extra == "dev"
Requires-Dist: black==23.1.0; extra == "dev"
Requires-Dist: mypy==1.1.1; extra == "dev"
Requires-Dist: ruff==0.1.0; extra == "dev"
Requires-Dist: mkdocs; extra == "dev"
Requires-Dist: mkdocstrings[python]; extra == "dev"
Requires-Dist: mkdocs-material; extra == "dev"
Requires-Dist: pre-commit==3.1.1; extra == "dev"
Provides-Extra: plot
Requires-Dist: matplotlib>=3.5; extra == "plot"

# LorenzPy

A Python package to simulate and measure chaotic dynamical systems.

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)
[![codecov](https://codecov.io/gh/DuncDennis/lorenzpy/branch/main/graph/badge.svg?token=ATWAEQHBYB)](https://codecov.io/gh/DuncDennis/lorenzpy)
[![license: MIT](https://img.shields.io/badge/License-MIT-purple.svg)](LICENSE)
[![Python versions](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)

------

![Flow-Attractors](static/attractor_animation.gif)

------

## ⚙️ Installation

To install only the core functionality:
```bash
$ pip install lorenzpy
```

To install with the additional plotting functionality.
This also installs `matplotlib`. ⚠️ Plotting functionality not in a useful state.
```bash
$ pip install lorenzpy[plot]
```


## ▶️ Usage

LorenzPy can be used to simulate and measure chaotic dynamical systems.
The following example shows how to simulate the famous
[Lorenz63 system](https://de.wikipedia.org/wiki/Lorenz-Attraktor), and measure its
largest [Lyapunov exponent](https://en.wikipedia.org/wiki/Lyapunov_exponent) from the
Lorenz63 iterator:

````python
import lorenzpy as lpy

# Initialize the Lorenz63 simulation object with a RK4 time step of dt=0.05
l63_obj = lpy.simulations.Lorenz63(dt=0.05)

# Simulate 5000 steps of the Lorenz63 system:
data = l63_obj.simulate(5000)    # -> data.shape = (5000,3)

# Calculate the largest Lyapunov exponent from the l63_obj iterator:
iterator = l63_obj.iterate
lle = lpy.measures.largest_lyapunov_exponent(
    iterator_func=iterator,
    starting_point=l63_obj.get_default_starting_pnt(),
    dt=l63_obj.dt
)
# -> lle = 0.905144329...
````

The calculated largest Lyapunov exponent of *0.9051...* is very close to the literature
value of *0.9056*[^SprottChaos].

For more examples see the [examples folder](examples/README.md).

## 💫 Supported systems


| Name                                  | Type                        | System Dimension |
|:--------------------------------------|-----------------------------|:-----------------|
| `Lorenz63`                            | autonomous dissipative flow | 3                |
| `Roessler`                            | autonomous dissipative flow | 3                |
| `ComplexButterfly`                    | autonomous dissipative flow | 3                |
| `Chen`                                | autonomous dissipative flow | 3                |
| `ChuaCircuit`                         | autonomous dissipative flow | 3                |
| `Thomas`                              | autonomous dissipative flow | 3                |
| `WindmiAttractor`                     | autonomous dissipative flow | 3                |
| `Rucklidge`                     | autonomous dissipative flow | 3                |
| `Halvorsen`                     | autonomous dissipative flow | 3                |
| `DoubleScroll`                     | autonomous dissipative flow | 3                |
| `Lorenz96`                            | autonomous dissipative flow | variable         |
| `DoublePendulum`                      | conservative flow           | 4                |
| `Logistic`                            | noninvertible map           | 1                |
| `Henon`                               | dissipative map             | 2                |
| `SimplestDrivenChaoticFlow`           | conservative flow           | 2 space + 1 time |
| `KuramotoSivashinsky`                 | PDE                         | variable         |
| `MackeyGlass`                         | delay differential equation | variable         |
## 📗 Documentation

- The main documentation can be found here: https://duncdennis.github.io/lorenzpy/
    - ⚠️: The documentation is not in a useful state.
##  ⚠️ Further notes
- So far the usefulness of this package is very limited.
The authors main purpose to creating this package was to learn the full workflow to
develop a Python package.
More information about the development process can be found in [CONTRIBUTING.md](CONTRIBUTING.md).
- The plotting functionality, which can be installed with ``pip install lorenzpy[plot]`` is not tested so far.
- See [Pynamical](https://github.com/gboeing/pynamical) for a similar package

[^SprottChaos]:
    Sprott, Julien Clinton, and Julien C. Sprott. Chaos and time-series analysis. Vol. 69.
    Oxford: Oxford university press, 2003.
