Solving symbolic linear equations with maple
How can I solve linear equations of the following type in Maple?
$$\begin{pmatrix} 1 & 1 & 1 & 1\\ b-c & c-b & a-b &0 \\ b-d & d-a & 0 &a-b \end{pmatrix} \begin{pmatrix} x_1\\ x_2 \\ x_3\\ x_4 \end{pmatrix} =\begin{pmatrix} 0\\ 0 \\ 0 \end{pmatrix}$$
The problem is that I want to use $a,b,c,d$ as symbolic variables. It seems, Maple only can solve such an equation when $a,b,c,d$ are fixed numbers.
$\endgroup$ 01 Answer
$\begingroup$I don't see Maple having any problem with generating a symbolic solution to this under-determined system, using either the LinearSolve or the solve commands.
restart:
M := Matrix( [[1, 1, 1, 1], [b-c, c-b, a-b, 0], [b-d, d-a, 0, a-b]] ); [ 1 1 1 1 ] [ ] M := [b - c c - b a - b 0 ] [ ] [b - d d - a 0 a - b]
B := Vector([0, 0, 0]); [0] [ ] B := [0] [ ] [0]Unsurprisingly we get a solution with one free parameter.
X := LinearAlgebra:-LinearSolve(M, B); [ _t[3] (2 a - c - d) ] [ - ------------------- ] [ 3 (b - c) ] [ ] [_t[3] (a - 3 b + c + d)] [-----------------------] X := [ 3 (b - c) ] [ ] [ _t[3] ] [ ] [ (a + c - 2 d) _t[3] ] [ ------------------- ] [ 3 (b - c) ]
map( simplify, M . X - B ); [0] [ ] [0] [ ] [0]The above is all in Matrix-Vector form. Equation form can also be produced straightforwardly.
Xsymb := Vector([x1,x2,x3,x4]); [x1] [ ] [x2] Xsymb := [ ] [x3] [ ] [x4]
ans := Equate( Xsymb, X ); [ _t[3] (2 a - c - d) _t[3] (a - 3 b + c + d) ans := [x1 = - -------------------, x2 = -----------------------, x3 = _t[3], [ 3 (b - c) 3 (b - c) (a + c - 2 d) _t[3]] x4 = -------------------] 3 (b - c) ]Or, we could reformulate the question in terms of explicit equations, and pass those to the solve command.
LinearAlgebra:-GenerateEquations( Matrix([M,B]), convert(Xsymb,list) ); [x1 + x2 + x3 + x4 = 0, a x3 + b x1 - b x2 - b x3 - c x1 + c x2 = 0, -a x2 + a x4 + b x1 - b x4 - d x1 + d x2 = 0]
solve( %, [x1, x2, x4] ); [[ x3 (2 a - c - d) x3 (a - 3 b + c + d) x3 (a + c - 2 d)]] [[x1 = - ----------------, x2 = --------------------, x4 = ----------------]] [[ 3 (b - c) 3 (b - c) 3 (b - c) ]] $\endgroup$ More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"