Re: Subscript[x, y] and the Symbol x
- To: mathgroup at smc.vnet.net
- Subject: [mg33793] Re: Subscript[x, y] and the Symbol x
- From: Mark Westwood <MarkCWestwood at compuserve.com>
- Date: Tue, 16 Apr 2002 03:50:59 -0400 (EDT)
- References: <a93b61$pi2$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Kurt, I'm a bit puzzled about what you are trying to achieve. Are you trying to define Subscript[x,y] as a new piece of notation - in which case the documentation on the Notations package is the best place to start. Are you trying to define a function like: f[a_,b_]:=Subscript[x,y]+a+b which returns the sum of its arguments and the term Subscript[x,y] ? If so, then the nub of the problem is parameter naming and scope and so on. Also Mathematica doesn't identify Subscript[x,y] with either x or y and you can make assignments like Subscript[x,y]=Pi, so the call f[2,2] would return 4+Pi. Hope this helps. Regards Mark Westwood Curt Fischer wrote: > > Dear Mathgroup: > > The Subscript function in Mathematica has no built-in meaning. What > definition can I give this function to allow me to use Subscript[x,y] as > a "stand-alone" symbol that is completely distinct from the Symbol x or > the Symbol y? For example: > > In[1]:= > \!\(f[x_, y_] := x\_y\ + \ x + y\) > > In[2]:= > f[2,2]//FullForm > > Out[2]//FullForm= > Plus[4,Subscript[2,2]] > > This is exactly what I don't want. Instead I want > Plus[4,Subscript[x,y]]. Is there a way to do this? > > Thanks for your help. > -- > Curt Fischer > Tokyo Institute of Technology > Dept. of Bioengineering