Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Mathematica 20x slower than Java at arithmetic/special functions, is
Replies: 6   Last Post: Jan 25, 2011 4:20 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Michael B. Heaney

Posts: 15
Registered: 1/10/11
Re: Mathematica 20x slower than Java at arithmetic/special functions, is
Posted: Jan 24, 2011 5:22 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On a related topic, I have noticed that mathematica 7 evaluates integrals 3x
slower than mathematica 5.

On Sun, Jan 23, 2011 at 2:33 PM, Leo Alekseyev <dnquark@gmail.com> wrote:

> I was playing around with JLink the other day, and noticed that Java
> seems to outperform Mathematica by ~20x in an area where I'd expect
> Mathematica to be rather well optimized -- arithmetic involving special
> functions. In my particular example, I am simply evaluating a sum of
> Bessel functions. I understand that much depends on the underlying
> implementation, but I just want to run this by Mathgroup to see if
> this is to be expected, or maybe if I'm doing something suboptimal in
> Mathematica. Here's the code that I'm running:
>
> grid1dc[x_,
> y_] = (With[{d = 0.1, NN = 50},
> Sum[Re[N[
> d BesselJ[1, 2 Pi d Sqrt[m^2 + n^2]]/
> Sqrt[m^2 + n^2 + 10^-7]] Exp[
> I 2.0 Pi (m x + n y)]], {m, -NN, NN, 1}, {n, -NN, NN, 1}]]) //
> N
>
> and
>
> gridres1da =
> With[{delta = 0.5, xlim = 2.5, ylim = 2.5},
> Table[{x, y, grid1dc[x, y]}, {x, -xlim, xlim, delta}, {y, -ylim,
> ylim, delta}]]
>
>
> Java implementation uses Colt and Apache common math libraries for the
> Bessels and complex numbers, uses a double for loop, and consistently
> runs 15-20 times faster.
>
> --Leo
>
>



--
------------------------------------------------------------
Michael B. Heaney
3182 Stelling Drive
Palo Alto, CA 94303 USA
mheaney@alum.mit.edu
www.linkedin.com/in/michaelbheaney
------------------------------------------------------------





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.