Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Subscript Bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90126] Re: Subscript Bug?
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Mon, 30 Jun 2008 04:51:47 -0400 (EDT)

On 6/29/08 at 5:36 AM, aaronfude at gmail.com (Aaron Fude) wrote:

>I have this code in a cell:

>Subscript[H, 1] = 110; Subscript[H, 2] = 90;
>H = Subscript[H, 1] + Subscript[H, 2];
>Tanh[Subscript[H, 1]]

>The first time I execute the cell, I get

>Tanh[Subscript[200, 1]]

>which of course is nonsense.

This is what should be expected given the way Mathematica does
pattern matching and doesn't really do subscripted variables. If
you want to use subscripted variables the thing to do is load
the Notation package and use Symbolize. Doing this will get you
the result you are expecting. See

Notation/tutorial/NotationSymbolizeAndInfixNotation

One other thing. It would be wise to get out of the habit of
using uppercase characters for your variable names. That ensures
there will be no name conflict with built-in objects since they
are guaranteed to start with an uppercase character.


  • Prev by Date: Re: One thing in two ways, with different result.
  • Next by Date: Re: Subscript Bug?
  • Previous by thread: Re: Subscript Bug?
  • Next by thread: Re: Subscript Bug?