LinearAlgebra - Maple Programming Help

Home : Support : Online Help : Mathematics : Linear Algebra : LinearAlgebra Package : Constructors : LinearAlgebra/BandMatrix

LinearAlgebra

 BandMatrix
 construct a banded Matrix

 Calling Sequence BandMatrix(L, n, r, c, options)

Parameters

 L - list of lists of scalars or list of scalars or Vector of scalars; diagonals of the band Matrix n - (optional) non-negative integer; number of subdiagonals in resulting Matrix r - (optional) non-negative integer; row dimension of resulting Matrix c - (optional) non-negative integer; column dimension of resulting Matrix options - (optional); constructor options for the result object

Description

 • The BandMatrix(L) function constructs a banded Matrix from the data provided by L.
 • If  L is a list of lists of scalars, each list element of L is used to initialize a diagonal. The  n+1st element of L is placed along the main diagonal. (If L has fewer than n+1 elements, it is automatically extended with [0]'s.)  The other diagonals are placed in relation to it: L[n-j+1] is placed in the jth subdiagonal for j = 1 .. n and L[n+k+1] is placed in the kth superdiagonal for k = 1 .. nops(L) - n - 1. If any list element is shorter than the length of the diagonal where it is placed, the remaining entries are filled with 0.
 If the row and column dimension parameters are omitted, the size of the constructed Matrix is the minimum size necessary to contain the specified diagonals.
 If n is omitted  in the calling sequence, BandMatrix attempts to place an equal number of sub- and super-diagonals into the resulting Matrix by using $\mathrm{iquo}\left(\mathrm{nops}\left(L\right),2\right)$ subdiagonals.
 • If L is a list or Vector of scalars, its elements are used to initialize all the entries of the corresponding diagonals. In this case, parameter n must be specified in the calling sequence. If the row dimension r is not specified, it defaults to n+1.  If the column dimension is not specified, it defaults to the row dimension. The jth subdiagonal is filled with L[n-j+1] for j = 1 .. n. (If L has fewer than n+1 elements, it is automatically 0-extended.)  The main diagonal is filled with L[n + 1]. The kth superdiagonal is filled with L[n + k + 1] for k = 1 .. nops(L)- n - 1.
 • The constructor options provide additional information (readonly, shape, storage, order, datatype, and attributes) to the Matrix constructor that builds the result. These options may also be provided in the form outputoptions=[...], where [...] represents a Maple list.  If a constructor option is provided in both the calling sequence directly and in an outputoptions option, the latter takes precedence (regardless of the order).
 By default, BandMatrix(L) constructs its output with shape and storage set to the appropriate banded shape and storage. The shape and storage of the resulting Matrix can be overridden by specifying the appropriate values in the options parameters.
 • This function is part of the LinearAlgebra package, and so it can be used in the form BandMatrix(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[BandMatrix](..).

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $\mathrm{LL}≔\left[\left[w,w\right],\left[x,x,x\right],\left[y,y,y\right],\left[z,z\right]\right]:$
 > $\mathrm{BandMatrix}\left(\mathrm{LL}\right)$
 $\left[\begin{array}{ccc}{y}& {z}& {0}\\ {x}& {y}& {z}\\ {w}& {x}& {y}\\ {0}& {w}& {x}\end{array}\right]$ (1)
 > $\mathrm{BandMatrix}\left(\mathrm{LL},1\right)$
 $\left[\begin{array}{cccc}{x}& {y}& {z}& {0}\\ {w}& {x}& {y}& {z}\\ {0}& {w}& {x}& {y}\end{array}\right]$ (2)
 > $\mathrm{BandMatrix}\left(\mathrm{LL},6\right)$
 $\left[\begin{array}{ccc}{0}& {0}& {0}\\ {0}& {0}& {0}\\ {0}& {0}& {0}\\ {z}& {0}& {0}\\ {y}& {z}& {0}\\ {x}& {y}& {0}\\ {w}& {x}& {y}\\ {0}& {w}& {x}\end{array}\right]$ (3)
 > $\mathrm{BandMatrix}\left(\mathrm{LL},1,5,4\right)$
 $\left[\begin{array}{cccc}{x}& {y}& {z}& {0}\\ {w}& {x}& {y}& {z}\\ {0}& {w}& {x}& {y}\\ {0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}\end{array}\right]$ (4)
 > $\mathrm{BandMatrix}\left(\left[-1,4,-1\right],1,6,\mathrm{storage}=\mathrm{rectangular}\right)$
 $\left[\begin{array}{rrrrrr}{4}& {-}{1}& {0}& {0}& {0}& {0}\\ {-}{1}& {4}& {-}{1}& {0}& {0}& {0}\\ {0}& {-}{1}& {4}& {-}{1}& {0}& {0}\\ {0}& {0}& {-}{1}& {4}& {-}{1}& {0}\\ {0}& {0}& {0}& {-}{1}& {4}& {-}{1}\\ {0}& {0}& {0}& {0}& {-}{1}& {4}\end{array}\right]$ (5)
 > $\mathrm{BandMatrix}\left(⟨a,b⟩,3\right)$
 $\left[\begin{array}{cccc}{0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}\\ {b}& {0}& {0}& {0}\\ {a}& {b}& {0}& {0}\end{array}\right]$ (6)

Compatibility

 • The LinearAlgebra[BandMatrix] command was updated in Maple 18.