MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Show left hand side

  • To: mathgroup at
  • Subject: [mg111160] Re: Show left hand side
  • From: "David Park" <djmpark at>
  • Date: Thu, 22 Jul 2010 05:43:13 -0400 (EDT)

1) I agree that % and %% are generally a bad idea - except when used within
a single cell, where they are perfectly all right and convenient. Your
teaching of naming expressions is a good idea, but not always necessary. (I
would use names like step1, step2, etc., to avoid assigning values to common

2) Might it be that copying and pasting parts of expressions is an
error-prone procedure that should be discouraged in favor of using Part or
Cases or Select.

3) Sooner or later I would think that students would have to use packages.
Why not teach them to have an Initialization section at the top of their
notebook with Initialization cells for packages and anything else they might
need? You already teach them to use Sectional organization, which is another
very good thing in your teaching practices. (If I forget to load a package I
always just Quit the kernel and start over. Of course, if I had just
performed a three hour calculation I might think differently.)

David Park
djmpark at  

From: Helen Read [mailto:hpr at] 

On 7/19/2010 2:07 AM, David Park wrote:
> I use multiple statements in one cell, with multiple outputs, quite often
> and don't see any problem with it. It's a good way to develop a
> before moving it to a Module, or to develop a derivation or to just try
> things.
> When everything is in one cell you can safely use % and %% without
> about order of evaluation. You can intersperse Print statements if you
> to annotate the output. You can keep adding further steps and reevaluating
> as a calculation is built up. You can add or remove ";"s as you want to
> more or less.

Each to his/her own. I personally find student work (and my own work) to 
be much easier to follow with one input per cell, or multiple inputs in 
a cell separated with semi-colons. As you point out, you can always 
intersperse Print statements if you like.

As for % and %%, I never use them, and I certainly don't teach them. 
Using % in a single cell vs. multiple cells is a distinction that my 
students are likely not to make, with dire consequences. When I first 
started teaching with Mathematica ~15 years ago (!), the use of % was 
one of the two biggest sources of problems for my students. A couple of 
years in, life got much better when I made a conscious decision not to 
introduce the % notation to my students, and to discourage its use by 
the few students who discover it (or even worse, the dreaded Out[17] 
notation, which is a living nightmare) on their own.

When I stopped teaching %, I realized I didn't need it either, and I 
stopped using it myself. Nobody misses %, least of all me. I teach my 
students to define functions for practically everything, and to assign 
names for anything that is not a function if they think they are going 
to use it again, or go back and assign a name when needed if they didn't 
name it to begin with. If they do that, there is no need for %, 
preventing all the problems they used to have with it, and making it 
much easier for them (and me, when I have to grade it) to follow their work.

(The other one of the two biggest stumbling blocks in the old days was 
students failing to load packages, then remembering after the fact  -- 
when something didn't work -- leading to the Shadowing error, which just 
baffled them. I could explain it 100 times, and most of the students 
never understood why it was too late once they already tried to use a 
function from a package, and never remembered to do it in sequence the 
next time. So we started loading commonly used packages right in the 
init.m in the classrooms we maintain...which was great, except that the 
students would get confused when working somewhere else and completely 
forget to load packages. Things got much, much better when most all of 
the functionality that we needed from packages was moved to the main 
Mathematica. I can't remember the last time I had my students load a 
package. Life is good.)

Those two simple things (1) don't teach %, and (2) no more need to load 
packages were huge quality-of-life improvements for my classes.

> I never have any problem with Return being misinterpreted as a
> multiplication.

I have seen it happen with student work. Sometimes they do a lot of 
copy/paste, and something that looks like a line-break might not be one. 
It can be very difficult to trouble-shoot. There is a lot less of this 
sort of problem if I teach them to put one input per cell, or separate 
with semi-colons if they put multiple inputs within a cell.

> There is a subset of Mathematica users who see writing extended
> and routines as a barrier. The multiple statement, single cell form is a
> good way to transition them to it, because it almost is a routine.

I encourage this all the time with my students, for just that reason, 
but have them separate with semi-colons. They don't have any problem 
doing that.

Helen Read
University of Vermont

  • Prev by Date: Graphics3D stereo
  • Next by Date: Re: Kolmogorov-Smirnov 2-sample test
  • Previous by thread: Re: Show left hand side
  • Next by thread: Re: Show left hand side