MathGroup Archive 2000

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

Search the Archive

Re: Why is Mathematica so slow ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25443] Re: Why is Mathematica so slow ?
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sun, 1 Oct 2000 02:44:26 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <8r1a9q$i50@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

do you remember -- Mathematica is a "Computer Algebra"
intended for symbolical computations. Numerical computations 
are *not* done with a computer algebra. Long time ago people
invent FORTRAN for this task.

You should simply write a MathLink program that use the fast
C-code and the nice Mathematica interface and the symbolic power
of Mathematica.

One reason for the low speed is simply the index check. Mathematica
*must* check the index in a a[[i]] call. Otherwise a error
would crash the whole program. A C-program will crash in this case
but it's your program and not a commercial strength "crash free"
application.
How ever I have seen C++ codes (with overloaded [] operators) that
spend 70 % of its runtime with index checks. If you really whant speed
for numerics you should use a MathLink program.

Regards
  Jens



Madhusudan Singh wrote:
> 
> Hi
> 
>     I am solving a problem in a numerical linear algebra course that
> involves solving a two point boundary value problem with finite element
> method and LU factorisation. Since this is a part of a course, I am not
> permitted to use inbuilt functions in Mathematica.
>     The matrix generated is a tridiagonal matrix. It is sparse. The
> order varies from 1 to 2^14. I solved this problem by using the
> following code  (end of posting).
>     I did the same problem on C (since I am using Mathematica purely as
> a simple programming language, it does not matter if I use C instead.)
> 
> To solve for matrix orders 1 through 2^14 (14 steps) it takes about 4
> minutes to solve the problem with C, and more than 7 hours with
> Mathematica. The two codes are functionally identical. What is going on
> ?
> 
> With regards,
> 
> Madhusudan Singh.


  • Prev by Date: Re: List element manipulation
  • Next by Date: NDSolve with a function which calls N
  • Previous by thread: Re: Bug: Mathematica multipies statements together
  • Next by thread: Re: Why is Mathematica so slow ?