-- Solution of a system of equations by Cramers rule.
-- Also see the XFun SVD
include "::incl:solver"

-- example system of equations
-- 2x +  y +  z = 2
--  x -  y + 5z = 4
--       y -  z = 8

A={{ 2, 1, 1},  -- coefficients
   { 1,-1, 5},
   { 0, 1,-1}}

C= { 2, 4, 8}   -- constants

solve(A,C):{-8.0,13.0,5.0}

x=solve(A,C)[1]
y=solve(A,C)[2]
z=solve(A,C)[3]

2*x +  y +   z:2.0
  x -  y + 5*z:4.0
       y -   z:8.0
