Skip to main content

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.

Metadata

Release files for useful-math-functions 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for useful-math-functions 0.6.0
File Size Uploaded Provenance Actions
useful_math_functions-0.6.0.tar.gz 93.2 kB Without provenance Details for useful_math_functions-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for useful-math-functions 0.6.0
File Interpreter ABI Platform Actions
useful_math_functions-0.6.0-py3-none-any.whl Python 3 none any Details for useful_math_functions-0.6.0-py3-none-any.whl

Total release size: 219.1 kB

Release files / useful_math_functions-0.6.0.tar.gz

Download URL useful_math_functions-0.6.0.tar.gz
Size 93.2 kB
Tags Source
SHA-256 checksum
How to use checksums
405099f4c167f5dd93efdd223e25685d8a9cb748c9802af899cdb89ea323cb0c
BLAKE2b-256 checksum
How to use checksums
5f454eb6b67a9373930557e5179af638c38f81c3254c47c3f1739bd3b1322188
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / useful_math_functions-0.6.0-py3-none-any.whl

Download URL useful_math_functions-0.6.0-py3-none-any.whl
Size 125.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c00a59c7f383a2b32d81784514fcaed5f984964a1ffb349714f5cd51907acb4
BLAKE2b-256 checksum
How to use checksums
aa9e096b62f9a44022bc597ea83eb121ee86cf5ef2cadcffcf23b22317a649f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for useful-math-functions 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page