Question about scientific calculations in Python
William Park
opengeometry at NOSPAM.yahoo.ca
Tue Mar 12 11:58:24 EST 2002
Martin Kaufmann <martinkaufmann at yahoo.com> wrote:
> Hello Newsgroup
>
> I'm trying to write a program to calculate diffraction patterns for
> electron diffraction on clusters (100-10'000 atoms). So far I used
> Python only for CGI programming and system tools (on a rather low
> level...). Therefore I don't know whether it's reasonable to program
> such a project in Python (I really like the language). Presently my
> man concern is speed as the main function of the program is a nested
> loop, the inner over several 1000 bins of a histogram and the outer
> over several 1000 values of scattering factors. In the end I should be
> able to simulate diffraction patterns and compare them to the
> experimental data (i.e. run this function several times).
>
> Now my questions: Would it be best to
>
> (a) write the whole program in C/C++ (I know only the basics of C but
> it would be a good "excuse" to learn it...)?
> (b) write the main program in Python but the heavy calculations in C
> (I played today with scipy.weave -- the speed is much better but I
> didn't really understand what I was doing...)?
> (c) program it in Python and don't care about speed (or buy a new
> workstation...)?
First, get the math right. Then, get the algorithm right; here, Python
helps. If you have to solve your own integral, then all bets are off.
:-) If you can use FFT approximation or higher math functions (ie.
Fresnel) approximation, then Python is good choice. But, this depends
on the math being right, so we're back in circle.
--
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
8 CPU cluster, NAS, (Slackware) Linux, Python, LaTeX, Vim, Mutt, Tin
More information about the Python-list
mailing list