Maxima Function
linsolve ([expr_1, ..., expr_m], [x_1, ..., x_n])
Solves the list of simultaneous linear equations for the list of variables. The expressions must each be polynomials in the variables and may be equations.
When globalsolve
is true
,
each solved-for variable is bound to its value in the solution of the equations.
When backsubst
is false
, linsolve
does not carry out back substitution after
the equations have been triangularized. This may be necessary in very
big problems where back substitution would cause the generation of
extremely large expressions.
When linsolve_params
is true
,
linsolve
also generates the %r
symbols
used to represent arbitrary parameters described in the manual under
algsys
.
Otherwise, linsolve
solves an under-determined system of
equations with some variables expressed in terms of others.
When programmode
is false
,
linsolve
displays the solution with intermediate expression (%t
) labels,
and returns the list of labels.
(%i1) e1: x + z = y; (%o1) z + x = y (%i2) e2: 2*a*x - y = 2*a^2; 2 (%o2) 2 a x - y = 2 a (%i3) e3: y - 2*z = 2; (%o3) y - 2 z = 2 (%i4) [globalsolve: false, programmode: true]; (%o4) [false, true] (%i5) linsolve ([e1, e2, e3], [x, y, z]); (%o5) [x = a + 1, y = 2 a, z = a - 1] (%i6) [globalsolve: false, programmode: false]; (%o6) [false, false] (%i7) linsolve ([e1, e2, e3], [x, y, z]); Solution (%t7) z = a - 1 (%t8) y = 2 a (%t9) x = a + 1 (%o9) [%t7, %t8, %t9] (%i9) ''%; (%o9) [z = a - 1, y = 2 a, x = a + 1] (%i10) [globalsolve: true, programmode: false]; (%o10) [true, false] (%i11) linsolve ([e1, e2, e3], [x, y, z]); Solution (%t11) z : a - 1 (%t12) y : 2 a (%t13) x : a + 1 (%o13) [%t11, %t12, %t13] (%i13) ''%; (%o13) [z : a - 1, y : 2 a, x : a + 1] (%i14) [x, y, z]; (%o14) [a + 1, 2 a, a - 1] (%i15) [globalsolve: true, programmode: true]; (%o15) [true, true] (%i16) linsolve ([e1, e2, e3], '[x, y, z]); (%o16) [x : a + 1, y : 2 a, z : a - 1] (%i17) [x, y, z]; (%o17) [a + 1, 2 a, a - 1]