LinearSolve - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


LinearAlgebra[Modular]

  

LinearSolve

  

solve linear system mod m

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

LinearSolve(m, M, naugment)

LinearSolve(m, M, naugment, inplace=val)

Parameters

m

-

modulus

M

-

Matrix for solve

naugment

-

number of augmented columns in Matrix

val

-

inplace option true/false

Description

• 

The LinearSolve function solves the linear system described by the augmented Matrix M with naugment augmented columns.

• 

The allowable datatypes are hardware integer (dtype=integer[4]/integer[8] or integer[]), hardware float (dtype=float[8]), or Maple integer (dtype=integer).

• 

By default the inplace option is true, and the command returns a reduced row echelon form of the input system, throwing an error if it is inconsistent, or no reduced row echelon form exists (i.e. for some composite m).

  

If inplace is specified as false, the command returns the solution in forms of a sequence. The first element of the sequence is a Matrix (when naugment>1) or a Vector (when naugment=1) corresponding to a solution of the system, followed by the vectors in the nullspace. In the event of a unique solution (empty nullspace), only the one solution exists, so the return is just the first element. Note: even when inplace is set to false, the original input matrix is altered, so if this is not desired, the command should be called on a copy of the Matrix.

• 

Note that this is just a high-level convenience function that uses RowReduce to do the actual work.

• 

This command is part of the LinearAlgebra[Modular] package, so it can be used in the form LinearSolve(..) only after executing the command with(LinearAlgebra[Modular]).  However, it can always be used in the form LinearAlgebra[Modular][LinearSolve](..).

Examples

withLinearAlgebraModular:

Create a random Matrix with a duplicate row (copy 4rth row to 2nd)

pprevprime216

p65521

(1)

MCreatep,4,6,random,integer,C_order

M37606644030791178664583455381615972331346542145607963669665135637135287449338505055023762114648316997482085463019432

(2)

ArrayTools:-Copy6,M,18,M,6:

M

376066440307911786645834553816211464831699748208546301943265135637135287449338505055023762114648316997482085463019432

(3)

Now solve a copy obtaining row reduced form:

M2copyM:

LinearSolvep,M2,2:

M2

10052615556246090010592862380736734001430642213225873000000

(4)

Now solve another copy obtaining the solution in (solution vector, nullspace) form

M3copyM:

solLinearSolvep,M3,2,inplace=false

sol55562460902380736734221322587300,5261592864306465520

(5)

Check the solution and nullspace

Multiplyp,M1..4,1..4,sol1,M1..4,5..6

4583455381546301943250505502375463019432,4583455381546301943250505502375463019432

(6)

Multiplyp,M1..4,1..4,sol2

0000

(7)

See Also

ArrayTools[Copy]

LinearAlgebra/Details

LinearAlgebra[LinearSolve]

LinearAlgebra[Modular]

LinearAlgebra[Modular][Create]

LinearAlgebra[Modular][RowReduce]