[Newbie] Simpliftin simultaneous equations with matrix notation
Subject: [Newbie] Simpliftin simultaneous equations with matrix notation
From: Richard Owlett
Date: Tue, 16 Jul 2013 06:10:05 -0500
Rearranged to conform to top posting
Barton Willis wrote:
> From: maxima-bounces at math.utexas.edu [maxima-bounces at math.utexas.edu] on behalf of Richard Owlett [rowlett at cloud85.net]
>> [snip]
>> 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?
>>
>
>
> 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
>
Thank you. I will be reading the documentation for the functions
you mentioned.
I did a Google search for "condition number". I don't see how it
could be other than ~1. My equations will describe physically
realizable causal linear time invariant networks (initially also
passive).