Previous Up Next

5.61.6  Linear system solving: linsolve

linsolve is used to solve a system of linear equations.
linsolve takes its arguments in two different ways.

If the Step by step option is checked in the general configuration, a window will also pop up showing:

 Matrix [[1,1,2, -1], [0,1, -1, -3], [0, -1, -3,1]]
 Row operation L2 <- (1) * L1- (1) * L2
 Matrix [[1,0,3,2], [0,1, -1, -3], [0, -1, -3,1]]
 Row operation L2 <- (1) * L3 - (- 1) * L2
 Matrix [[1,0,3,2], [0,1, -1, -3], [0,0, -4, -2]]
 Reducing column 3 using pivot -4 at row 3
 Matrix [[1,0,3,2], [0,1, -1, -3], [0,0, -4, -2]]
 Row operation L3 <- (-4) * L1- (3) * L3
 Matrix [[-4,0,0, -2], [0,1, -1, -3], [0,0, -4, -2]]
 Row operation L3 <- (-4) * L2 - (- 1) * L3
 End reduction [[-4,0,0, -2], [0, -4,0,10], [0,0, -4, -2]]

The linsolve command also solves systems with coefficients in ℤ/nℤ.
Input:

linsolve([2*x+y+z-1,x+y+2*z-1,x+2*y+z-4]%3,[x,y,z])

Output:

[1 % 3,1 % 3,1 % 3]

Previous Up Next