MathGroup Archive 2001

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

Search the Archive

RE: Oh Where, Oh Where Have My Values Gone?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg30906] RE: [mg30905] Oh Where, Oh Where Have My Values Gone?
  • From: "David Park" <djmp at earthlink.net>
  • Date: Mon, 24 Sep 2001 01:49:10 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Jeff,

f[c][d] = 3;
f[c][e] = 4;
f[d][c] = 5;

SubValues[f]

{HoldPattern[f[c][d]] :> 3, HoldPattern[f[c][e]] :> 4,
  HoldPattern[f[d][c]] :> 5}

WRI has not fully incorporated SubValues in Help. It is not listed in the
master index, but you can get it from ?*Values*.

?SubValues
"SubValues[f] gives a list of transformation rules corresponding to all \
subvalues (values for f[x,..][..], etc.) defined for the symbol f."

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

> From: JeffMG [mailto:jeffmg at aol.com]
To: mathgroup at smc.vnet.net
>
> My appologies if this has been discussed before, but a search in
> the MathGroup
> archives didn't turn up anything that seemed to match my
> question.  I'm trying
> to get access to the values defined for expressions having
> non-symbolic heads.
>
> For typical function definitions, one has something like
>
> In[1]:=		f[a]=1
>
> Out[1]=		1
>
> or
>
> In[2]:=		f[b]:=2
>
> I can see these values with the information escape.
>
> In[3]:=		?f
>
> 			Global`f
>
> 			f[a] = 1
>
> 			f[b] := 2
>
> And they appear as the downvalues for f.
>
> In[4]:=		DownValues[f]
>
> Out[4]=		{HoldPattern[f[a]]:>1,HoldPattern[f[b]]:>2}
>
> However, consider the following assignments to expressions with
> non-symbolic
> heads.
>
> In[5]:=		f[c][d]=3
> 			f[c][e]=4
> 			f[d][c]=5
>
> Out[5]=		3
>
> Out[6]=		4
>
> Out[7]=		5
>
> According to Section A.5.3 of the Mathematica book, these are among the
> DownValues for the symbol f.  I can still access them with the information
> escape.
>
> In[8]:=		?f
>
> 			Global`f
>
> 			f[c][d] = 3
>
> 			f[c][e] = 4
>
> 			f[d][c] = 5
>
> 			f[a] = 1
>
> 			f[b] := 2
>
> However, when I check the downvalues for f, here's what I get:
>
> In[9]:=		DownValues[f]
>
> Out[9]=		{HoldPattern[f[a]]:>1,HoldPattern[f[b]]:>2}
>
> What happened to the the other three assigments?  Aren't they
> also supposed to
> be among the downvalues for f?  Is there any way to access them?
> Any help on
> this would be greatly appreciated!
>
> Jeff Gilbert
>



  • Prev by Date: Re: ConstarinedMin Question
  • Next by Date: Handling several variables at once during matrix multiplications
  • Previous by thread: Oh Where, Oh Where Have My Values Gone?
  • Next by thread: Mathematica notebook saving bug ?