A Python library that facilitates symbolic and numerical mathematical transforms, designed for computational tasks in engineering, science, and education. The library provides a modular framework for transforms such as Fourier, Laplace, Hankel, Wavelet, Radon, and Z transforms, ensuring ease of extension and robust test coverage.
- Fourier Transform: Symbolic and numerical computation for signal analysis.
- Laplace Transform: Symbolic and numerical computation for systems analysis.
- Hankel Transform: A mathematical tool used in various fields including optics.
- Wavelet Transform: Decomposition of signals for multi-resolution analysis.
- Radon Transform: Utilized in image reconstruction.
- Z Transform: Analysis and processing of discrete signals.
- Reusable symbolic computation utilities powered by SymPy.
- Numerical data handling using NumPy and Scipy.
- Constant definitions and general-purpose functions for seamless integration.
- Comprehensive tests for all transforms.
- Modular test classes for easy integration of new functionality.
- Python 3.8 or newer
pipfor package management
- Clone the repository:
git clone https://github.com/yourusername/MathematicalTransforms.git cd MathematicalTransforms - Install dependencies:
pip install -r requirements.txt
The requirements.txt includes:
sympy: Symbolic mathematics librarynumpy: Numerical computing libraryz3-solver: Symbolic solvermpmath: Precision mathematicsmatplotlib: Data visualizationscikit-image: Image processing utilities
from sympy import symbols, sin
from transforms.fourier import FourierTransform
# Define a symbolic function
t = symbols('t')
function = sin(t)
# Initialize Fourier Transform
ft = FourierTransform(
function,
t=t
)
# Compute symbolic transform
symbolic_transform = ft.transformed_function
print("Symbolic Fourier Transform:", symbolic_transform)
# Numerical data transform
data = [1, 2, 3, 4]
numerical_transform = ft.transform_data(data)
print("Numerical Fourier Transform:", numerical_transform)from sympy import symbols, exp
from transforms.laplace import LaplaceTransform
# Define a symbolic function
s = symbols('s')
function = exp(-s)
# Initialize Laplace Transform
lt = LaplaceTransform(
function=function,
s=s
)
# Compute symbolic transform
symbolic_transform = lt.transformed_function
print("Symbolic Laplace Transform:", symbolic_transform)Run all tests to verify functionality:
python -m testing.run_all_testsMathematicalTransforms/
├── transforms/
│ ├── fourier.py # Fourier Transform implementation
│ ├── laplace.py # Laplace Transform implementation
│ ├── wavelet.py # Wavelet Transform implementation
│ ├── base_transform/ # Base classes for extensibility
├── utils/
│ ├── util.py # General utility functions
│ ├── sympy_math.py # Symbolic computation utilities
│ ├── consts.py # Predefined constants
├── testing/
│ ├── tests/ # Unit tests for transforms
│ ├── run_all_tests.py # Main test runner
├── requirements.txt # Project dependencies
├── README.md # Documentation
Adding a new transform is simple:
- Create a new file in the
transformsfolder. - Define a new class inheriting from
BaseTransform. - Implement the following methods:
_compute_transform_function_compute_inverse_transform_function- (Optional) Custom methods for numerical transforms.
We welcome contributions to improve functionality, fix bugs, or add features!
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature-name" - Push to your fork:
git push origin feature-name
- Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
- Built using
SymPyfor symbolic mathematics andNumPyfor numerical processing. - Inspired by mathematical transformations in engineering and physics.
- This Readme is partly generated by AI (ChatGpt) for formatting reasons.