|
[Date Index]
[Thread Index]
[Author Index]
Re: Subscript Bug?
- To: mathgroup at smc.vnet.net
- Subject: [mg90124] Re: [mg90111] Subscript Bug?
- From: Carl Woll <carlw at wolfram.com>
- Date: Mon, 30 Jun 2008 04:51:25 -0400 (EDT)
- References: <200806290936.FAA29888@smc.vnet.net>
Aaron Fude wrote:
>Hi,
>
>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.
>
>
The first time you execute the cell, the assignment
H = Subscript[H, 1] + Subscript[H, 2];
sets H to 110 + 90, which is 200. Then, Tanh[Subscript[200,1]] is what
you get.
The second time you execute the cell, H is 200, so Subscript[200,1] is
set to 110 and Subscript[200,2] is set to 90. Then, H is set to 200
again. Now, Subscript[H,1] is Subscript[200,1] which equals 110, so you
get Tanh[110].
If you want to do these kinds of manipulations with Subscript, then I
recommend that you give Subscript the HoldFirst attribute.
Carl Woll
Wolfram Research
>A second execution, yields the correct answer:
>
>Tanh[110]
>
>Is this a feature that I don't understand or a bug?
>
>
Prev by Date:
Re: Bug in multiple integrals with delta function
Next by Date:
Re: How to stop execution within a cell?
Previous by thread:
Re: Subscript Bug?
Next by thread:
Re: Subscript Bug?
|