Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MathematicalTransforms

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.


Features

Transforms

  • 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.

Utilities

  • Reusable symbolic computation utilities powered by SymPy.
  • Numerical data handling using NumPy and Scipy.
  • Constant definitions and general-purpose functions for seamless integration.

Testing Framework

  • Comprehensive tests for all transforms.
  • Modular test classes for easy integration of new functionality.

Installation

Prerequisites

  • Python 3.8 or newer
  • pip for package management

Installation Steps

  1. Clone the repository:
    git clone https://github.com/yourusername/MathematicalTransforms.git
    cd MathematicalTransforms
  2. Install dependencies:
    pip install -r requirements.txt

Dependencies

The requirements.txt includes:

  • sympy: Symbolic mathematics library
  • numpy: Numerical computing library
  • z3-solver: Symbolic solver
  • mpmath: Precision mathematics
  • matplotlib: Data visualization
  • scikit-image: Image processing utilities

Usage

Example: Fourier Transform

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)

Example: Laplace 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)

Testing

Run all tests to verify functionality:

python -m testing.run_all_tests

Project Structure

MathematicalTransforms/
├── 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

Extensibility

Adding a new transform is simple:

  1. Create a new file in the transforms folder.
  2. Define a new class inheriting from BaseTransform.
  3. Implement the following methods:
    • _compute_transform_function
    • _compute_inverse_transform_function
    • (Optional) Custom methods for numerical transforms.

Contribution Guidelines

We welcome contributions to improve functionality, fix bugs, or add features!

  1. Fork the repository.
  2. Create a new branch:
    git checkout -b feature-name
  3. Commit your changes:
    git commit -m "Add feature-name"
  4. Push to your fork:
    git push origin feature-name
  5. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgments

  • Built using SymPy for symbolic mathematics and NumPy for numerical processing.
  • Inspired by mathematical transformations in engineering and physics.
  • This Readme is partly generated by AI (ChatGpt) for formatting reasons.

About

A library for mathematical transforms

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages