Skip to main content

Mathrobo

Mathrobo is a Python library for robotics-oriented mathematical computation, including Lie group operations, spatial transformations, numerical differentiation/integration, and B-spline utilities.

Installation

Install the latest release from PyPI:

pip install mathrobo

If you use uv, you can add Mathrobo to your project with:

uv add mathrobo

Development install

For local development, clone the repository:

git clone https://github.com/MathRobotics/MathRobo.git
cd MathRobo

Sync the development environment from pyproject.toml and uv.lock:

uv sync --extra dev

Install the package in editable mode:

uv pip install -e .

Examples

Refer to the examples in the examples folder, where you can find Jupyter notebooks and scripts demonstrating various use cases of the library.

Usage

You can also work with spatial transformations using the SE3 class. The following snippet creates a 90 degree rotation around the Z axis with a translation, applies the transformation to a point and then inverts it:

import numpy as np
import mathrobo as mr

# Rotation of 90 deg about Z and translation of 1 m along X
rot = mr.SO3.exp(np.array([0.0, 0.0, 1.0]), np.pi / 2)
T = mr.SE3(rot, np.array([1.0, 0.0, 0.0]))

point = np.array([0.0, 1.0, 0.0])
transformed = T @ point
recovered = T.inv() @ transformed

print(transformed)
print(recovered)

Here is a quick example that computes the numerical gradient of a simple function:

import numpy as np
import mathrobo as mr

f = lambda x: np.sum(x**2)
x = np.array([1.0, 2.0, -3.0])
grad = mr.numerical_grad(x, f)
print(grad)

You can also perform numerical integration using the Gaussian quadrature helper gq_integrate:

import numpy as np
import mathrobo as mr

f = lambda s: np.array([np.sin(s)])
val = mr.gq_integrate(f, 0.0, np.pi, digit=5)
print(val)  # ~ 2.0

For spline trajectories, SciPy's BSpline can be used to create and evaluate a curve:

import numpy as np
from scipy.interpolate import make_interp_spline

t = np.array([0, 1, 2, 3])
points = np.array([0.0, 1.0, 0.0, 1.0])
spl = make_interp_spline(t, points, k=3)

ts = np.linspace(0, 3, 20)
ys = spl(ts)
print(ys)

Running Tests

Run the test suite with uv:

uv run --extra dev pytest

Changelog

  • Removed SymPy as a runtime dependency. Mathrobo now supports the NumPy and JAX code paths only, and uv.lock no longer includes SymPy or mpmath.

Contributing

Contributions are welcome! Feel free to report issues, suggest features, or submit pull requests.

License

This project is licensed under the MIT License.

Metadata

Release files for mathrobo 0.0.5

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

Source distribution (sdist)

Source distribution for mathrobo 0.0.5
File Size Uploaded Provenance Actions
mathrobo-0.0.5.tar.gz 155.3 kB Without provenance Details for mathrobo-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mathrobo 0.0.5
File Interpreter ABI Platform Actions
mathrobo-0.0.5-py3-none-any.whl Python 3 none any Details for mathrobo-0.0.5-py3-none-any.whl

Total release size: 185.9 kB

Release files / mathrobo-0.0.5.tar.gz

Download URL mathrobo-0.0.5.tar.gz
Size 155.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3e0d92703927327d8bdba15f99775e07d88f8e9e332086abd7d2efd56cd77868
BLAKE2b-256 checksum
How to use checksums
0aebf98ff7c61ced261615c236c0b1f51203be4f63a86a65edfa294909c84b13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mathrobo-0.0.5-py3-none-any.whl

Download URL mathrobo-0.0.5-py3-none-any.whl
Size 30.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e2c2337ab2a8e765d9f358ae282b1ddb9442ad34f98b73801d762900c270f0e
BLAKE2b-256 checksum
How to use checksums
41700b239999639f91140ec50ceb3793102746d03e1848b8719dd65a0a8e0061
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for mathrobo 0.0.5

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