Basis - Maple Help

LinearAlgebra[Modular]

 Basis
 compute Basis and Nullspace mod m

 Calling Sequence Basis(m, A, orient, basis, nullsp)

Parameters

 m - modulus A - mod m Matrix or list or set of mod m Vectors orient - orientation of Vectors in mod m Matrix basis - output format of basis Vectors nullsp - output format of nullspace Vectors

Description

 • The Basis function computes a basis of the set of Vectors described by A, and returns that basis and the nullspace.
 • The orient parameter is specified if A is a mod m Matrix.  It indicates to the Basis command whether the vectors of the input Matrix are in rows (orient=row) or columns (orient=column).
 • The basis and nullsp parameters indicate the format in which the respective Vectors are returned by Basis. They can be any of the following values:

 false no output row list of mod m row vectors column list of mod m column vectors Matrix[row] mod m Matrix with vectors in the rows Matrix[column] mod m Matrix with vectors in the columns

 • If neither basis or nullsp are false, both the basis and nullspace Vectors are returned as a two element sequence. If both are false, an error results.
 For example, if Basis is called with basis=false and nullsp=column, the output would be a list of column Vectors for the nullspace.
 • The Basis command works with a copy of the input data, using the MatBasis command to perform the computation, so if data storage or efficiency are a concern, the MatBasis command should be used.
 • This command is part of the LinearAlgebra[Modular] package, so it can be used in the form Basis(..) only after executing the command with(LinearAlgebra[Modular]).  However, it can always be used in the form LinearAlgebra[Modular][Basis](..).

Examples

Three dimensional basis, two dimensional nullspace, and Vector input.

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\left[\mathrm{Modular}\right]\right):$
 > $p≔2741$
 ${p}{≔}{2741}$ (1)
 > $A≔\left\{\mathrm{seq}\left(\mathrm{Mod}\left(p,\mathrm{Vector}\left[\mathrm{column}\right]\left(5,i↦\mathrm{rand}\left(\right)\right),\mathrm{float}\left[8\right]\right),i=1..3\right)\right\}$
 ${A}{≔}\left\{\left[\begin{array}{c}{2543.}\\ {1568.}\\ {127.}\\ {356.}\\ {581.}\end{array}\right]{,}\left[\begin{array}{c}{430.}\\ {1549.}\\ {2376.}\\ {1511.}\\ {1839.}\end{array}\right]{,}\left[\begin{array}{c}{164.}\\ {1946.}\\ {211.}\\ {49.}\\ {2418.}\end{array}\right]\right\}$ (2)
 > $B,N≔\mathrm{Basis}\left(p,A,\mathrm{column},\mathrm{row}\right)$
 ${B}{,}{N}{≔}\left[\left[\begin{array}{c}{1.}\\ {0.}\\ {0.}\\ {1972.}\\ {1878.}\end{array}\right]{,}\left[\begin{array}{c}{0.}\\ {1.}\\ {0.}\\ {1578.}\\ {1735.}\end{array}\right]{,}\left[\begin{array}{c}{0.}\\ {0.}\\ {1.}\\ {1724.}\\ {2166.}\end{array}\right]\right]{,}\left[\left[\begin{array}{ccccc}{769.}& {1163.}& {1017.}& {1.}& {0.}\end{array}\right]{,}\left[\begin{array}{ccccc}{863.}& {1006.}& {575.}& {0.}& {1.}\end{array}\right]\right]$ (3)

Check orthogonality.

 > $\mathrm{seq}\left(\mathrm{seq}\left(\mathrm{Multiply}\left(p,i,j\right),i=N\right),j=B\right)$
 ${0.}{,}{0.}{,}{0.}{,}{0.}{,}{0.}{,}{0.}$ (4)

Matrix input, request nullspace only.

 > $A≔\mathrm{Mod}\left(p,\mathrm{Matrix}\left(3,5,\left(i,j\right)↦\mathrm{rand}\left(\right)\right),\mathrm{integer}\left[\right]\right)$
 ${A}{≔}\left[\begin{array}{ccccc}{30}& {1480}& {754}& {1049}& {423}\\ {1980}& {2533}& {1439}& {67}& {2051}\\ {2635}& {353}& {2657}& {1617}& {2198}\end{array}\right]$ (5)
 > $N≔\mathrm{Basis}\left(p,A,\mathrm{row},\mathrm{false},\mathrm{column}\right)$
 ${N}{≔}\left[\left[\begin{array}{c}{1279}\\ {1956}\\ {2481}\\ {1}\\ {0}\end{array}\right]{,}\left[\begin{array}{c}{327}\\ {2464}\\ {701}\\ {0}\\ {1}\end{array}\right]\right]$ (6)

Check orthogonality.

 > $\mathrm{seq}\left(\mathrm{Multiply}\left(p,A,i\right),i=N\right)$
 $\left[\begin{array}{c}{0}\\ {0}\\ {0}\end{array}\right]{,}\left[\begin{array}{c}{0}\\ {0}\\ {0}\end{array}\right]$ (7)

For the same problem, request the nullspace as Matrix.

 > $N≔\mathrm{Basis}\left(p,A,\mathrm{row},\mathrm{false},\mathrm{Matrix}\left[\mathrm{column}\right]\right)$
 ${N}{≔}\left[\begin{array}{cc}{1279}& {327}\\ {1956}& {2464}\\ {2481}& {701}\\ {1}& {0}\\ {0}& {1}\end{array}\right]$ (8)

Check orthogonality.

 > $\mathrm{Multiply}\left(p,A,N\right)$
 $\left[\begin{array}{cc}{0}& {0}\\ {0}& {0}\\ {0}& {0}\end{array}\right]$ (9)