I encountered some strange behaviour running v10.0.1 on a Mac Pro, while working with Integrate and Subscript. Starting from a fresh kernel:

SetAttributes[Subscript, HoldFirst]

Then, the following integral:

Integrate[Sqrt[Subscript[z, 1]^2 + Subscript[z, 2]^2]/E^((Subscript[z, 1]^2 
+ Subscript[z, 2]^2)/2), {Subscript[z, 2], -Infinity, Infinity}]

... causes my Mac Mma kernel to Quit. It just disappears ... no output ... and the kernel goes dead.

Does this happen on other platforms as well?

P.S. Plainly, a workaround is not to use subscript - but the issue is not how to find a workaround, but to check if this is a general problem.

Murray asks:

Why do you want to set the HoldFirst attribute for Subscript?

The idea for this goes back many years to a suggestion made originally by Carl Woll (I believe). It's a nifty trick that allows one to work with symbols say $t$ and $t_1$, mostly without conflict, at the same time (well, that's the plan).

For example, if your Mma session is activated with:

 SetAttributes[Subscript, HoldFirst]

and someone enters:

t = 34;

... and you then evaluate $t_1$:


... Mma returns $t_1$ ... not the more wacky $34_1$. In essence, it offers most of the benefits of the old Symbolize package (which I never liked), while still retaining the flexibility to enter things like:

Table[ Subscript[t, i], {i, 5}]

It is part of my everyday Mma routine, and also a default setting in the mathStatica package.

  • $\begingroup$ Without etAttributes[Subscript, HoldFirst], evaluating that Integrate expression under Mathematica 10.0.1 on my iMac almost immediate gives an answer, as a ConditionalExpression, involving HypergeometricU function under the condition that the real part of $z_i^2 > 0$. Why do you want to set the HoldFirst attribute for Subscript? $\endgroup$
    – murray
    Dec 2, 2014 at 15:00
  • 4
    $\begingroup$ It's a small bug coupled with some very dangerous programming practice. As I'm sure I've mentioned to you in past. As for how general is the problem, it can show up anywhere Mathematica needs to make an internal "polynomial" from something involving a rational power and a base with the held subscript. Which is to say, it can arise in many, many ways. $\endgroup$ Dec 2, 2014 at 15:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.