MathGroup Archive 2003

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

Search the Archive

Re: Readability confuses mathematica?

  • To: mathgroup at
  • Subject: [mg44551] Re: Readability confuses mathematica?
  • From: Tom Burton <tburton at>
  • Date: Fri, 14 Nov 2003 01:58:42 -0500 (EST)
  • Sender: owner-wri-mathgroup at


Here is a simple workaround for the specific problem you mention below. Do
this before you assign any subscripted symbols that you need to keep:

SetAttributes[Subscript, HoldFirst]

Then in your example "x" will be unevaluated in the assignment of
Subscript[x,0], so the two can be assigned independently. I do this all the
time. Also with OverHat and decorations of all sorts.

Be aware that your values are assigned not to x but to the global symbol
Subscript. You can sometimes avoid this with, e.g.,

x/: Subscript[x,0] = blah

but you cannot do

x/: f[Subscript[x,0], Subcript[x,1]] = blah

because x is "too deep" the left-hand expression.  Rather than cope with
this inconsistency, I would rather deal with assignments to Subscript, which
are more tedious to clear. (Read about it in on-line help: "Further
examples" under Clear.)

Hint: This won't work right:


Because the symbol x disappears during preprocessing in favor of "3", you
get Subscript[3,0]=4, regardless of the HoldFirst attribute of Subscript.
Consider Block instead of With.

Hint: Module creates new names of local symbols at every execution of the
procedure.  A consequence is that, if you form subscripts from local
symbols, assignments to Global`Subscript pile up as you re-execute the
procedure. Consider Block rather than Module for procedures.

I too have had trouble with the Notations package when used within my
packages. Specifically, initialized cells involving Notations symbols could
spontaneously change and stop working. I could not abide this and so gave up
the Notation package sometime during Version 4. Perhaps it's better now. But
I get along OK with bandaids above, so...

Tom Burton

On 11/12/03 3:30 AM, in article botcm2$ci7$1 at, "patrick_m_lahey"
<patrick.m.lahey at> wrote:

> In[1]:= D[x-x0,x]
> except that x0 is really x ctrl-- 0 (x subscript 0).  Normally that
> would be a completely independent variable from x but not according to
> mathematica!

  • Prev by Date: Re: Cartesian[(x, y, z)] is not a valid coordinate system specification
  • Next by Date: Re: Cartesian[(x, y, z)] is not a valid coordinate system specification
  • Previous by thread: Re: Readability confuses mathematica?
  • Next by thread: Re: Readability confuses mathematica?