Mathematica 9 is now available
Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Where's the Speed?

  • To: mathgroup at
  • Subject: [mg19852] Re: [mg19764] Where's the Speed?
  • From: wexler at (Carlos Wexler)
  • Date: Sun, 19 Sep 1999 01:20:36 -0400
  • Organization: University of Florida, Gainesville
  • References: <7rshul$>
  • Sender: owner-wri-mathgroup at

Repeating the same calculations in a "SunOS einstein 5.6 Generic_105181-13
sun4u sparc SUNW,Ultra-4"  w/ M3 gives 6.43 s and 4.23 s respectively...
Not much gain from loosing the aritrary precision... 


In article <7rshul$3i3 at>,
Richard Bills <Richard_Bills at> wrote:
>Compiling also bypasses arbitrary precision math, which can be 25 times
>slower than machine precision math in Mathematica.  For example, compare the
>computation times of these (on an ancient computer):
>b1 = Table[i^10 + 7, {i, 100000}]; // Timing   (* arbitrary precision math
>{98.59 Second, Null}
>b2 = Table[N[i]^10. + 7.0, {i, 100000}]; // Timing  (* machine precision
>math  *)
>{3.19 Second, Null}
>The C code shown below (Borland Builder 3.0) performs the same computation
>in 0.7 seconds ( 7 seconds for 10^6  values), and is therefore about 5 times
>faster than machine precision code in Mathematica.  However, this C code
>does not give the correct result that Mathematica gives.
>#pragma hdrstop
>#include <condefs.h>
>#include <time.h>
>#include <stdio.h>
>#include <dos.h>
>#include <math.h>
>#pragma argsused
>int main(int argc, char **argv)
>    time_t  tstart,tend;
>    tstart=time(NULL);
>    double *data = new double[1000000];
>    for(int i=1; i<=1000000; i++)
>    {
>        data[i-1]=pow(i,10)+7;
>    }
>    tend=time(NULL);
>    printf("computation time:  %d\n", tend-tstart);
>    printf("end result:  %f\n",data[1000000-1]);
>    int tin;
>    scanf("%d", &tin);
>        return 0;
>If the computation is replaced with the expression ((i*2.3467) + 7.)/3., the
>C version is only 4 times faster than Mathematica, which is not bad, all
>things considered.
>I think it would be helpful if WRI published a book or technical notes on
>computational optimization in Mathematica.  They are in the best position to
>do so.
>Hope that helps.
>Richard E. Bills
>Tucson, AZ, USA
>-----Original Message-----
>From: Kevin J. McCann <kevin.mccann at>
To: mathgroup at
>Subject: [mg19852] [mg19764] Where's the Speed?
>>I have read and heard a lot of hype about Mathematica 4.0
>>"featuring a
>>     New Generation of
>>                    Fast Numerics"
>>e.g. on .
>>However, in the real world it is hard to find anything to get excited
>>I have had several disappointing results from 4.0, here are the latest:
>>On a P450/NT I ran a very simple Crank-Nicholson integration of a
>>one-dimensional quantum free-particle wave-packet with x-dimensioned to
>>points and time to 401 points -  no error checks or adaptive stepsize, just
>>plug-and-chug.  Runtime under 4.0 was 501 seconds, 3.0 was 480 seconds, but
>>who's quibbling; however, in FORTRAN this ran in 8 seconds.  I don't even
>>consider this to be "fast numerics", but 501 seconds sure isn't. I would
>>like to know where all this speed is so I can use some of it, or am I
>>missing something?
>>When I ran the FORTRAN code and then read it into Mathematica, it still was
>>than the Mathematica code alone, although the ReadList I used on the ASCII
>>file did take some time.  When I upped the dimensions to 2001 x 1001, the
>>FORTRAN ran in about 40 s - most of this is for the output; however, when I
>>tried to read it in to Mathematica, it took forever, and on the subsequent
>plot it
>>bombed the Kernel.  I then made the mistake of saving the NB which managed
>>to acquire an error so that I can't open it anymore - 6 Mb of useless NB!
>>Kevin J. McCann
>>Johns Hopkins University APL


  • Prev by Date: Re: does it run under Windows NT server edition?
  • Next by Date: Re: Re: Mathematica can't win against TigerWoods
  • Previous by thread: Re: Where's the Speed?
  • Next by thread: Re: Where's the Speed?