Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: visual subscripts with assignment



Hi, 

this will work for assigments.

Unprotect[Set]
	Set[Subscript[x,i_],val_]:=x[[i]]=val Protect[Set]


Hope that helps
  Jens
  
  
> Hi Jen,
> 
> I tried your suggestion and got the same result.  Did it work
> for you?
> 
> Issac
> 
> -----Original Message-----
> From: jpk@max.mpae.gwdg.de <jpk@max.mpae.gwdg.de>
To: mathgroup@smc.vnet.net
> To: ijtrotts@ucdavis.edu <ijtrotts@ucdavis.edu>
> Cc: mathgroup@smc.vnet.net <mathgroup@smc.vnet.net>
> Date: Tuesday, February 17, 1998 1:35 AM
> Subject: [mg11069] Re: [mg11026] visual subscripts with assignment
> 
> 
> >Hi Isaac,
> >
> >the problem is that Subscript evaluate it's argument.
> >When x has a value assigned Subscript[x,_] will evaluate to the
> >value ({1,2,3,4,5} in Your example) 
> >
> >Here is the woking definition
> >
> >SetAttributes[Subscript,HoldFirst]
> >x/: Subscript[x,i_]:=x[[i]] /; Length[x]>i
> >
> >h
> >Hope that helps 
> >  Jens
> >
> >
> >> Can someone tell me why assignment doesn't seem to work with visual
> >> subscripting?  Here's what I got:
> >> 
> >> In[1]:=
> >> \!\(x_\_i_ := x[\([i]\)]\)
> >> In[2]:=
> >> x={1,2,3,4}
> >> Out[2]=
> >> {1,2,3,4}
> >> In[3]:=
> >> \!\(x\_2\)
> >> Out[3]=
> >> 2
> >> In[4]:=
> >> \!\(x\_2 = 5\)
> >> Out[4]=
> >> 5
> >> In[5]:=
> >> x
> >> Out[5]=
> >> {1,2,3,4}
> >> 
> >> Issac
> >> 
> >> 
> >> 
> >
> 



  • Prev by Date: Re: Tools/User set up
  • Next by Date: Re: ListPlots, sizing
  • Prev by thread: Re: visual subscripts with assignment
  • Next by thread: remote FrontEnd fonts problem leads to core dump