Mathematica 7 compares to other languages

Xah Lee xahlee at gmail.com
Wed Dec 3 18:26:26 EST 2008


> I'll pay $20 to see your improved version of the code. The only
> references to PayPal I saw on your website were instructions to direct
> the payment to x... at xahlee.org, please let me know if that is correct.
>
> What I want in return is you to execute and time Dr. Harrop's original
> code, posting the results to this thread. Then, I would like you to
> post your code with the timing results to this thread as well.
>
> By Dr. Harrop's original code, I specifically mean the code he posted
> to this thread. I've pasted it below for clarity.

Agreed. My paypal address is “xah @@@ xahlee.org”. (replace the triple
@ to single one.) Once you paid thru paypal, you can post receit here
if you want to, or i'll surely acknowledge it here.

Here's what i will do:

I will give a version of Mathematica code that has the same behavior
as his. And i will give timing result. The code will run in
Mathematica version 4. (sorry, but that's what i have) As i
understand, Jon is running Mathematica 6. However, i don't see
anything that'd require Mathematica 6. If my code is not faster or in
other ways not satisfactory (by your judgement), or it turns out
Mathematica 6 is necessary, or any problem that might occure, i offer
money back guarantee.

  Xah
∑ http://xahlee.org/

☄

On Dec 3, 2:12 pm, "Thomas M. Hermann" <tmh.pub... at gmail.com> wrote:
> On Dec 3, 3:15 pm, Xah Lee <xah... at gmail.com> wrote:
>
>
>
> > On Dec 3, 8:24 am, Jon Harrop <j... at ffconsultancy.com> wrote:
>
> > > My example demonstrates several of Mathematica's fundamental limitations.
>
> > enough babble Jon.
>
> > Come flying $5 to my paypal account, and i'll give you real code,
> > amongest the programing tech geekers here for all to see.
>
> > I'll show, what kinda garbage you cooked up in your Mathematica code
> > for “comparison”.
>
> > You can actually just post your “comparisons” to “comp.soft-
> > sys.math.mathematica”, and you'll be ridiculed to death for any
> > reasonable judgement of claim on fairness.
>
> > > Consequently, there is great value in combining Mathematica with performant
> > > high-level languages like OCaml and F#. This is what the vast majority of
> > > Mathematica users do: they use it as a glorified graph plotter.
>
> > glorified your ass.
>
> > Yeah, NASA, Intel, NSA, ... all use Mathematica to glorify their
> > pictures. LOL.
>
> > > What exactly do you believe is wrong with my code?
>
> > come flies $5 to my paypal, and i'll explain further.
>
> > > I am not trying to make Mathematica look bad. It is simply not suitable when
> > > hierarchical solutions are preferable...
>
> > Certainly there are areas other langs are more suitable and better
> > than Mathematica (for example: assembly langs). But not in the ways
> > you painted it to peddle your F# and OCaml books.
>
> > You see Jon, you are this defensive, trollish guy, who takes every
> > opportunity to slight other langs that's not one of your F#, OCml that
> > you make a living of. In every opportunity, you injest your gribes
> > about static typing and other things, and thru ensuring chaos paves
> > the way for you to post urls to your website.
>
> > With your math and functional programing expertise and Doctor label,
> > it can be quite intimidating to many geekers. But when you bump into
> > me, i don't think you have a chance.
>
> > As a scientist, i think perhaps you should check your newsgroup
> > demeanor a bit? I mean, you already have a reputation of being biased.
> > Too much bias and peddling can be detrimental to your career, y'known?
>
> > to be sure, i still respect your expertise and in general think that a
> > significant percentage of tech geeker's posts in debate with you are
> > moronic, especially the Common Moron Lispers, and undoubtably the Java
> > and imperative lang slaving morons who can't grope the simplest
> > mathematical concepts. Throwing your Mathematica bad mouthing at me
> > would be a mistake.
>
> > Come, fly $5 to my paypal account. Let the challenge begin.
>
> >   Xah
> > ∑http://xahlee.org/
>
> > ☄
>
> Xah,
>
> I'll pay $20 to see your improved version of the code. The only
> references to PayPal I saw on your website were instructions to direct
> the payment to x... at xahlee.org, please let me know if that is correct.
>
> What I want in return is you to execute and time Dr. Harrop's original
> code, posting the results to this thread. Then, I would like you to
> post your code with the timing results to this thread as well.
>
> By Dr. Harrop's original code, I specifically mean the code he posted
> to this thread. I've pasted it below for clarity.
>
> Jon Harrop coded a ray tracer in Mathematica:
>
> > delta = Sqrt[$MachineEpsilon];
>
> > RaySphere[o_, d_, c_, r_] :=
> >   Block[{v, b, disc, t1, t2},
> >     v = c - o;
> >     b = v.d;
> >     disc = Sqrt[b^2 - v.v + r^2];
> >     t2 = b + disc;
> >     If[Im[disc] != 0 || t2 <= 0, \[Infinity],
> >       t1 = b - disc;
> >       If[t1 > 0, t1, t2]]
> >     ]
>
> > Intersect[o_, d_][{lambda_, n_}, Sphere[c_, r_]] :=
> >  Block[{lambda2 = RaySphere[o, d, c, r]},
> >   If[lambda2 >= lambda, {lambda, n}, {lambda2,
> >     Normalize[o + lambda2 d - c]}]
> >   ]
> > Intersect[o_, d_][{lambda_, n_}, Bound[c_, r_, s_]] :=
> >  Block[{lambda2 = RaySphere[o, d, c, r]},
> >   If[lambda2 >= lambda, {lambda, n},
> >    Fold[Intersect[o, d], {lambda, n}, s]]
> >   ]
>
> > neglight = N at Normalize[{1, 3, -2}];
>
> > nohit = {\[Infinity], {0, 0, 0}};
>
> > RayTrace[o_, d_, scene_] :=
> >  Block[{lambda, n, g, p},
> >   {lambda, n} = Intersect[o, d][nohit, scene];
> >   If[lambda == \[Infinity], 0,
> >    g = n.neglight;
> >    If[g <= 0, 0,
> >     {lambda, n} =
> >      Intersect[o + lambda d + delta n, neglight][nohit, scene];
> >     If[lambda < \[Infinity], 0, g]]]
> >   ]
>
> > Create[level_, c_, r_] :=
> >  Block[{obj = Sphere[c, r]},
> >   If[level == 1, obj,
> >    Block[{a = 3*r/Sqrt[12], Aux},
> >     Aux[x1_, z1_] := Create[level - 1, c + {x1, a, z1}, 0.5 r];
> >     Bound[c,
> >      3 r, {obj, Aux[-a, -a], Aux[a, -a], Aux[-a, a], Aux[a, a]}]]]]
>
> > scene = Create[1, {0, -1, 4}, 1];
>
> > Main[level_, n_, ss_] :=
> >  Block[{scene = Create[level, {0, -1, 4}, 1]},
> >   Table[
> >    Sum[
> >      RayTrace[{0, 0, 0},
> >       N at Normalize[{(x + s/ss/ss)/n - 1/2, (y + Mod[s, ss]/ss)/n - 1/2,
> >           1}], scene], {s, 0, ss^2 - 1}]/ss^2, {y, 0, n - 1},
> >    {x, 0, n - 1}]]
>
> > AbsoluteTiming[Export["image.pgm", Graphics at Raster@Main[9, 512, 4]]]




More information about the Python-list mailing list