Re: Displaying Mathematica's Global rules
- To: mathgroup at smc.vnet.net
- Subject: [mg32070] Re: Displaying Mathematica's Global rules
- From: atelesforos at hotmail.com (Orestis Vantzos)
- Date: Sat, 22 Dec 2001 04:22:41 -0500 (EST)
- References: <9vs8m3$g1a$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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