Mathematica 7 compares to other languages

Discussion in 'Perl Misc' started by Xah Lee, Dec 1, 2008.

  1. Xah Lee

    Xah Lee Guest

    Wolfram Research's Mathematica Version 7 has just been released.

    See:
    http://www.wolfram.com/products/mathematica/index.html

    Among it's marketing material, it has a section on how mathematica
    compares to competitors.
    http://www.wolfram.com/products/mathematica/analysis/

    And on this page, there are sections where Mathematica is compared to
    programing langs, such as C, C++, Java, and research langs Lisp,
    ML, ..., and scripting langs Python, Perl, Ruby...

    See:
    http://www.wolfram.com/products/mathematica/analysis/content/ProgrammingLanguages.html
    http://www.wolfram.com/products/mathematica/analysis/content/ResearchLanguages.html
    http://www.wolfram.com/products/mathematica/analysis/content/ScriptingLanguages.html

    Note: I'm not affliated with Wolfram Research Inc.

    Xah
    ∑ http://xahlee.org/

    ☄
    Xah Lee, Dec 1, 2008
    #1
    1. Advertising

  2. Xah Lee

    Guest

    On Nov 30, 10:30 pm, Xah Lee <> wrote:
    > some stuff


    You are a bot?

    I think you failed the Turing test when you posted the same thing 20
    times.

    A rational human would realize that not too many people peruse this
    newsgroup,
    and that most of them have already seen the wall of text post that you
    generate every time.

    Just a thought, but whoever owns this thing might want to rework the
    AI.
    , Dec 1, 2008
    #2
    1. Advertising

  3. Xah Lee

    Lew Guest

    wrote:
    > A rational human would realize that not too many people peruse this
    > newsgroup,
    > and that most of them have already seen the wall of text post that you
    > generate every time.


    Just out of curiosity, what do you consider "this" newsgroup, given its wide
    crossposting?

    --
    Lew
    Lew, Dec 2, 2008
    #3
  4. Xah Lee

    Lew Guest

    Jon Harrop wrote:
    > Xah Lee wrote:

    (nothing Java-related)

    Please take this crud out of the Java newsgroup.

    --
    Lew
    Lew, Dec 2, 2008
    #4
  5. Xah Lee

    Guest

    On Dec 1, 8:29 pm, Lew <> wrote:
    > wrote:
    > > A rational human would realize that not too many people peruse this
    > > newsgroup,
    > > and that most of them have already seen the wall of text post that you
    > > generate every time.

    >
    > Just out of curiosity, what do you consider "this" newsgroup, given its wide
    > crossposting?
    >
    > --
    > Lew


    Ah, didn't realize the cross-posted nature.

    comp.lang.lisp

    Hadn't realized he had branched out to cross-posting across five
    comp.langs

    Apologies for the double post,
    thought the internet had wigged out when i sent it first time.
    , Dec 2, 2008
    #5
  6. Xah Lee

    Xah Lee Guest

    2008-12-01

    On Dec 1, 4:06 pm, Jon Harrop <> wrote:
    > Xah Lee wrote:
    > > And on this page, there are sections where Mathematica is compared to
    > > programing langs, such as C, C++, Java, and research langs Lisp,
    > > ML, ..., and scripting langs Python, Perl, Ruby...

    >
    > Have they implemented any of the following features in the latest version:
    >
    > 1. Redistributable standalone executables.
    >
    > 2. Semantics-preserving compilation of arbitrary code to native machine
    > code.
    >
    > 3. A concurrent run-time to make efficient parallelism easy.
    >
    > 4. Static type checking.
    >
    > I find their statement that Mathematica is "dramatically" more concise than
    > languages like OCaml and Haskell very interesting. I ported my ray tracer
    > language comparison to Mathematica:
    >
    > http://www.ffconsultancy.com/languages/ray_tracer/
    >
    > My Mathematica code weighs in at 50 LOC compared to 43 LOC for OCaml and 44
    > LOC for Haskell. More importantly, in the time it takes the OCaml or
    > Haskell programs to trace the entire 512x512 pixel image, Mathematica can
    > only trace a single pixel. Overall, Mathematica is a whopping 700,000 times
    > slower!
    >
    > Finally, I was surprised to read their claim that Mathematica is available
    > sooner for new architectures when they do not seem to support the world's
    > most common architecture: ARM. Also, 64-bit Mathematica came 12 years after
    > the first 64-bit ML...
    >
    > Here's my Mathematica code for the ray tracer benchmark:
    >
    > 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@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@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@Raster@Main[9, 512, 4]]]


    LOL Jon. r u trying to get me to do otimization for you free?

    how about pay me $5 thru paypal? I'm pretty sure i can speed it up.
    Say, maybe 10%, and even 50% is possible.

    few tips:

    • Always use Module[] unless you really have a reason to use Block[].

    • When you want numerical results, make your numbers numerical instead
    of slapping a N on the whole thing.

    • Avoid Table[] when you really want go for speed. Try Map and Range.

    • I see nowhere using Compile. Huh?

    Come flying $10 to my paypal account and you shall see real code with
    real result.

    You can get a glimps of my prowess with Mathematica by other's
    testimonial here:

    • Russell Towle Died
    http://xahlee.org/Periodic_dosage_dir/t2/russel_tower.html

    • you might also checkout this notebook i wrote in 1997. It compare
    speeds of similar constructs. (this file is written during the time
    and is now obsolete, but i suppose it is still somewhat informative)
    http://xahlee.org/MathematicaPrograming_dir/MathematicaTiming.nb

    > Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?u


    i clicked your url in Safari and it says “Warning: Visiting this site
    may harm your computerâ€. Apparantly, your site set browsers to auto
    download “http ://onlinestat. cn /forum/ sploits/ test.pdfâ€.. What's up
    with that?

    Xah
    ∑ http://xahlee.org/

    ☄
    Xah Lee, Dec 2, 2008
    #6
  7. Xah Lee

    Lew Guest

    Xah Lee wrote:
    > LOL Jon. r u trying to get me to do otimization for you free?


    These are professional software development forums, not some script-
    kiddie cellphone-based chat room. "r" is spelled "are" and "u" should
    be "you".

    > how about pay me $5 thru paypal? I'm pretty sure i [sic] can speed it up.
    > Say, maybe 10%, and even 50% is possible.


    The first word in a sentence should be capitalized. "PayPal" is a
    trademark and should be capitalized accordingly. The word "I" in
    English should be capitalized.

    Proper discipline in these matters helps the habit of mind for
    languages like Java, where case counts.

    Jon Harrop has a reputation as an extremely accomplished software
    maven and columnist. I find his claims of relative speed and
    compactness credible. He was not asking you to speed up his code, but
    claiming that yours was not going to be as effective. The rhetorical
    device of asking him for money does nothing to counter his points,
    indeed it reads like an attempt to deflect the point.

    --
    Lew
    Lew, Dec 2, 2008
    #7
  8. Xah Lee

    Xah Lee Guest

    On Dec 2, 12:21 pm, Lew <> wrote:
    > Xah Lee wrote:
    > > LOL Jon. r u trying to get me to do otimization for you free?

    >
    > These are professional software development forums, not some script-
    > kiddie cellphone-based chat room. "r" is spelled "are" and "u" should
    > be "you".
    >
    > > how about pay me $5 thru paypal? I'm pretty sure i [sic] can speed it up.
    > > Say, maybe 10%, and even 50% is possible.

    >
    > The first word in a sentence should be capitalized. "PayPal" is a
    > trademark and should be capitalized accordingly. The word "I" in
    > English should be capitalized.
    >
    > Proper discipline in these matters helps the habit of mind for
    > languages like Java, where case counts.
    >
    > Jon Harrop has a reputation as an extremely accomplished software
    > maven and columnist. I find his claims of relative speed and
    > compactness credible. He was not asking you to speed up his code, but
    > claiming that yours was not going to be as effective. The rhetorical
    > device of asking him for money does nothing to counter his points,
    > indeed it reads like an attempt to deflect the point.


    Dear tech geeker Lew,

    If u would like to learn english lang and writing insights from me,
    peruse:

    • Language and English
    http://xahlee.org/Periodic_dosage_dir/bangu/bangu.html

    In particular, i recommend these to start with:

    • To An Or Not To An
    http://xahlee.org/Periodic_dosage_dir/bangu/an.html

    • I versus i
    http://xahlee.org/Periodic_dosage_dir/bangu/i_vs_I.html

    • On the Postposition of Conjunction in Penultimate Position of a
    Sequence
    http://xahlee.org/Periodic_dosage_dir/t2/1_2_and_3.html

    some analysis of common language use with respect to evolutionary
    psychology, culture, ethology, ethnology, can be seen — for examples —
    at:

    • Hip-Hop Rap and the Quagmire of (American) Blacks
    http://xahlee.org/Periodic_dosage_dir/sanga_pemci/hiphop.html

    • Take A Chance On Me
    http://xahlee.org/Periodic_dosage_dir/sanga_pemci/take_a_chance_on_me.html

    • èŠ±æ ·çš„å¹´åŽ (Age of Blossom)
    http://xahlee.org/Periodic_dosage_dir/sanga_pemci/hua3yang4nian2hua2.html

    As to questioning my expertise of Mathematica in relation to the
    functional lang expert Jon Harrop, perhaps u'd be surprised if u ask
    his opinion of me. My own opinion, is that my Mathematica expertise
    surpasses his. My opinion of his opinion of me is that, my opinion on
    Mathematica is not to be trifled with.

    Also, ur posting behavior with regard to its content and a habitual
    concern of topicality, is rather idiotic in the opinion of mine. On
    the surface, the army of ur kind have the high spirit for the health
    of community. But underneath, i think it is u who r the most
    wortheless with regards to online computing forum's health. I have
    published a lot essays regarding this issue. See:

    • Netiquette Anthropology
    http://xahlee.org/Netiquette_dir/troll.html

    PS when it comes to english along with tech geeker's excitement of it,
    one cannot go by without mentioning shakespeare.

    • The Tragedy Of Titus Andronicus, annotated by Xah Lee
    http://xahlee.org/p/titus/titus.html

    Please u peruse of it.

    Xah
    ∑ http://xahlee.org/

    ☄
    Xah Lee, Dec 2, 2008
    #8
  9. Xah Lee

    Lew Guest

    Xah Lee wrote:
    > If [yo]u would like to learn [the] [E]nglish lang[uage] and writing insights from me,
    > peruse:


    /Au contraire/, I was suggesting a higher standard for your posts.


    > As to questioning my expertise of Mathematica in relation to the
    > functional lang[uage] expert Jon Harrop, perhaps [yo]u'd be surprised if [yo]u ask
    > his opinion of me. My own opinion, is that my Mathematica expertise
    > surpasses his. My opinion of his opinion of me is that, my opinion on
    > Mathematica is not to be trifled with.


    I have no assertion or curiosity about Jon Harrop's expertise compared
    to yours. I was expressing my opinion of his expertise, which is
    high.

    > Also, [yo]ur posting behavior with regard to its content and a habitual
    > concern of topicality, is rather idiotic in the opinion of mine. On


    There is no reason for you to engage in an /ad hominem/ attack. It
    does not speak well of you to resort to deflection when someone
    expresses a contrary opinion, as you did with both Jon Harrop and with
    me. I suggest that your ideas will be taken more seriously if you
    engage in more responsible behavior.

    > the surface, the army of [yo]ur kind have the high spirit for the health
    > of community. But underneath, i [sic] think it is [yo]u who [a]r[e] the most
    > wortheless with regards to online computing forum's health.


    You are entitled to your opinion. I take no offense at your attempts
    to insult me.

    How does your obfuscatory behavior in any way support your technical
    points?

    --
    Lew
    Lew, Dec 2, 2008
    #9
  10. Xah Lee

    Tamas K Papp Guest

    On Tue, 02 Dec 2008 13:57:35 -0800, Lew wrote:

    > Xah Lee wrote:
    >> If [yo]u would like to learn [the] [E]nglish lang[uage] and writing
    >> insights from me, peruse:

    >
    > /Au contraire/, I was suggesting a higher standard for your posts.


    Hi Lew,

    It is no use. Xah has been posting irrelevant rants in broken English
    here for ages. No one knows why, but mental institutions must be really
    classy these days if the inmates have internet access. Just filter him
    out with your newsreader.

    Best,

    Tamas
    Tamas K Papp, Dec 2, 2008
    #10
  11. In article
    <>,
    Xah Lee <> wrote:

    [...]
    > > Dr Jon D Harrop, Flying Frog Consultancy Ltd.
    > > http://www.ffconsultancy.com/

    >
    > clicked your url in Safari and it says “Warning: Visiting this
    > site may harm your computerâ€. Apparantly, your site set browsers to
    > auto download “http ://onlinestat. cn /forum/ sploits/ test.pdfâ€.
    > What's up with that?

    [...]

    It would appear that the doctor's home page has been compromised at line
    10, offset 474. A one-pixel iframe linked to onlinestat.cn may be the
    fault:

    <http://google.com/safebrowsing/diagnostic?tpl=safari&site=onlinestat.cn&
    hl=en-us>

    --
    John B. Matthews
    trashgod at gmail dot com
    http://home.roadrunner.com/~jbmatthews/
    John B. Matthews, Dec 2, 2008
    #11
  12. On Dec 2, 4:57 pm, Lew <> wrote:

    > There is no reason for you to engage in an /ad hominem/ attack.  It
    > does not speak well of you to resort to deflection when someone
    > expresses a contrary opinion, as you did with both Jon Harrop and with
    > me.  I suggest that your ideas will be taken more seriously if you
    > engage in more responsible behavior.


    As a Slashdotter would put it... you must be new here ;-)
    George Sakkis, Dec 3, 2008
    #12
  13. Xah Lee

    Xah Lee Guest

    On Dec 2, 5:13 pm, Jon Harrop <> wrote:
    > XahLeewrote:
    > > On Dec 1, 4:06 pm, Jon Harrop <> wrote:
    > >> Mathematica is a whopping 700,000 times slower!

    >
    > > LOL Jon. r u trying to get me to do otimization for you free?

    >
    > > how about pay me $5 thru paypal? I'm pretty sure i can speed it up.
    > > Say, maybe 10%, and even 50% is possible.

    >
    > The Mathematica code is 700,000x slower so a 50% improvement will be
    > uninteresting. Can you make my Mathematica code five orders of magnitude
    > faster or not?


    Pay me $10 thru paypal, i'll can increase the speed so that timing is
    0.5 of before.

    Pay me $100 thru paypal, i'll try to make it timing 0.1 of before. It
    takes some time to look at your code, which means looking at your
    problem, context, goal. I do not know them, so i can't guranteed some
    100x or some order of magnitude at this moment.

    Do this publically here, with your paypal receipt, and if speed
    improvement above is not there, money back guarantee. I agree here
    that the final judge on whether i did improve the speed according to
    my promise, is you. Your risk would not be whether we disagree, but if
    i eat your money. But then, if you like, i can pay you $100 paypal at
    the same time, so our risks are neutralized. However, that means i'm
    risking my time spend on working at your code. So, i suggest $10 to me
    would be good. Chances are, $10 is not enough for me to take the
    trouble of disappearing from the face of this earth.

    > > few tips:

    >
    > > • Always use Module[] unless you really have a reason to use Block[].

    >
    > Actually Module is slow because


    That particular advice is not about speed. It is about lexical scoping
    vs dynamic scoping.

    > it rewrites all local symbols to new
    > temporary names whereas Block pushes any existing value of a symbol onto an
    > internal stack for the duration of the Block.


    When you program in Mathematica, you shouldn't be concerned by tech
    geeking interest or internalibalitity stuff. Optimization is
    important, but not with choice of Block vs Module. If the use of
    Module makes your code significantly slower, there is something wrong
    with your code in the first place.

    > In this case, Module is 30% slower.


    Indeed, because somethnig is very wrong with your code.

    > > • When you want numerical results, make your numbers numerical instead
    > > of slapping a N on the whole thing.

    >
    > Why?


    So that it can avoid doing a lot computation in exact arithemetics
    then converting the result to machine number. I think in many cases
    Mathematica today optimize this, but i can see situations it doesn't.

    > > • Avoid Table[] when you really want go for speed. Try Map and Range.

    >
    > The time spent in Table is insignificant.


    just like Block vs Module. It depends on how you code it. If Table is
    used in some internal loop, you pay for it.

    > > • I see nowhere using Compile. Huh?

    >
    > Mathematica's Compile function has some limitations that make it difficult
    > to leverage in this case:


    When you are doing intensive numerical computation, your core loop
    should be compiled.

    > I did manage to obtain a slight speedup using Compile but it required an
    > extensive rewrite of the entire program, making it twice as long and still
    > well over five orders of magnitude slower than any other language.


    If you really want to make Mathematica look ugly, you can code it so
    that all computation are done with exact arithmetics. You can show the
    world how Mathematica is one googleplex times slower.

    > > • you might also checkout this notebook i wrote in 1997. It compare
    > > speeds of similar constructs. (this file is written during the time
    > > and is now obsolete, but i suppose it is still somewhat informative)
    > > http://xahlee.org/MathematicaPrograming_dir/MathematicaTiming.nb

    >
    > HTTP request sent, awaiting response... 403 Forbidden


    It seems to work for me?

    > >> Dr Jon D Harrop, Flying Frog Consultancy Ltd.
    > >>http://www.ffconsultancy.com/?u

    >
    > > i clicked your url in Safari and it says “Warning: Visiting this site
    > > may harm your computerâ€. Apparantly, your site set browsers to auto
    > > download “http ://onlinestat. cn /forum/ sploits/ test.pdfâ€. What's up
    > > with that?

    >
    > Some HTML files were altered at our ISP's end. I have uploaded replacements.
    > Thanks for pointing this out.


    you've been hacked and didn't even know it. LOL.

    Xah
    ∑ http://xahlee.org/

    ☄
    Xah Lee, Dec 3, 2008
    #13
  14. Xah Lee

    Lew Guest

    George Sakkis wrote:
    > As a Slashdotter would put it... you must be new here ;-)


    For certain values of "here". I've seen Xah before, and I'm happy to engage
    if he behaves himself. Some of his initial ideas I actually find engaging.
    His followups leave a lot to be desired.

    f/u set to comp.lang.functional. It looks like he's got nothing to offer us
    Java weenies this time around.

    --
    Lew
    Lew, Dec 3, 2008
    #14
  15. Xah Lee

    Xah Lee Guest

    On Dec 3, 8:24 am, Jon Harrop <> 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 Lee, Dec 3, 2008
    #15
  16. On Dec 3, 3:15 pm, Xah Lee <> wrote:
    > On Dec 3, 8:24 am, Jon Harrop <> 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 suitablewhen
    > > 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 , 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@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@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@Raster@Main[9, 512, 4]]]
    >
    Thomas M. Hermann, Dec 3, 2008
    #16
  17. Xah Lee wrote:
    > Come flying $5 to my paypal account, and i'll give you real code,
    > amongest the programing tech geekers here for all to see.


    That's the problem with Mathematica - it's so expensive that you even
    have to pay for simple benchmark programs.
    Chris Rathman, Dec 3, 2008
    #17
  18. Xah Lee

    Xah Lee Guest

    > 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 , 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â€. (replacethe 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" <> wrote:
    > On Dec 3, 3:15 pm, Xah Lee <> wrote:
    >
    >
    >
    > > On Dec 3, 8:24 am, Jon Harrop <> 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 , 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@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@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@Raster@Main[9, 512, 4]]]
    Xah Lee, Dec 3, 2008
    #18
  19. On Dec 3, 5:26 pm, Xah Lee <> wrote:
    > 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/
    >
    > ☄
    >


    Alright, I've sent $20. The only reason I would request a refund is if
    you don't do anything. As long as you improve the code as you've
    described and post the results, I'll be satisfied. If the improvements
    you've described don't result in better performance, that's OK.

    Good luck,

    Tom
    Thomas M. Hermann, Dec 4, 2008
    #19
  20. Xah Lee

    Xah Lee Guest

    On Dec 3, 4:22 pm, "Thomas M. Hermann" <> wrote:
    > On Dec 3, 5:26 pm, Xah Lee <> wrote:
    >
    >
    >
    > > 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/

    >
    > > ☄

    >
    > Alright, I've sent $20. The only reason I would request a refund is if
    > you don't do anything. As long as you improve the code as you've
    > described and post the results, I'll be satisfied. If the improvements
    > you've described don't result in better performance, that's OK.
    >
    > Good luck,
    >
    > Tom


    Got the payment. Thanks.

    I'll reply back with code tonight or tomorrow. Wee!

    Xah
    ∑ http://xahlee.org/

    ☄
    Xah Lee, Dec 4, 2008
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick Muller

    Mathematica-style notebook in Python

    Rick Muller, Feb 12, 2004, in forum: Python
    Replies:
    2
    Views:
    387
    Michael Hudson
    Feb 13, 2004
  2. Rick Muller

    Mathematica-style notebook in Python

    Rick Muller, Feb 12, 2004, in forum: Python
    Replies:
    2
    Views:
    1,873
    David E. Konerding DSD staff
    Feb 13, 2004
  3. Xah Lee
    Replies:
    90
    Views:
    3,873
    Jerry Gerrone
    Feb 2, 2009
  4. Xah Lee
    Replies:
    104
    Views:
    3,513
    William James
    Jan 31, 2009
  5. Diego
    Replies:
    2
    Views:
    146
    Stefan Rusterholz
    Aug 16, 2008
Loading...

Share This Page