MathGroup Archive 2001

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

Search the Archive

Re: Displaying Mathematica's Global rules


Repeat after me: FullForm is my best friend, FullForm is my best
friend,...
FullForm[d_subscript_a_,b_]
--> Subscript[d,a_,b_]
Hence:
Subscript[d,a_,b_]:=If[a==b,1,0] (which is a way to define the
Kronecker delta for 2 indices) is a rule about function Subscript with
first argument d!
Mathematica automaticaly stores the rule in the Downvalues of
Subscript and ?Subscript will show it.
Now, how do I store it with d?
Well, you have to persuade Mathematica to store it in the Upvalues of
d. This will suffice:
d     ^:=If[a==b,1,0]  or even d/:d     :=If[a==b,1,0]
 a_,b_                            a_,b_
will do.
Global` is a Context of Symbols and has nothing to do with the
situation.
Now go read about Contexts(and Downvalues and Upvalues) in the Mathematica Book :-)
Orestis


  • Prev by Date: Re: Replacement Rule
  • Next by Date: RE: Replacement Rule
  • Previous by thread: Re: Displaying Mathematica's Global rules
  • Next by thread: Re: Displaying Mathematica's Global rules