Game Development Reference
In-Depth Information
For numbers with a magnitude of less than one, the number after the letter “e” is negative.
For values with a magnitude greater than one, the number after the letter “e” is positive. The
mass of Earth's moon, for instance, is a very large number and would be expressed in scientific
notation as 7.3483e+22 kg .
An alternative form of scientific notation is to use a “10” raised to the power of the number
of zeros in the value. For example, the mass of Earth's moon could be alternatively expressed
as 7.3483×10 22 kg . If the magnitude of the number is less than one, the exponent on the power
of ten would be negative as in 6.67×10 -11 .
You will use scientific notation when you incorporate physics into your game programs,
for example, when you define constants like the gravitational constant. Most computer languages
recognize scientific notation, so you can incorporate it into your game programs. For example,
the following snippet of code would be perfectly acceptable in the Java, C, or C# programming
languages:
double G = 6.67e-11;
Summation Notation
Scientific notation is a widely used nomenclature that we will use over and over in this topic.
Another bit of shorthand employed in mathematical equations is the summation notation .
There will be a lot of times when you will need to sum up a sequence of numbers. For example,
it might be necessary to find the total mass of a collection of five objects. The long and tedious
way to write a summation is to write each term in the sum.
total mmmmmm
=++++
(2.3)
1
2
3
4
5
An easier way to indicate a summation is by using summation notation.
5
=
m
m
(2.4)
total
j
j
=
1
Equations (2.3) and (2.4) are equivalent, but the summation notation is more compact. It's
easy to see that when a large number of terms are involved, you pretty much have to use summa-
tion notation when writing the summation. Here is a code snippet that implements the summation
shown in Equation (2.4) for the Java, C, or C# programming languages. It is assumed that the
mass[] array was declared and initialized somewhere else in the code.
massTotal = 0.0;
for(j=0; j<5; ++j) {
massTotal += mass[j];
}
Greek Letters
Mathematics can be thought of as the language of physics, and mathematicians love to use
Greek letters in their equations. The reasons are unclear, perhaps it is in honor of the ancient
Greek mathematicians, but that's just the way it is. We will follow the same convention in this
topic. Don't be confused when you see Greek letters in the math equations. Just remember that
Search WWH ::




Custom Search