Re: Speeding up Inverting matrices.

*To*: mathgroup at smc.vnet.net*Subject*: [mg23040] Re: Speeding up Inverting matrices.*From*: Eckhard Hennig <hennig at itwm.uni-kl.de>*Date*: Thu, 13 Apr 2000 02:43:26 -0400 (EDT)*Organization*: ITWM*References*: <8d0q3v$4oi@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

David McGloin schrieb in Nachricht <8d0q3v$4oi at smc.vnet.net>... >I wish to solve the matrix equation Ax = b for x where A is a 24 x 24 >matrix and x and b are column matrices. Most of the values in the matrix >are numbers (and many are equal to zero), but one remains unevaluated >i.e element [1,10] may be 160 + d, where d is unevaluated. Currently >we're using the command: > >x = {Inverse [A]. b} > >this works fine for the smaller matrices we use (8 x 8 and 16 x 16) but >the calculation has now be runing for over 2 days (the smaller matrices >may take many minutes if not seconds). The program is running on a PII >350MHz with 64Mb of RAM. Does anyone have any ideas about how to >optimise our calculation? Yes, do not calculate a symbolic matrix inverse explicitly unless you really need it. Use LinearSolve instead: x = LinearSolve[A, b] However, for sparse equations, I recommend to convert the matrix equation Ax = b to a list of equations (see below) and use Solve to calculate the solution (Solve is faster than LinearSolve for sparse symbolic equations). x = {x1, x2, x3, ..., x24} eqs = Thread[A.x == b] Solve[eqs, x] HTH, Eckhard ----------------------------------------------------------- Dipl.-Ing. Eckhard Hennig mailto:hennig at itwm.uni-kl.de Institut fuer Techno- und Wirtschaftsmathematik e.V. (ITWM) Erwin-Schroedinger-Strasse, 67663 Kaiserslautern, Germany Voice: +49-(0)631-205-3126 Fax: +49-(0)631-205-4139 http://www.itwm.uni-kl.de/as/employees/hennig.html ITWM - Makers of Analog Insydes for Mathematica http://www.itwm.uni-kl.de/as/products/ai -----------------------------------------------------------