Metadata-Version: 2.4
Name: useful-math-functions
Version: 0.6.0
Summary: useful-math-functions for Optimization, Benchmarking, Visualizing, and more ...
Project-URL: homepage, https://anselmoo.github.io/useful-math-functions/
Project-URL: documentation, https://anselmoo.github.io/useful-math-functions/
Project-URL: repository, https://github.com/Anselmoo/useful-math-functions
Project-URL: issues, https://github.com/Anselmoo/useful-math-functions/issues
Project-URL: changelog, https://github.com/Anselmoo/useful-math-functions/blob/main/CHANGELOG.md
Project-URL: license, https://github.com/Anselmoo/useful-math-functions/blob/main/LICENSE.md
Project-URL: pypi, https://pypi.org/project/useful-math-functions/
Author-email: Anselm Hahn <anselm.hahn@gmail.com>
Maintainer-email: Anselm Hahn <anselm.hahn@gmail.com>
License-Expression: MIT
License-File: LICENSE.md
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Documentation
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Typing :: Typed
Requires-Python: <3.15,>=3.12
Requires-Dist: numpy<3,>=2.4.4
Requires-Dist: pydantic<3,>=2.13.4
Requires-Dist: scipy<2,>=1.17.1
Provides-Extra: all
Requires-Dist: imagemagic>=0.2.1; extra == 'all'
Requires-Dist: kaleido>=1.3.0; extra == 'all'
Requires-Dist: matplotlib>=3.10.9; extra == 'all'
Requires-Dist: plotly>=6.7.0; extra == 'all'
Provides-Extra: matplotlib
Requires-Dist: imagemagic<0.3.0,>=0.2.1; extra == 'matplotlib'
Requires-Dist: matplotlib<4.0.0,>=3.10.9; extra == 'matplotlib'
Provides-Extra: plotly
Requires-Dist: kaleido==1.3.0; extra == 'plotly'
Requires-Dist: plotly<7.0.0,>=6.7.0; extra == 'plotly'
Description-Content-Type: text/markdown

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8373435.svg)](https://doi.org/10.5281/zenodo.8373435)
[![PyPI](https://img.shields.io/pypi/v/useful-math-functions.svg)](https://pypi.org/project/useful-math-functions/)

# useful-math-functions

`useful-math-functions` is a collection of useful mathematical functions with a
focus on:

1. **ease of use** - the functions are designed to be as easy to use as possible
2. **pure python** - the functions are written in much python as possible and
   only use external libraries when necessary
3. **documentation** - the functions are documented in code itself with:
   1. Examples
   2. Equations
   3. References
   4. Links to external resources

## Installation

The package can be installed via pip:

```bash
pip install useful-math-functions
```

PyPI:
[useful-math-functions on PyPI](https://pypi.org/project/useful-math-functions/)

and for Visualizations:

```bash
# matplotlib
pip install useful-math-functions[matplotlib]

# plotly
pip install useful-math-functions[plotly]

# all visualizations
pip install useful-math-functions[all]
```

## Usage

The package can be imported like any other python package:

```python
from umf.core.create import OptBench
res = OptBench(["DeJongN5Function"], dim=3)
res.plot_type_3d = "plot_surface"
res.plot()
res.save_as_image()
```

![_](https://github.com/Anselmoo/useful-math-functions/blob/main/docs/extra/images/DeJongN5Function.png?raw=true)

To use the newly added functions:

```python
from umf.functions.optimization.special import HimmelblauFunction
import numpy as np

x = np.linspace(-5, 5, 100)
y = np.linspace(-5, 5, 100)
X, Y = np.meshgrid(x, y)
Z = HimmelblauFunction(X, Y).__eval__

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
ax.plot_surface(X, Y, Z, cmap="viridis")
plt.savefig("HimmelblauFunction.png", dpi=300, transparent=True)
```

```python
from umf.functions.optimization.valley_shaped import Rosenbrock2DFunction
import numpy as np

x = np.linspace(-2, 2, 100)
y = np.linspace(-1, 3, 100)
X, Y = np.meshgrid(x, y)
Z = RosenbrockFunction(X, Y).__eval__

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
ax.plot_surface(X, Y, Z, cmap="viridis")
plt.savefig("RosenbrockFunction.png", dpi=300, transparent=True)
```

## Documentation

The [project documentation](https://anselmoo.github.io/useful-math-functions/)
contains API references and usage examples.

## Contributing

Contributions are welcome. For major changes, please open an issue first to
discuss what you would like to change.

## License

The project is licensed under the
[MIT](https://github.com/Anselmoo/useful-math-functions/blob/main/LICENSE.md)
license.
