1.0.0 • Published 9 years ago

# solve-periodic-tridiagonal v1.0.0

## solve-periodic-tridiagonal

Solve a system of linear tridiagonal equations

## Introduction

This module accepts javascript Arrays or typed arrays representing the bands of a periodic tridiagonal matrix and computes the solution using the Thomas algorithm. The problem in matrix form is

The solver will fail if the matrix is singular and may not succeed if the matrix is not diagonally dominant. If the solver fails, it will log a console message and return false.

## Example

Consider the solution of

```
var triper = require('solve-periodic-tridiagonal')
var d = [32, 25, 3, 41]
triper(4, [7, -1, 2, 1], [2, 7, -3, 8], [1, 4, 2, 6], d, [])
// => d = [ 1, 2, 3, 4 ]
```

## Installation

`$ npm install solve-periodic-tridiagonal`

## API

`require('solve-periodic-tridiagonal')(n, a, b, c, d, w)`

**Arguments**:

`n`

: an integer representing the number of equations in the system`a`

: a javascript`Array`

or typed array of length n representing the subdiagonal, indexed according to the equation above. Left unchanged by the solver.`b`

: a javascript`Array`

or typed array of length n representing the diagonal, indexed as above. This vector is modified by the solver.`c`

: a javascript`Array`

or typed array of length n representing the superdiagonal, indexed as above. This vector is modified by the solver.`d`

: a javascript`Array`

or typed array of length n representing the known vector d. On successful completion, this vector will contain the solution.`w`

: a work vector. Must be a javascript`Array`

or typed array of length n.

**Returns**: True on successful completion, false otherwise.

## License

© 2016 Ricky Reusser. MIT License.

1.0.0

9 years ago