[SciPy-user] Matlab, Scipy and teaching science

Perry Greenfield perry at stsci.edu
Thu Oct 20 13:13:45 CDT 2005

On Oct 20, 2005, at 4:24 AM, Peter Bowyer wrote:

> Hi,
> I'm new to this list, so let me introduce myself.  I'm currently
> doing a Masters investigating ways to teach physics students how to
> program (and to investigate how much programming knowledge they need,
> given 2/3 of the class don't continue on in physics).
> In the past as with most physics departments the course was taught as
> an introduction to C or Basic.  This worked fine up to the late 90s
> when most students had experience of programming.  The structure here
> has been to have an introductory course in the 2nd year teaching
> people how to program, and then an optional course in the 3rd year
> introducing computational physics.
> There's a fundamental shift in principle in what I am considering,
> moving from the "How to implement numerical integration and
> differential equation" point, to "How to use libraries by others to
> carry out your calculations".  The course currently lasts all of 12
> hours and less than 5% of the students taking it have any knowledge
> of programming at the start.  I did not need to use the material
> taught during the course in the rest of my degree, something which I
> am hoping to improve by changing the angle the course is coming from.
> My idea was to teach the basics using Python and scientific
> modules.  However, the question I am consistently coming up against
> is "Why not teach the students Matlab?".  It's a very good point and
> one I can think up no clear answer for.  If the students stay in
> Physics or a related field they will be using Matlab (and
> C/C++/Fortran if needed).  Therefore is there any reason not to teach
> Matlab as the introduction to programming?
> My arguments at present are that Matlab is a proprietary tool so the
> cost to students in obtaining copies will be not inconsiderable
> (considering it will only be used for a short course), and that
> Matlab is a specialised tool, so those not interested in going on
> into a physics related field will not find it of any use (unlike 
> Python).
> The arguments for Matlab are stronger:
> 1) It's a standard tool, widely used
> 2) It is easier to install and maintain (discounting the Enthought
> edition for a moment, Python is CRAP compared with other langauges -
> where is the Package manager to make life easier?)
> 3) The editor has a good interface (v7 and above) which IDLE lacks
> (no data inspector 'right there')
> 4) Integrated help for all the scientific functions
> Are there any reasons you can think of that Python makes a better
> choice than Matlab?  I myself would far rather use Python (I have
> ideas about how VPython can help the students understand Python) but
> need a more robust reason than a handwaving argument about
> "3D...easier for students to visualise...".
> Many thanks, and apologies if this is badly off-topic for the list.
> Peter

The problem I have with this is that your goals seem murky. Is the 
choice centered around what is most effective to teach Physics students 
how to program (as your opening suggest). Or what they think will be 
most useful to them in their career? Or which you think will irritate 
them least with regard to installation or cost? Or something else? Who 
is deciding? You? Your advisor?

If your goal is teaching them programming and the most modern 
programming concepts, the answer is easy: pick Python. If you want to 
give them something they can use now with good current documentation 
and ease of installation: pick Matlab. If you are forward looking 
(i.e., that you want this to persist in some way beyond just helping 
you finish your masters), I'd recommend Python. Things are certainly 
more confusing, less well integrated, changing rapidly, etc on the 
Python side of things. But I think Python as a scientific and 
engineering environment is gaining rapidly on things like Matlab and 
IDL and one day in the not too distant future (I hope) will leave both 
of these in the dust. So if you want to be a pioneer, take the leap. 
You may find that if the students "stay in the field", they will be 
using Python and not Matlab.

But I'm a strong believer in not overselling the current situation. As 
a canned solution, Python (scipy) isn't yet at the level of either of 
these, and it would be a mistake to represent it as such.

Perry Greenfield

More information about the SciPy-user mailing list