Skip to main content

Lightweight NumPy-based mathematical backend for physics libraries.

Project description

pyvelora

pyvelora is a lightweight NumPy-based math backend for scientific and simulation workflows. It provides structured Vector, Matrix, and Tensor classes, linear algebra helpers, and an ODE module for differential equation workflows.

What You Get

  • Clear, typed array wrappers for vectors, matrices, and tensors
  • Loop-based arithmetic operators with predictable behavior
  • Linear algebra helpers for decomposition and matrix operations
  • ODE solving helpers with first-order and second-order system support

Philosophy

  • Thin abstraction over NumPy
  • Predictable data containers with explicit operations
  • Reusable core infrastructure for physics/simulation libraries

Installation

pip install pyvelora

Optional dependencies:

  • SciPy for ODE solving
  • Matplotlib for ODE plotting

Install them with:

pip install scipy matplotlib

Core Quick Start

from pyvelora import Vector, Matrix, Tensor

v = Vector([3, 4])
print(v.magnitude())  # 5.0

m = Matrix([[1, 2], [3, 4]])
print(m.transpose())

t = Tensor([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
print(t.shape)  # (2, 2, 2)

Coordinate Vector Input

Vector supports polar, spherical, and cylindrical coordinate input.

from pyvelora import Vector

# Polar input: [r, theta]
v_polar = Vector([2, 45], type="polar", degrees=True)

# Spherical input: [r, theta, phi]
v_spherical = Vector([1, 90, 30], type="spherical", degrees=True)

# Cylindrical input: [rho, phi, z]
v_cyl = Vector([2, 90, 3], type="cylindrical", degrees=True)

Angles are interpreted as radians unless degrees=True is passed.

Linear Algebra Utilities

from pyvelora import Matrix
from pyvelora.linalg import determinant, inverse, solve
from pyvelora.core import Vector

A = Matrix([[2, 1], [5, 3]])
b = Vector([4, 11])

print(determinant(A))
print(inverse(A))
print(solve(A, b))

ODE Module

The ODE API is available under pyvelora.diffeq.ode.

import numpy as np
from pyvelora.diffeq.ode import solve, second_order

# First-order system: y' = -y
sol = solve(lambda t, y: -y, (0, 2), [1.0], t_eval=np.linspace(0, 2, 11))
print(sol.final())

# Convert second-order equation y'' = -y to first-order system
sho = second_order(lambda t, y, v: -y)
sho_sol = solve(sho, (0, 2 * np.pi), [1.0, 0.0])
print(sho_sol.final())

Error Types

The package provides reusable exception types:

  • PyveloraError
  • ShapeError
  • DimensionError
from pyvelora import Vector, ShapeError

try:
    _ = Vector([1, 2, 3]) + Vector([1, 2])
except ShapeError as exc:
    print(exc)

Development

Run the test suite:

python -m pytest src/pyvelora/tests -q

Build source and wheel distributions:

python -m build --no-isolation

Project Status

pyvelora is currently alpha-stage and actively evolving. Core APIs are usable, but minor interface changes may still happen between releases.

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

pyvelora-0.3.0.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

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

pyvelora-0.3.0-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file pyvelora-0.3.0.tar.gz.

File metadata

  • Download URL: pyvelora-0.3.0.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for pyvelora-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b21e341665e61f3285aaa473addb52a3bd1aa166e3619b71481f1e2acbfcb777
MD5 519954ade061a91da71f733301fb432c
BLAKE2b-256 c55733623c9f1b7ded1cf011dfe241ae57296b4517d7f9dcd7b71f22301150b5

See more details on using hashes here.

File details

Details for the file pyvelora-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyvelora-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 30.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for pyvelora-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f20c8055550a6ba6db86f960728751bfcfca249708ea17410938dbb641dc7971
MD5 391ee41bc9e20d148cdf9eb042b00000
BLAKE2b-256 4eca46efefdd00a28e48d6d05c0f40dd91d9a81f685b57c49662dcef2646ccd3

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