MathGroup Archive 2004

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

Search the Archive

Re: Slow LinearSolve.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49664] Re: [mg49657] Slow LinearSolve.
  • From: "Christos Argyropoulos MD" <chrisarg at medscape.com>
  • Date: Tue, 27 Jul 2004 07:00:42 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi ,
Try entering the problem as LinearSolve[N[A],N[b]].
The reason it takes for ever, is that your matrices consist 
of "exact" numbers i.e. e, I, Pi and Mathematica tries to give you an
exact i.e. symbolic result. That will take for ever since the 
symbolic solutions of linear systems is computationally expensive. If 
you only want numberical answers, simply ask for them by prefacing 
the matrices with N[]; then they will converted to Floating Point and 
evaluated numerically FAST as the following shows (Math4.2 XP Pro 
Intel at 3.0GHz HT 4 GB DDR)
In[8]:=
Timing[Table[LinearSolve[N[A],N[b]],{1000}];]

Out[8]=
{0.187 Second,Null}
The answer btw is:
\!\({\(\(0.0744635081595152`\)\(\[InvisibleSpace]\)\) + \
3.7253195763747384`*^-14\ \[ImaginaryI], \(\(0.42971490576141286`\)\(\
\[InvisibleSpace]\)\) - 2.4999986347577774`*^-13\ \[ImaginaryI], \
\(-0.07819866153696708`\) + 8.649608688391904`*^-13\ \[ImaginaryI], \
\(\(0.8882136952400588`\)\(\[InvisibleSpace]\)\) - 
2.0302351108874434`*^-12\ \
\[ImaginaryI], \(-0.7103217579953505`\) + 3.571291726971529`*^-12\ \
\[ImaginaryI], \(\(1.5245842254651043`\)\(\[InvisibleSpace]\)\) - \
4.937329408163937`*^-12\ \[ImaginaryI], \(-1.1153191765977668`\) + \
5.485925299100747`*^-12\ \[ImaginaryI], \(\(1.5245842254651498`\)\(\
\[InvisibleSpace]\)\) - 4.932307492121202`*^-12\ \[ImaginaryI], \
\(-0.7103217579954203`\) + 3.562747427805768`*^-12\ \[ImaginaryI], \
\(\(0.8882136952401251`\)\(\[InvisibleSpace]\)\) - 
2.0202080839356457`*^-12\ \
\[ImaginaryI], \(-0.07819866153701173`\) + 8.564310183614438`*^-13\ \
\[ImaginaryI], \(\(0.4297149057614334`\)\(\[InvisibleSpace]\)\) - \
2.450344072611743`*^-13\ \[ImaginaryI], \(\(0.0744635081595099`\)\(\
\[InvisibleSpace]\)\) + 3.602152386151295`*^-14\ \[ImaginaryI]}\)

The "other" product probably cannot do symbolic AND numerical stuff. 
So stick with Mathematica
Christos Argyropoulos MD MSc
Patras Greeece


Sent by Medscape Mail: Free Portable E-mail for Professionals on the Move   
http://www.medscape.com


  • Prev by Date: Re: Fibonacci[1,000,000,000] contains 208,987,640 decimal digits (was: Fibonachi[5,000,000] contains 1044938 decimal digits)
  • Next by Date: Re: Slow LinearSolve.
  • Previous by thread: Re: Slow LinearSolve.
  • Next by thread: Re: Slow LinearSolve.