SOLVE_TOEPLITZ
Solves the linear system Tx = b where T is a Toeplitz matrix. This implementation uses the Levinson-Durbin recursion algorithm.
Excel Usage
=SOLVE_TOEPLITZ(column, b_vector, row)
column(list[list], required): First column of the Toeplitz matrix.b_vector(list[list], required): 2D array representing the right-hand side.row(list[list], optional, default: null): First row of the Toeplitz matrix. If omitted, T is assumed symmetric/Hermitian based on the column.
Returns (list[list]): 2D array representing the solution x.
Example 1: Solve symmetric Toeplitz system
Inputs:
| column | b_vector | ||||
|---|---|---|---|---|---|
| 1 | 0.5 | 0.2 | 1 | 2 | 3 |
Excel formula:
=SOLVE_TOEPLITZ({1,0.5,0.2}, {1,2,3})
Expected output:
| Result |
|---|
| 0.178571 |
| 0.571429 |
| 2.67857 |
Example 2: Solve asymmetric Toeplitz system
Inputs:
| column | b_vector | row | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 1 | 1 | 1 | 1 | 4 | 5 |
Excel formula:
=SOLVE_TOEPLITZ({1,2,3}, {1,1,1}, {1,4,5})
Expected output:
| Result |
|---|
| 0.263158 |
| 0.0526316 |
| 0.105263 |
Example 3: Solve Toeplitz system with column-vector right-hand side
Inputs:
| column | b_vector | row | ||
|---|---|---|---|---|
| 2 | 1 | 5 | 2 | 3 |
| 4 |
Excel formula:
=SOLVE_TOEPLITZ({2,1}, {5;4}, {2,3})
Expected output:
| Result |
|---|
| -2 |
| 3 |
Example 4: Solve one-variable Toeplitz system
Inputs:
| column | b_vector |
|---|---|
| 4 | 12 |
Excel formula:
=SOLVE_TOEPLITZ({4}, {12})
Expected output:
3
Python Code
import numpy as np
from scipy.linalg import solve_toeplitz as scipy_solve_toeplitz
def solve_toeplitz(column, b_vector, row=None):
"""
Solve a Toeplitz system using Levinson Recursion.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.solve_toeplitz.html
This example function is provided as-is without any representation of accuracy.
Args:
column (list[list]): First column of the Toeplitz matrix.
b_vector (list[list]): 2D array representing the right-hand side.
row (list[list], optional): First row of the Toeplitz matrix. If omitted, T is assumed symmetric/Hermitian based on the column. Default is None.
Returns:
list[list]: 2D array representing the solution x.
"""
try:
def to2d(x):
return [[x]] if not isinstance(x, list) else x
c = np.array(to2d(column), dtype=float).flatten()
b = np.array(to2d(b_vector), dtype=float)
# SciPy expects a 1D array for single RHS, but Excel often provides a 2D row/column.
if b.ndim == 2 and 1 in b.shape:
b = b.ravel()
if row is not None:
r = np.array(to2d(row), dtype=float).flatten()
c_or_cr = (c, r)
else:
c_or_cr = c
try:
x = scipy_solve_toeplitz(c_or_cr, b)
except Exception as e:
return f"Error: {str(e)}"
x = np.asarray(x)
if x.ndim == 1:
x = x.reshape(-1, 1)
return x.tolist()
except Exception as e:
return f"Error: {str(e)}"Online Calculator
First column of the Toeplitz matrix.
2D array representing the right-hand side.
First row of the Toeplitz matrix. If omitted, T is assumed symmetric/Hermitian based on the column.