Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15017
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: What is f[1]? Advanced question |
| Date | 2013-06-26 05:00 +0000 |
| Message-ID | <kqdshl$n34$1@smc.vnet.net> (permalink) |
| References | <20130626011408.DC7E86A2B@smc.vnet.net> |
| Organization | Time-Warner Telecom |
Do[x[i] = i/10., {i, 1, 3}]
x is a user-defined function whose domain is just the integers 1, 2, and
3. Like all functions, its Head is Symbol.
Head /@ {x, Exp, Mean}
{Symbol, Symbol, Symbol}
The function definitions are stored in the DownValues of the symbol
DownValues[x]
{HoldPattern[x[1]] :> 0.1, HoldPattern[x[2]] :> 0.2, HoldPattern[x[3]] :>
0.3}
Like any function, when given an argument outside of its defined domain, it
returns unevaluated.
x[4]
x[4]
Bob Hanlon
On Tue, Jun 25, 2013 at 9:14 PM, amannucci
<Anthony.J.Mannucci@jpl.nasa.gov>wrote:
> I have found a Mathematica program with the following construct:
> x[1]=0.1
> x[2]=0.2
> x[3]=0.3
>
> or
> Do[x[i]=i/10.,{i,1,3}]
>
> x is not a function. It is not a list. What is it? If I query x thus:
> ?x
>
> the answer is just what I have written above. Mathematica knows about
> x[1], x[2], etc. How does Mathematica know about the "elements" of x?
>
> In some other sense, I could have written:
> y1 = 0.1
> y2 = 0.2
> y3 = 0.3
>
> But
> ?y
>
> obviously gives a different result (just returns y).
>
> Thank you.
>
>
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Re: What is f[1]? Advanced question Bob Hanlon <hanlonr357@gmail.com> - 2013-06-26 05:00 +0000
Re: What is f[1]? Advanced question amannucci <Anthony.J.Mannucci@jpl.nasa.gov> - 2013-06-27 10:25 +0000
Re: What is f[1]? Advanced question David Bailey <dave@removedbailey.co.uk> - 2013-06-28 07:48 +0000
Re: What is f[1]? Advanced question John Doty <noqsiaerospace@gmail.com> - 2013-06-28 07:48 +0000
csiph-web