Need help resolving accidental (honest!) language pissing match

has has.temp2 at virgin.net
Wed Jun 2 16:15:33 CEST 2004


<BLUSH> Careless talk costs lives, as they say. In my case, a
throwaway comment that Python could trounce the notoriously
underpowered and undersupported AppleScript language for "serious
number crunching". (And Perl could beat Python, and Fortran could kick
all their butts, etc...) Well, you'd think me and the other guy would
be old enough to know better, or at least have more important things
to do, but nooooo...


Ah well, too late now: honour is at stake, and honour must - I say,
MUST - be upheld!!! Unfortunately for me, my math is utterly shot and
I'm not really up on Python's module support in this field either
(poked briefly at numarray, but that's about it), so I'm far too
stupid and incompetent to do it all by myself. :p

Here's the problem and code:

"Suppose I want to study a random walk. Say I would like to appreciate
the distribution of the presence of the walker."

    set n to 1000000 -- we'll be talking about 4 MB
    set x to randomarray n range {-1, 1} -- n random draws
    set x to runningsum x -- the cumulative sums of the draws
    set {mean:the_mean, stdev:the_stdev} to statlist x -- compute
stats

All the real work here's being done by a C-based scripting addition
(plugin), taking about a second on a G4/867. If the worst comes to the
worst, I can force a dishonorable draw simply by calling the same
scripting addition via MacPython's Carbon support modules, but I'd
really like to punt the blighter out of the ballpark so existing
C-based Python extensions, Python-to-Fortran bridges, etc. are all
okay by me if anyone has a few minutes and spot of sympathy to point
us in the right direction. Cheers! :)



More information about the Python-list mailing list