Metadata-Version: 2.4
Name: tautoolbox
Version: 0.96.0
Summary: A package that implements Lanczos' Tau method to solve differential problems
Author: José Matos, Paulo Vasconcelos
Author-email: José Matos <jamatos@fep.up.pt>, Paulo Vasconcelos <pjv@fep.up.pt>
License-Expression: LGPL-3.0-or-later
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Requires-Dist: numpy
Requires-Dist: matplotlib
Requires-Python: >=3.10
Project-URL: Homepage, https://cmup.fc.up.pt/tautoolbox/
Description-Content-Type: text/markdown

# Tau Toolbox
<!-- BADGES-START -->
[![PyPI version](https://img.shields.io/pypi/v/tautoolbox.svg?color=blue)](https://pypi.org/project/tautoolbox/)
[![Python Versions](https://img.shields.io/pypi/pyversions/tautoolbox.svg)](https://pypi.org/project/tautoolbox/)
[![License: LGPL v3](https://img.shields.io/badge/License-LGPL_v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0.html)
<!-- BADGES-END -->

**Tau Toolbox** is a high-performance Python library for solving complex linear and non-linear integro-differential equations using Lanczos' Tau method. Designed for precision and ease of use, it transforms tough differential, integral, and fractional boundary value problems into fast, accurate algebraic systems—delivering spectral-level precision with minimal computational overhead.

Tau Toolbox is free software released under the GNU Lesser General Public
License version 3 (LGPLv3). A copy of the License is enclosed in the project.

The [project site](https://cmup.fc.up.pt/tautoolbox/) documents the Matlab/Octave version of the package.

The [Python documentation](http://https://tautoolbox.bitbucket.io/) is based on the code and documentation content of the project.

---

## ✨ Key Features

* **Expressive Symbolic-Like Syntax:** Define differential equations and boundary conditions directly as Python functions using intuitive operators.
* **Spectral Precision:** Achieve exponential convergence rates for smooth functions with automatic residual tracking.
* **Flexible Bases:** Native support for standard orthogonal bases including **Jacobi**, **Gegenbauer**, **Legendre**, and **Chebyshev** (the four kinds) polynomials.
* **Comprehensive Operator Support:** Seamlessly handle differential, integral, fractional, and boundary value conditions using matrix operator representations. This applies both for single equations and systems of equations.
* **Built-in Visualization:** Evaluate and plot solution approximations and error residuals out of the box.

---

## 📦 Installation

Install the latest release via PyPI:

```bash
pip install tautoolbox
```

Or install the development version directly from Bitbucket:

```bash
git clone [https://bitbucket.org/tautoolbox/taupy.git](https://bitbucket.org/tautoolbox/taupy.git)
cd taupy
pip install -e .
```

---

## 🚀 Quick Start

Solving a boundary value problem in Tau Toolbox is completely expressive.

Here is how to solve $y''(x) + y(x) = 0$ on $[0, 2\pi]$ subject to $y(0) = 1$ and $y'(2\pi) = 0$:

``` python
from tautoolbox import tau
from tautoolbox.functions import diff, linspace

import numpy as np
from numpy import pi as π
import matplotlib.pyplot as plt

# 1. Define the problem, domain, and conditions
problem = tau.problem(
    lambda x, y: diff(y, 2) + y,            # Differential equation
    [0, 2 * π],                             # Problem domain
    lambda y: [y(0) - 1, y.diff(1, 2 * π)]  # Boundary conditions: y(0)=1, y'(2π)=0
)

# 2. Solve the problem
yn, info = tau.solve(problem)

# 3. Evaluate and plot the solution
x = linspace(yn)
plt.plot(x, yn(x))
plt.title("Tau Method Solution")
plt.xlabel("x")
plt.ylabel("y(x)")
plt.show()


# 4. Plot the error in the solution
plt.plot(x, np.abs(np.cos(x) - yn(x)))
plt.title("Absolute error in the approximated solution")
plt.xlabel("x")
plt.ylabel("$|y(x)-y_n(x)|$")
plt.show()

# 5. Plot the residual error directly
info.residual.plot()
plt.title("Solution Residual")
plt.show()
```

---

## 🏛️ Orthogonal Polynomial Bases

Tau Toolbox supports various standard orthogonal polynomial families and allows flexible basis switching.

The solution are expressed as a Polynomial that is associated with one the previous bases.

---

## 📚 Documentation & Examples

Full documentation, tutorial notebooks, and API references are available at (for the moment only in the source - work is in progress to make it available autonomously).

Check out the [`examples/`](https://bitbucket.org/tautoolbox/taupy/src/main/examples/) directory for scripts on:

* Solving fractional differential equations.
* Non-linear boundary value problems via Newton-Tau iterations.
* Systems of coupled integro-differential equations.

---

## 🤝 Contributing

Contributions are welcome!

---

## 📄 License

Tau Toolbox is free software: you can redistribute it and/or modify it under the terms of the **GNU Lesser General Public License (LGPLv3)** as published by the Free Software Foundation. See the LICENSE file for full details.

---

**Notice** that we refer sometimes to `taupy`, this is not to be confused with the [`taupy` package](https://pypi.org/project/taupy/).
This reference, that we have used internally since 2021, refers to the Python implementation of the [Matlab/Octave Tautoolbox](https://bitbucket.org/tautoolbox/tautoolbox/src/main/).
There are some small differences between both implementations but the general structure is the same, and as long as possible, the syntax is also the same adapted to the syntax of each language.

---

AUTHORS:

    Paulo B. Vasconcelos
    Centro de Matemática - Universidade do Porto
    Email: pjv@fep.up.pt

    José M. A. Matos
    Centro de Matemática - Universidade do Porto
    Email: jma@isep.ipp.pt

    José A. O. Matos
    Centro de Matemática - Universidade do Porto
    Email: jamatos@fep.up.pt

    Nilson Lima

    Marcelo Trindade

REFERENCE:

    Solving differential eigenproblems via the spectral Tau method
    NUMERICAL ALGORITHMS
    DOI: https://doi.org/10.1007/s11075-022-01366-z
