Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

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

Search the Archive

Re: What is f[1]? Advanced question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131306] Re: What is f[1]? Advanced question
  • From: "Mannucci, Anthony J (335G)" <anthony.j.mannucci at jpl.nasa.gov>
  • Date: Wed, 26 Jun 2013 01:03:30 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

I believe I figured this out. x[] is a function that has definitions only at certain values. A function can be defined thus:
x[x_] := 
which matches the rhs to a pattern (x_), or a function can be defined thus:
x[1] = 0.1
which means: if the function argument expression evaluates to 1, then substitute 0.1. However, if the function argument evaluated to something other than 1, there is no substitution made, so that x[2] just evaluates to x[2].

I don't think there is an Array data type in Mathematica.

Thank you!

-Tony


From: Tomas Garza <tgarza10 at msn.com<mailto:tgarza10 at msn.com>>
Date: Tuesday, June 25, 2013 6:27 PM
To: Tony Mannucci <Anthony.J.Mannucci at jpl.nasa.gov<mailto:Anthony.J.Mannucci at jpl.nasa.gov>>, "mathgroup at smc.vnet.net<mailto:mathgroup at smc.vnet.net>" <mathgroup at smc.vnet.net<mailto:mathgroup at smc.vnet.net>>
Subject: [mg131306] Re: What is f[1]? Advanced question

It is possibly a previously declared "Array" with the name "x", and the three lines are assigning values to the elements of the array. Check for Array in the Help.

-Tomas


> From: Anthony.J.Mannucci at jpl.nasa.gov<mailto:Anthony.J.Mannucci at jpl.nasa.gov>
> Subject: What is f[1]? Advanced question
> To: mathgroup at smc.vnet.net<mailto:mathgroup at smc.vnet.net>
> Date: Tue, 25 Jun 2013 21:14:08 -0400
>
> 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.
>




  • Prev by Date: Re: Making (a*\[Theta]11)/(1+a^2) into (a/(1+a^2))*\[Theta]11
  • Next by Date: Re: What is f[1]? Advanced question
  • Previous by thread: Re: What is f[1]? Advanced question
  • Next by thread: Re: What is f[1]? Advanced question