LaplaPy: Advanced Symbolic Laplace Transform Analysis
Overview
LaplaPy is a professional-grade Python library for:
- Symbolic Laplace transforms with rigorous Region of Convergence (ROC) analysis
- Linear ODE solving via Laplace methods, including initial conditions
- Control system analysis: pole-zero maps, stability checks, frequency/time responses
- Educational, step-by-step output modes for teaching and self-study
Designed for engineers, scientists, and researchers in control theory, signal processing, electrical/mechanical systems, and applied mathematics.
Features
- Forward & Inverse Laplace with automatic ROC determination
- ODE Solver: direct transform–solve–invert workflow for linear constant-coefficient equations
- Pole-Zero Analysis: identify all poles and zeros symbolically
- Stability Assessment: evaluate pole locations in the complex plane
- Frequency Response & Bode: generate magnitude/phase plots data for
ω ∈ [ω_min, ω_max] - Time-Domain Response: compute response to arbitrary inputs (e.g., steps, impulses, sinusoids)
- Causal/Non-Causal Modes: model physical vs. mathematical systems
- Step-by-Step Tracing: verbose mode to print every algebraic step (educational)
Installation
From PyPI:
pip install LaplaPy
From source (dev):
git clone https://github.com/4211421036/LaplaPy.git
cd LaplaPy
pip install -e .[dev]
Dependencies: sympy>=1.10, numpy.
Quickstart Examples
1. Basic Laplace Transform
from LaplaPy import LaplaceOperator, t, s
# f(t) = e^{-3t} + sin(2t)
op = LaplaceOperator("exp(-3*t) + sin(2*t)", show_steps=False)
F_s = op.forward_laplace()
print("F(s) =", F_s) # 1/(s+3) + 2/(s^2+4)
print("ROC:", op.roc) # Re(s) > -3
2. Inverse Transform
# Recover f(t)
f_recov = op.inverse_laplace()
print("f(t) =", f_recov) # exp(-3*t) + sin(2*t)
3. Solve ODE
from sympy import Eq, Function, Derivative, exp
f = Function('f')(t)
ode = Eq(Derivative(f, t, 2) + 3*Derivative(f, t) + 2*f,
exp(-t))
# ICs: f(0)=0, f'(0)=1
sol = LaplaceOperator(0).solve_ode(node,
{f.subs(t,0):0, Derivative(f,t).subs(t,0):1})
print(sol) # (e^{-t} - e^{-2t})
4. System Analysis & Bode Data
# H(s) = (s+1)/(s^2+0.2*s+1)
op = LaplaceOperator("(s+1)/(s**2+0.2*s+1)")
op.forward_laplace()
analysis = op.system_analysis()
# poles, zeros, stability
defp print(analysis)
# Bode data
ω, mag_db, phase = op.bode_plot(w_min=0.1, w_max=100, points=200)
5. Time-Domain Response
# Response to sin(4t)
r = op.time_domain_response("sin(4*t)")
print(r)
CLI Usage
The LaplaPy console script provides a quick interface:
# Laplace transform + 2nd derivative:
LaplaPy "exp(-2*t)*sin(3*t)" --laplace
# Inverse Laplace:
LaplaPy "1/(s**2+4)" --inverse
# Solve ODE with ICs:
LaplaPy "f''(t)+4*f(t)=exp(-t)" --ode \
--ic "f(0)=0" "f'(0)=1"
Flags:
--laplace(-L) : forward transform--inverse(-I): inverse transform--ode(-O) : solve ODE--ic: initial conditions--quiet: suppress verbose steps--causal/--noncausal: choose system causality
📚 Mathematical Foundations
Laplace Transform Definition
$$ \mathcal{L}{f(t)}(s) = \int_{0^-}^{\infty} e^{-st}f(t),dt $$
Derivative Property
$$ \mathcal{L}{f^{(n)}(t)}(s) = s^nF(s)-\sum_{k=0}^{n-1}s^{n-1-k}f^{(k)}(0^+) $$
Region of Convergence (ROC)
- For causal signals: $\mathrm{Re}(s) > \max(\mathrm{Re}(\text{poles}))$
- ROC ensures transform integrals converge and stability criteria
Pole-Zero & Stability
- Poles: roots of denominator $D(s)=0$
- Zeros: roots of numerator $N(s)=0$
- Stability: all poles in left-half complex plane
Frequency Response
$$ H(j\omega)=H(s)\big|_{s=j\omega} =|H(j\omega)|e^{j\angle H(j\omega)} $$
Development & Testing
# Install dev extras
pip install -e .[dev]
# Run test suite
pytest -q
# Lint with ruff
ruff .
# Type-check (mypy)
mypy LaplaPy
License
Distributed under the MIT License. See LICENSE for details.
Citation
@software{LaplaPy,
author = {GALIH RIDHO UTOMO},
title = {LaplaPy: Advanced Symbolic Laplace Transform Analysis},
year = {2025},
url = {https://github.com/4211421036/LaplaPy},
version = {0.2.2}
}
Metadata
Release files for LaplaPy 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| laplapy-0.2.6.tar.gz | 13.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| laplapy-0.2.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.0 kB
Release files / laplapy-0.2.6.tar.gz
| Download URL | laplapy-0.2.6.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b8794dff0cca5497587219fb4682723c0df4e92c591d7fe93e95784d9edaaef
|
|
BLAKE2b-256 checksum How to use checksums |
78d59c2d277e6f5c9fc51b82820dce912d129a4f6c64ae4ddb4341742d11a3f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / laplapy-0.2.6-py3-none-any.whl
| Download URL | laplapy-0.2.6-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c63e71441b8c63c2efe1071b906742a913f8d285bef7cbf48976ece6a83cbf59
|
|
BLAKE2b-256 checksum How to use checksums |
697b75d76f5e6bf9adcc7932fe9fad6433cf6e60724356a4e02da093c66ec1c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|