Determining
Particular Values of a Variable
Recall our candy example from section
3.2. In this example, we talked about picking a candy out of a bag. Without
looking at the candy, we could give it a variable name "The Candy in My
Hand", and make some statements about it.
But what happens when
we open our hand? Now we find out which object is actually associated with the
variable "The Candy in my Hand" on this particular occasion. Now we
know that, in this particular case, "The Candy in my Hand" is a green
jelly bean. We can then pick another candy from the bag, which becomes the next
"The Candy in my Hand". This time it turns out that "The Candy
in my Hand" is a red gummy bear.
Similarly, the same
mathematical variable name can label one mathematical object at one time, and
another mathematical object at another. This is where the idea of equality
comes in to play once again. When we want to indicate that a variable at this
moment in time has a certain mathematical object- for instance, a certain
number- associated with it, we say that the variable equals that number. For
example, at a certain point in time we might say "the variable x equals
five". This is written symbolically as "x = 5".
This
lets us describe the connection between a general mathematical equation and a
particular situation that is an example of that equation.
We can take
the general equation:
day1 + day2 + day3 + day4 + day5 + day6 + day7 =
total_precipitation
and say, when talking about the first week of
April
day1 = 0.2
day2 = 1.0
day3= 0
day4= 0
day5= 0.4
day6=
0
day7= 0.3
total_precipitation= 1.9 ml
However, when we
are talking about the first week of November we can say
day1 = 0.5
day2
= 0.1
day3= 0.1
day4= 0.2
day5= 0
day6= 0
day7= 0.3
total_precipitation=
1.1 ml
In this case, the variable names stay the same, but at
different times they label different numbers. When dealing with variables it's
important to know that the same variable name can be equal to different numbers
at different times, and keep track of what the variable equals at the
particular time you are using it.
It can also be useful to ask
yourself what sorts of mathematical objects the variable could never equal. In
this case the total_precipitation variable for the first week of November would
probably never equal 120, because there have never been 120 ml of precipitation
in Eureka in the first week of November.