[Newbie] Simpliftin simultaneous equations with matrix notation



The functions coefmatrix, augcoefmatrix, and the undocumented function linsolve_by_lu might help:

(%i30) eq : [5*x + 7*y = 41, x-y=23]$

The coefficient matrix (notice its coefmatrix, not coeffmatrix )
 
  (%i31) coefmatrix(eq,[x,y]);
  (%o31) matrix([5,7],[1,-1])

And the augmented coefficient matrix (the signs of the constant terms might be opposite from what you would like); 

  (%i32) augcoefmatrix(eq,[x,y]);
  (%o32) matrix([5,7,-41],[1,-1,-23])

  (%i33) [m,b] : [submatrix(%,3), -submatrix(%,1,2)];
  (%o33) [matrix([5,7],[1,-1]),matrix([41],[23])]

Solve linear equations using the LU factorization

  (%i34) linsolve_by_lu(m,b);
  (%o34) [matrix([101/6],[-37/6]),false]

Solve using binary64 numbers and partial pivoting--the second value (11.28) is an estimate of the matrix condition number

 (%i35) linsolve_by_lu(m,b,floatfield);
 (%o35) [matrix([16.83333333333333],[-6.166666666666665]),11.28]

Actual condition number:

  (%i42) mat_norm(m,'inf) * mat_norm(m^^-1,'inf);
  (%o42) 8

--Barton

________________________________________
From: maxima-bounces at math.utexas.edu [maxima-bounces at math.utexas.edu] on behalf of Richard Owlett [rowlett at cloud85.net]
Sent: Monday, July 15, 2013 06:39
To: Maxima at math.utexas.edu
Subject: [Newbie] Simpliftin simultaneous equations with matrix        notation

As a retiree, I'm essentially reviewing network theory I
supposedly learned as a sophomore E.E. but never used in the last
50 years. At the moment I'm using Maxima primarily as an editor
which gives easily read equations. Later I'll run system
simulations in the discrete time domain. [If this sounds like
reinventing wheels, it is. One goal is understanding "wheels".]

Right now I'm I'm using brute force manual methods to initially
write the equations and then use simplification functions
(ratsimp and cousins). I don't always get results formatted to my
preferences (have already been shown in another forum a sequence
of operations that gives something close).

Two questions.

1. Given a set of equations, can Maxima present it as a
"coefficient square matrix" times "column vector of unknowns"
equal to "column vector of forcing functions"?

2. For many systems, the matrix of coefficients can be simply
written by inspection. Can Maxima solve the set if given the
matrix form?

TIA


_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima