Subject: Solving matrix equations, unkowns in both vectors
From: Barton Willis
Date: Thu, 10 Jan 2013 13:10:35 +0000
Maybe you are looking for something like:
(%i7) algsys(xreduce('append, args(K.u-U)),[t2,q,t3,t2]);
(%o7) [[q=100,t3=300,t2=500]]
I used algsys instead of solve--just be careful to not call linsolve on non-linear equations. I think linsolve doesn't check that the
equations are linear and gives a bogus solution. Possibly you want a purely floating point solver--I don't have a recommendation
about that.
Maybe there is a single function that produces a linear list of the matrix entries, but I wasn't able to find its documentation. But
reduce('append, args( ... )) works OK.
--Barton
________________________________________
From: maxima-bounces at math.utexas.edu [maxima-bounces at math.utexas.edu] on behalf of Andrew Dyer [adyer03 at qub.ac.uk]
Sent: Wednesday, January 09, 2013 12:14
To: maxima at math.utexas.edu
Subject: Solving matrix equations, unkowns in both vectors
Gday
I'm trying to use Maxima to solve pretty easy matrix equations while I study FEA.
I typically end up with a matrix equation that needs solving, like this
[square matrix].[column vector]=[column vector]
where both column vectors contain unknowns.
An example would be
K: matrix([1/2,-1/2,0],[-1/2,3/4,-1/4],[0,-1/4,1/4]);
u: matrix([700],[t2],[t3])
U: matrix([q],[-50],[-50])
K.u=U
find q, t2 & t3
The equations are solvable, but I cannot find a convenient way to input the problem into maxima.
The only way I can get it to work is by performing K.u to produce a column vector and then to MANUALLY combine the contents with that contained in column vector U to produce a set of simultaneous equations which solve() or linsolve() can handle. This is very tedious and makes solving large problems impractical.
I cannot use linsolve_by_lu() because the variables are spread across both vectors. (You could always just do something like A.B=C, C=invert(A).B anyway, instead of using linsolve_by_lu() right?)
Is there a way maxima can solve a problem like this directly or at least automatically convert the problem into a format suitable for solve() or linsolve()?
I can't see an easy way to do it with the list operations I know. I'm not sure if I'm just missing something obvious.
Thanks in advance
Andy
University of Wollongong
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima