Skip to main content

useful-math-functions for Optimization, Benchmarking, Visualizing, and more ...

Project description

DOI PyPI

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:

pip install useful-math-functions

PyPI: useful-math-functions on PyPI

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 project documentation 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 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

useful_math_functions-0.6.0.tar.gz (93.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

useful_math_functions-0.6.0-py3-none-any.whl (125.8 kB view details)

Uploaded Python 3

File details

Details for the file useful_math_functions-0.6.0.tar.gz.

File metadata

  • Download URL: useful_math_functions-0.6.0.tar.gz
  • Upload date:
  • Size: 93.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for useful_math_functions-0.6.0.tar.gz
Algorithm Hash digest
SHA256 405099f4c167f5dd93efdd223e25685d8a9cb748c9802af899cdb89ea323cb0c
MD5 dd75b1d2a57550034f9d36ec38c6e75a
BLAKE2b-256 5f454eb6b67a9373930557e5179af638c38f81c3254c47c3f1739bd3b1322188

See more details on using hashes here.

File details

Details for the file useful_math_functions-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for useful_math_functions-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c00a59c7f383a2b32d81784514fcaed5f984964a1ffb349714f5cd51907acb4
MD5 a8ed8679a9b83c213b4cf05379082e7c
BLAKE2b-256 aa9e096b62f9a44022bc597ea83eb121ee86cf5ef2cadcffcf23b22317a649f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page