MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

What is the most ieeficient code for Simultaneous equaitons??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80123] What is the most ieeficient code for Simultaneous equaitons??
  • From: Zeno <zeno333 at mindspring.com>
  • Date: Mon, 13 Aug 2007 04:31:44 -0400 (EDT)

Here is what i use for solving X number of Simultaneous equations of X
unknowns each. (An example for 5 equaitons follows).
_________________________________

In[1]:= m = RandomInteger[{1, 9}, {5, 5}]

Out[1]= {{4, 6, 9, 9, 1}, {6, 7, 5, 8, 1}, {7, 1, 8, 3, 2}, {1, 4, 2, 
  5, 7}, {1, 9, 3, 7, 1}}

In[2]:= b = RandomInteger[{1, 9}, 5]

Out[2]= {1, 5, 3, 3, 6}

In[3]:= xs = N[LinearSolve[m, b], 17]

Out[3]= {0.63964894166236448, 1.4923421097917742, \
-0.0073997590776114266, -1.1987609705730511, 0.34279814145585958}

In[4]:= m.xs - b

Out[4]= {0.*10^-16, 0.*10^-16, 0.*10^-16, 0.*10^-16, 0.*10^-16}
__________________________________________

the last input checks for accuracy.

Is there a more efficient faster way. my ways pretty fast, can do a
system of 100 equations on a 933 Mhz G4 OS X computer in 2 seconds, but
am wondering if there is a even faster way.


  • Prev by Date: question
  • Next by Date: Re: frameticks and LogScale
  • Previous by thread: Re: [TS 20904]--Re:numbered lists problem
  • Next by thread: Exporting to a 3D file...