Skip to main content

mathpad

mathpad is a robust Computer Algebra System (CAS) library built on top of SymPy, providing a simple and intuitive way to solve engineering, science, and math problems using Python.

Quickstart

  1. Install using package manager of choice. For example, pip:
pip install mathpad
  1. Import and use the library in python:
Code Display
from mathpad import *

v = 5 * m / s

mph = "mph" * miles / hour
eqn = mph == v.eval()

Alt text

Documentation

Currently the only in-depth documentation is Walkthrough.ipynb. You can access it on the JupyterLite Sandbox Site here.

Showcase

Feature Example Display
Units
m

m / s ** 2

feet.in_units(cm)

(V * A).in_units(watt)

Alt text

Values
v = 2.5 * m / s

c = m(5)

Alt text

Symbols
t = "t" * seconds

y = "\\hat{y}_1" * volts

Alt text

Symbolic Functions
a = "a(t)" * m / s ** 2

Alt text

Equations
eqn = (v == a * t)

Alt text

Solving
sln, = solve([eqn], solve_for=[a])

sln[a]

Alt text

Algebra
simplify(e ** (1j * pi))

expand((t + 1)(t + 2))

factor(t**2 + 3 * t * s + 2)

subs((t + 1)(t + 2), { t: 5 })

Alt text

Calculus
diff(a, wrt=t, order=1)


integral(a, wrt=t, between=(0, 10))

Alt text

Vectors
O = R3("O") # 3D frame of reference
v1 = O[1, 2, 3]


x, y, z = ("x", "y", "z") * m
v2 = O[x, y, z]



v3 = "v_3" @ O



v2.cross(v3)

Alt text

Matrices
O2 = R2("O2")
A = Mat[O, O2](
    [1, 2],
    [3, 4],
    [5, 6]
)


v2_wrt_O2 = v2 @ A


B = Mat[O2, O]("B")


I = Mat[O2, O2].I

Alt text

Numpy Compatibility
y = sin(t)
y_fn = as_numpy_func(y)

y_fn({ t: [1, 2, 3] })

import numpy as np
y_fn({
  t: np.arange(
    start=0, stop=2 * np.pi, step=np.pi / 12
  )
})

array([0.84147098, 0.90929743, 0.14112001])


array([0. , 0.25881905, 0.5 , 0.70710678, 0.8660254 , 0.96592583, 1. , 0.96592583, 0.8660254 , 0.70710678, 0.5 , 0.25881905])

Code Generation
generate_c_code(theta, [t])

Credits

This package was created with Cookiecutter and the browniebroke/cookiecutter-pypackage project template.

Metadata

Release files for mathpad 2.1.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 mathpad 2.1.0
File Size Uploaded Provenance Actions
mathpad-2.1.0.tar.gz 45.5 kB Without provenance Details for mathpad-2.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 99.1 kB

Release files / mathpad-2.1.0.tar.gz

Download URL mathpad-2.1.0.tar.gz
Size 45.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ec27856fa9d5a517f033bc4495d09fc5ab610a0d3dbb854a132b14d03848f254
BLAKE2b-256 checksum
How to use checksums
dc98e296cd306cce3f035fcf3f735c25e84abc334a0f484f2e40fe8048738db8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/40.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.3 tqdm/4.65.0 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.12

Release files / mathpad-2.1.0-py3-none-any.whl

Download URL mathpad-2.1.0-py3-none-any.whl
Size 53.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36fe589f2703eb5d53a6cc11ec5472d600378108fcab9aaf3ddcf01bac41e36c
BLAKE2b-256 checksum
How to use checksums
4e8c7d8d33cb2646a52d5d204c5e21f83a000e9fc2f7e19748f2c5af31d7fde6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/40.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.3 tqdm/4.65.0 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.12

Security for mathpad 2.1.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