MathGroup Archive 2001

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

Search the Archive

RE: Preserve subscripts like integers using N


> -----Original Message-----
> From: guillerm at usal.es [mailto:guillerm at usal.es]
To: mathgroup at smc.vnet.net
> Sent: Thursday, December 13, 2001 7:09 AM
> To: mathgroup at smc.vnet.net
> Subject: [mg31949] [mg31932] Preserve subscripts like integers using N
> 
> 
> I would like to preserve in the Outs the subscripts like 
> integers using N in 
> expression like this. How can I do? 
> 
> In[1]:=Thread[Table[Subscript[x, i], {i, 1, 3}]->{Pi,2 Pi, 3 Pi}]//N
> 
> Out[1]:={Subscript[x, 1.] -> 3.141592653589793, Subscript[x, 2.] -> 
>    6.283185307179586, Subscript[x, 3.] ->
> 9.42477796076938}
> 
> ---------------------------------------------
> This message was sent using Endymion MailMan.
> http://www.endymion.com/products/mailman/
> 
> 
> 
You can prevent intrusion of N into the subscripts by 
giving the appropriate attribute to Subscript:

In[3]:= Attributes[Subscript] = NHoldRest

In[4]:=
Thread[Table[Subscript[x, i], {i, 1, 3}] -> {Pi, 2 Pi, 3 Pi}] // N
Out[4]=
\!\({x\_1 -> 3.141592653589793`, x\_2 -> 6.283185307179586`, 
    x\_3 -> 9.42477796076938`}\)

The subscripted integers are preserved now.

Hartmut Wolf



  • Prev by Date: Re: Working with strings
  • Next by Date: RE: Working with strings
  • Previous by thread: Re: Preserve subscripts like integers using N
  • Next by thread: Re: Preserve subscripts like integers using N