(a, b)
return sympy.Matrix(A)
Creates the tridiagonal sympy matrix tridiag(b, a, b).
Creates the tridiagonal sympy matrix tridiag(b, a, b).
Creates the tridiagonal sympy matrix tridiag ( b a b ) .
def _sympy_tridiag(a, b):
    """Creates the tridiagonal sympy matrix tridiag(b, a, b)."""
    n = len(a)
    assert n == len(b)
    A = [[0 for _ in range(n)] for _ in range(n)]
    for i in range(n):
        A[i][i] = a[i]
    for i in range(n - 1):
        A[i][i + 1] = b[i + 1]
        A[i + 1][i] = b[i + 1]
    return sympy.Matrix(A)
def _sympy_tridiag ( a , b ) : n = len ( a ) assert n == len ( b ) A = [ [ 0 for _ in range ( n ) ] for _ in range ( n ) ] for i in range ( n ) : A [ i ] [ i ] = a [ i ] for i in range ( n - 1 ) : A [ i ] [ i + 1 ] = b [ i + 1 ] A [ i + 1 ] [ i ] = b [ i + 1 ] return sympy . Matrix ( A )