useful-math-functions for Optimization, Benchmarking, Visualizing, and more ...
Project description
useful-math-functions
useful-math-functions is a collection of useful mathematical functions with a
focus on:
- ease of use - the functions are designed to be as easy to use as possible
- pure python - the functions are written in much python as possible and only use external libraries when necessary
- documentation - the functions are documented in code itself with:
- Examples
- Equations
- References
- Links to external resources
Installation
The package can be installed via pip:
pip install useful-math-functions
and for Visualizations:
# 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:
from umf.core.create import OptBench
res = OptBench(["DeJongN5Function"], dim=3)
res.plot_type_3d = "plot_surface"
res.plot()
res.save_as_image()
To use the newly added functions:
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)
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 documentation can be found here.
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 license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file useful_math_functions-0.4.0.tar.gz.
File metadata
- Download URL: useful_math_functions-0.4.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3a4bfae3fb60511435ed644558c762160e67256ca0531d9fbc01380ffd67fdc
|
|
| MD5 |
77ecd32a13fa92872f73c59fdf52fd5e
|
|
| BLAKE2b-256 |
f0531d8197bae625f0196b32f90207e7a0c8fade257dace0b64f19cd0ddc2205
|
File details
Details for the file useful_math_functions-0.4.0-py3-none-any.whl.
File metadata
- Download URL: useful_math_functions-0.4.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcd485d330b842edbda189ffc2e67678e3724587e305f2823fa177dd1dd5ab6e
|
|
| MD5 |
e1932031b0c7e660801565a67ac9d8a9
|
|
| BLAKE2b-256 |
ecc6ee3a222351c277d8ef6027dbbd5016082bc9315be138a79769cdd95088e6
|