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
useful_math_functions-0.6.0.tar.gz 93.2 kB Details

Built distribution (wheel)

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

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

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

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