Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*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 2001

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

Search the Archive

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


  • 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