Basic Python Questions - Oct. 31, 2013

William Ray Wing wrw at mac.com
Fri Nov 1 11:42:25 EDT 2013


On Oct 31, 2013, at 5:31 AM, "E.D.G." <edgrsprj at ix.netcom.com> wrote:

> Posted by E.D.G. on October 31, 2013
> 
>      The following are several relatively basic questions regarding Python's capabilities.  I am not presently using it myself.  At the moment a number of people including myself are comparing it with other programs such as XBasic for possible use.
> 
> 1.  How fast can Python do math calculations compared with other languages such as Fortran and fast versions of Basic.  I would have to believe that it is much faster than Perl for doing math calculations.
> 

[byte]

> 4.  How well does Python work for interactive programming.  For example, if a Python program is running on a PC and is drawing a chart, can that chart be modified by simply pressing a key while the Python program is running.  I have Perl and Gnuplot program combinations that can do that.  Their interactive speed is not that great.  But it is adequate for my own uses.
> 

I thought about responding to this yesterday, decided others could do so better than I, but then decided to point out a bit of demo code that was one of the first really startling pieces of Python that I stumbled into.

If you look here:   http://wiki.wxpython.org/MatplotlibFourierDemo

You will find a fairly short, well documented demo code that interactively computes a Fast Fourier transform from the frequency domain to the time domain.  As you move the two sliders below the graphs, the input aptitude and location of the frequency peaks are changed and the resulting wavelet is plotted, all in real time.

Computing a Fourier transform is numerically pretty intensive, doing so in real time with no perceptible delay (at least on a reasonably modern system) should convince any skeptic of Python's ability to do BOTH number crunching AND interactive display.

Granted, this performance is based on pulling in libraries.  It imports numpy, mathplotlib, and wx to handle the fast array calculations, the plotting, and the GUI respectively, but those are exactly the sorts of "batteries included" libraries that give Python so much power and flexibility.

-Bill




More information about the Python-list mailing list