Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tag Times protected??

718 views
Skip to first unread message

Jordan Milev

unread,
Jul 23, 1998, 3:00:00 AM7/23/98
to
I am writing with an annoying behavior in Mathematica, which I hope has
a logical explanation. I have found that sometimes when I write two
consecutive lines which display output, I get the message "tag Times
protected"

Say I write:

pe[j] = pate[[1]]
ph[j] = path[[1]]
peh[j] = pateh[[1]]

where pate, path, and pateh are lists. So this is merely an assignment
exercise, but Mathematica somehow thinks that I've written instead:

pe[j] = pate[[1]]ph[j] = path[[1]]peh[j] = pateh[[1]]

i.e. I'm trying to multiply the three. Of course, this is an error, so
Mathematica gives a warning message. But, if I write the same
expression as:

pe[j] = pate[[1]];
ph[j] = path[[1]];
peh[j] = pateh[[1]];

the problem disappears, and Mathematica doesn't want to multiply the
three.

Does anyone know why this is happening, or more importantly, how to
prevent this behavior? I'd appreciate any help.

Jordan

David Withoff

unread,
Jul 24, 1998, 3:00:00 AM7/24/98
to

The only way to be certain that a collection of inputs will be separated
as you want is to include the necessary parentheses, semicolons, etc.,
to make the input unambiguous, or to put each input in a separate cell.
Otherwise, the computer must guess where one input ends and the next
input begins, and those guesses won't necessarily be what you want.

In most computer languages this type of input would be a syntax error.
In most computer languages, the extra line-continuation marks and other
notations that disambiguate the input are required. In Mathematica
that you don't have to do that, but you might want to do it anyway.

It is possible that the heuristics that are used in Mathematica for
guessing where one input ends and the next input begins will be changed
in future versions of Mathematica. This is a difficult task,
especially in typeset input with automatic line-breaking, where line
breaks can change depending on such things as the width of the notebook
window. If the only thing that distinguishes one input from another is
that the inputs are on separate lines, it is possible, for example, if
the heuristics aren't quite right, for the meaning of the input to
change when you change the width of the notebook window. That would be
bad.

In any case, the answer to your question is that this happens because
the computer isn't always able to guess where you want to separate the
inputs, and the solution is to add disambiguating syntax, or to put the
inputs in separate cells.

Dave Withoff
Wolfram Research


0 new messages