# Connexions

You are here: Home » Content » GAME 2302-0350 Units and Dimensional Analysis

### Recently Viewed

This feature requires Javascript to be enabled.

# GAME 2302-0350 Units and Dimensional Analysis

Module by: R.G. (Dick) Baldwin. E-mail the author

Summary: The purpose of this module is to explain units and dimensional analysis.

## Preface

### General

This module is part of a series of modules designed for teaching the physics component of GAME2302 Mathematical Applications for Game Development at Austin Community College in Austin, TX. (See GAME 2302-0100: Introduction for the first module in the course along with a description of the course, course resources, homework assignments, etc.)

The purpose of this module is to explain units and dimensional analysis.

### Viewing tip

I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the Images and Listings while you are reading about them.

## General background information

As a young engineering student many years ago, I was told that when evaluating mathematical expressions, I should always embed the units in the expression, manipulate them algebraically, and confirm that the units that survive until the end of the evaluation are correct relative to the problem specifications.

Three good reasons

There are at least three good reasons for following this procedure:

• It shows what the units of the result are. A common mistake is to get the correct numerical result of a calculation but to write it with the wrong units.
• It shows where unit conversions must be performed. If units that should have canceled do not cancel, we need to go back and perform the necessary conversions. For example, when a speed in miles per hour is being calculated and the result comes out with units of miles per second, we should convert seconds to hours.
• It helps to locate mistakes. If a velocity (meters per second) is being calculated and the units come out as seconds per meter, we know to look for an error.

### Formatting mathematical expressions

Multiple-line format

We might typically write a fraction as a horizontal line with the numerator above the line and the denominator below the line using superscripts to indicate exponents. The product of two fractions would typically be written in the same format with a multiplication indicator joining the two fractions.

Single-line format

Image 1 shows multiplication and division of fractions in a single-line format similar to how we write expressions in computer programs.

1
Image 1: Single-line format.
((3*x^2)/(4*x) * (6/(4*x) = (18*x^2)/(16*x^2) = 18/16

Expressions in this format may be more difficult for people to work with than the multiple line format described above. With enough time and practice, I might become almost as proficient in evaluating expressions as shown in Image 1 as in evaluating expressions in a multiple-line format, but I'm afraid that I would need a lot of time and a lot of practice to achieve that proficiency.

We must work with what we are given

However, we must work with what we are given so the mathematical expressions in this module (and most of the other modules as well) will mostly be presented in a single-line format. The good news is that the single-line format can usually be easily translated into a format that is suitable for evaluation using JavaScript and other programming languages.

### What do we mean by units?

Let me try to answer this important question with an example.

If you were to walk from your home to your school and count your steps, you might report that the distance from your home to your school is 2112 steps or paces. If you are a male student, this would probably be approximately one mile, using assumptions that I will explain later. If you are a female, it would probably be somewhat less than a mile because your pace would probably be a little shorter than your male friend's pace.

A pace is a unit of measurement

In this case, the pace would be a unit of measurement. However, it would not be a standard unit because the length of a pace for one student is often different from the length of a pace for a different student. A male student, for example, typically has a longer pace length than a female student.

Standard units

Standard units are units whose value has been set by some official agency that has the authority to set standards. One such standard unit is the mile, which as you may know is equal to 5280 foots (more commonly pronounced feet).

A foot (not a feet) is also a standard unit, which you may also know is equal to 12 inches. An inch is another standard unit.

### SI units

The discrepancy between the pronunciation of the unit foot and its plural feet is an example of the need for more consistency in the use of units. Many physics books use a system of units called SI units . SI is an abbreviation for a French name, which I am unable to pronounce.

I won't attempt to explain much about SI units. You can probably Google SI units and find hundreds of web pages that explain the system in varying levels of detail.

Tables of SI units

Most of those references will probably also provide tables for the units. I will also attempt to provide tables in Image 2 and Image 3 .

Don't ignore the details

Note, however, that you should not ignore the online SI-unit tables altogether. They are likely to contain important information that I won't reproduce here, such as the fact that the meter is a unit of length and its value is the length of the path travelled by light in a vacuum during a time interval of 1/299792458 of a second .

Base units and derived units

When reading about SI units, you will find that they are often divided into base units and derived units. I will put the base units in Image 2 and some sample derived units in Image 3 .

2
Image 2: SI base units.
Base Quantity               Name        Symbol

length                      meter       m
mass                        kilogram    kg
time                        second      s
electric current            ampere      A
thermodynamic temperature   kelvin      K
amount of substance         mole        mol
luminous intensity          candela     cd

Note that the list of derived units in Image 3 is only a sampling of different units that can be derived from the base units.

The exponentiation indicator

As is the case throughout these modules, the character "^" that you see used extensively in Image 3 indicates that the character following the ^ is an exponent. Note also that when the exponent is negative, it is enclosed along with its minus sign in parentheses for clarity.

3
Image 3: Examples of SI derived units.
area             square meter              m^2
volume           cubic meter               m^3
speed, velocity  meter per second          m/s
acceleration     meter per second squared  m/s^2
wave number      reciprocal meter          m^(-1)
mass density     kilogram per cubic meter  kg/m^3
specific volume  cubic meter per kilogram  m^3/kg
current density  ampere per square meter   A/m^2

### Prefixes for powers of ten

As an alternative to explicitly writing powers of ten, SI uses prefixes for units to indicate power of ten factors. Image 4 shows some of the powers of ten and the SI prefixes used for them.

4
Image 4: A sampling of SI prefixes.
Prefix-(abbreviation)   Power of Ten

peta-(P)                10^15
tera-(T)                10^12
giga-(G)                10^9
mega-(M)                10^6
kilo-(k)                10^3
deci-(d)                10^(-1)
centi-(c)               10^(-2)
milli-(m)               10^(-3)
micro-(Greek letter mu) 10^(-6)
nano-(n)                10^(-9)
pico-(p)                10^(-12)
femto-(f)               10^(-15)

### Dimensional analysis

As typically used in physics, the word dimensions means basic types of units such as time, length, and mass (see Image 2 ). (This is a different meaning than the common meaning of the word dimensions in computer programming -- such as an array with three dimensions.)

There are many different units that are used to express length, for example, such as foot, mile, meter, inch, etc.

Because they all have dimensions of length, you can convert from one to another. For example one mile is equal to 5280 feet.

Cannot convert between units of different dimensions

When evaluating mathematical expressions, we can add, subtract, or equate quantities only if they have the same dimensions (although they may not necessarily be given in the same units). For example, it is possible to add 3 meters to 2 inches (after converting units), but it is not possible to add 3 meters to 2 kilograms.

To analyze dimensions, you should treat them as algebraic quantities using the same procedures that we will use in the upcoming exercise on manually converting units.

## Discussion and sample code

Let's work through an exercise manually to determine the distance from your home to your school in miles given that we know the distance in paces. (I will convert this to a JavaScript script later in the module.)

As we discussed earlier, you have already determined that the distance from your home to your school is 2112 paces. We have also recognized that the length of one of your paces is likely to be different from the length of someone else's paces.

### Manual exercise on converting units

This is a somewhat long and tedious explanation, but unless you already have quite a lot of experience in this area, you should probably bear with me as I walk you through it.

Convert your pace length to standard units

First we must convert the length of your pace to standard units, which we can then convert to miles.

A calibration exercise

Assume that you go into an empty parking lot, mark your starting position, walk 100 paces, and then mark your ending position on the pavement. Assume that you then use a measuring tape to measure the distance from the starting position to the ending position and you find that distance to be 3000 inches.

From that, we could conclude that for your pace length,

100 paces = 3000 inches

Thus, we have calibrated your pace length in terms of the standard unit inch.

The plural versus the singular

Note that the use of the plural such as inches and the singular such as inch has no impact on the results of our computations. we can switch back and forth from the plural to the singular at will as long as it makes sense to do so.

A conversion factor

If we divide both sides of the above equation by 100 paces, we get

1 = 3000 inches/100 paces = 30 inches/pace

Note that we now have a 1 on the left side and a fraction on the right side.

Multiplication by 1

Multiplying a value by 1 doesn't change the value. This means that if we multiply a term in an algebraic expression by

30*inch/pace

we won't change the intrinsic value of the term, although we might change the units in which that value is expressed.

The term

30*inch/pace

can be used to convert a quantity in units of paces to the same quantity in units of inches.

So now we know that on the average, each time you execute one pace, you have moved your body forward by 30 inches. The next task is to determine how far you have moved your body when you have executed 2112 paces (the distance from home to school measured in paces).

Convert from paces to inches

We can begin by determining the distance from home to school in inches as follows:

distance = (2112*pace) * (30*inch/pace)

A review of algebra

At this point, let's review a little algebra:

Given the expression: ((w/x)*(y/z))

we can rewrite this as

(w*y)/(x*z)

Given this expression, we can reverse the process by rearranging and factoring out the terms producing our original expression:

((w/x)*(y/z))

An algebraic manipulation

We determined earlier that

distance = (2112*pace) * (30*inch/pace)

Applying the algebraic process shown above to the problem at hand, we can rearrange terms and factor our expression to produce

distance = (2112 * 30 * pace * inch)/pace

The distance in inches

At this point, we have a fraction that contains the unit pace in both the numerator and the denominator. We can cancel those two terms leaving us with

distance = (2112 * 30 * inch) = 63360 * inch

So good so far. We now know the distance from home to school as expressed in units of inches (even though the original measurement was made in paces and not in inches). The distance hasn't changed. What has changed is the units in which we are expressing that distance.

Still not what we are looking for

While this is interesting, it still isn't what we are looking for. We want to know the distance in miles. Therefore, we need to convert the distance in inches to the distance in miles.

How many inches are in a mile?

At this point, we don't know how many inches are in a mile (but we could calculate it if we wanted to). However, we do know how many inches are in a foot and we know how many feet are in a mile.

A conversion factor for inches to feet

For starters, lets calculate a factor that we can use to convert from inches to feet. We know that

12*inches = 1*foot

If we divide each side by 12*inches, we get

1 = 1*foot/12*inches

Let's refer to this as a conversion factor

Multiplication by 1

Since the expression on the right side is equal to 1, we can multiply any expression in an equation with the conversion factor

1*foot/12*inches

without changing the intrinsic value of that expression. (Once again, although we won't be changing the intrinsic value of the expression, we may cause that intrinsic value to be expressed in different units.)

We can use this conversion factor to convert a distance value expressed in inches into the value for the same distance expressed in feet.

A conversion factor for feet to inches

We could also use the reciprocal of the expression to convert a distance value expressed in feet into the value for the same distance expressed in inches. I will have more to say on this later.

A conversion factor for feet to miles

Similarly, we could use the same procedure to show that

1 = 1*mile/5280*foot

Again, since the expression on the right side is equal to 1, we can multiply any expression in an equation with the expression on the right without changing the intrinsic value of the original expression. This conversion expression can be used to convert from feet to miles. Its reciprocal could be used to convert from miles to feet.

Back to the problem at hand

We determined earlier that the distance expressed in inches from home to school is

distance = 63360 * inch

We can probably agree that multiplying the expression on the right as follows would not change the intrinsic value for the distance.

distance = 63360 * inch * 1 * 1

In fact, we could probably agree that it wouldn't change anything at all.

Substitute the two conversion factors

Having agreed on that, we can substitute the two conversion factors derived earlier, each of which has a value of 1, for the last two factors in our distance equation.

distance = 63360 * inch * (1*foot/12*inch) * (1*mile/5280*foot)

Rearranging the terms

We can rearrange the terms and rewrite this equation as

distance = (63360 * inch * 1*foot * 1 * mile)/(12*inch*5280*foot)

Canceling like terms

Canceling out like terms in the numerator and denominator leaves us with

distance = (63360*mile)/(12*5280)

Doing the arithmetic, we get

distance = 1*mile

(Obviously, I started out with a set of numbers that were designed to cause the final answer to be one mile, but that was simply for convenience.)

There you have it

You have seen a detailed procedure for converting from a distance expressed in paces (for a specific individual) to the same distance expressed in miles. Obviously, once you understand the overall procedure, you could omit and/or combine some of the steps to simplify the process.

### Using JavaScript to convert units

Let's write, execute, and analyze a script that solves the same problem.

The objective of the script is to convert a distance of 2112 paces to a distance in miles where it is given that

• 100 paces = 3000 inches
• 12 inches = 1 foot
• 5280 feet = 1 mile

Please copy the code from Listing 1 into an html file and open the file in your browser.

5
Listing 1: Convert from paces to miles.
>!-- File JavaScript01.html ------------------------------ >
>html >>body >
>script language="JavaScript1.3" >

var d  = 2112   //distance, units = paces

document.write(
"d  = " + d  + " paces" + "<br/>")

var d2 = 3000   //distance, units = inches
var d3 = 100    //distance, units = paces

var f1 = d2/d3  //factor, units = inches/pace
document.write(
"f1 =" + f1 + " inches/pace" + "<br/>")

//pace*inch/pace = inch
var d  = d *f1  //distance, units = inches
document.write(
"d  = " + d  + " inches" + "<br/>")

var f2 = 1/12   //factor, units = feet/inch
document.write(
"f2 = " + f2 + " feet/inch" + "<br/>")

//inch*feet/inch = feet
var d  = d *f2  //distance, units = feet
document.write(
"d  = " + d  + " feet" + "<br/>")

var f3 = 1/5280 //factor, units = miles/foot
document.write(
"f3 = " + f3 + " miles/foot" + "<br/>")

//feet*mile/feet = mile
var d  = d *f3  //distance, units = miles
document.write(
"d  = " + d  + " mile" + "<br/>")

//Now reverse the process using reciprocals
//(pace/inch)*(inch/foot)*(foot/mile) = pace/mile
var f4 =(1/f1)*(1/f2)*(1/f3) //factor, units = paces/mile
document.write(
"f4 = " + f4 + " paces/mile" + "<br/>")

//miles*paces/mile = paces
var d  = d *f4  //distance, units = paces
document.write(
"d  = " + d  + " paces" + "<br/>")

document.write("The End")

>/script >
>/body >>/html >


Screen output

When you open the html file in your browser, the text shown in Image 5 should appear in your browser window.

6
Image 5: Screen output for Listing #1.
d = 2112 paces
f1 =30 inches/pace
d = 63360 inches
f2 = 0.08333333333333333 feet/inch
d = 5280 feet
f3 = 0.0001893939393939394 miles/foot
d = 1 mile
f4 = 2112 paces/mile
d = 2112 paces
The End 

Discuss the output first

Let's begin our discussion with the screen output shown in Image 5 and then go back and examine the code that produced that output.

Image 5 begins with a distance (labeled d ) expressed in units of paces. The value is 2112 paces, which is the distance from your home to your school discussed earlier.

Convert paces to inches

Then Image 5 shows the conversion factor (labeled f1 ) that can be used to convert a value expressed in paces to a value expressed in inches.

That conversion factor is applied to the original distance producing an output consisting of the same distance expressed in inches instead of paces. The distance is now 63360 inches.

Convert from inches to feet

Following that, f2 shows the conversion factor that can be used to convert a value expressed in inches to the same value expressed in feet.

That conversion factor is applied to the current distance value producing an output consisting of the same distance expressed in feet instead of inches. The distance is now 5280 feet.

Convert from feet to miles

Finally, Image 5 shows the conversion factor (labeled f3 ) that can be used to convert a value expressed in feet to the same value expressed in miles.

That conversion factor is applied to the current distance value producing a final output consisting of the same distance expressed in miles instead of feet. That distance is now one mile (obviously I chose the numbers to make it come out that way).

That is the number that we were looking for.

Reverse the process

If a conversion factor X can be used to convert from A-units to B-units, the reciprocal of X can be used to convert from B-units back to A-units.

As you will see later, the conversion factor f4 shown in Image 5 was computed as the product of the reciprocals of f1 , f2 , and f3 . The result is that the conversion factor labeled f4 can be used to convert a value expressed in miles to the same value expressed in paces (according to the pace-length for one individual).

That conversion factor was applied to the distance expressed in miles to produce the same distance expressed in paces. As you might have guessed, this value of 2112 paces shown near the end of Image 5 matches the value shown at the beginning of Image 5 .

Analysis of the script

Now lets analyze the script code in Listing 1 that produced the text output shown in Image 5 .

Listing 1 begins by declaring and initializing the variables d , d2 , and d3 , which are respectively,

• The home to school distance in paces.
• The two values that represent the relationship between paces and inches for one individual.

Various values are displayed as the script executes using calls to the document.write method. You should have no difficulty identify the code that displays the values, so I will skip over that code in this discussion.

Compute, save, and apply the conversion factor f1

Then Listing 1 declares a variable named f1 and populates it with the value of a conversion factor that can be used to convert paces to inches. This conversion factor is computed from the known relationship between paces and inches mentioned earlier.

The conversion factor named f1 is applied to the distance in paces converting it to a value that represents the same distance in inches (63360 inches).

Analysis of the units

//pace*inch/pace = inch

is an analysis that shows the units that will result from applying the conversion factor to the distance at this point. As you can see, the pace terms will cancel and the result will be in inches.

Compute, save, and apply the conversion factor f2

Following that, a conversion factor named f2 is computed that can be used to convert a value expressed in inches to the same value expressed in feet. This conversion factor is based on the known fact that there are 12 inches in a foot.

The factor named f2 is applied to the distance that is now expressed in inches converting it to a new value that expresses the same distance in feet (5280 feet).

Analysis of the units

//inch*feet/inch = feet

is an analysis that shows the units that will result from applying the conversion factor to the distance at this point. As you can see, the inch terms will cancel and the result will be in feet.

Compute, save, and apply the conversion factor f3

Following that, a conversion factor named f3 is computed that can be used to convert a value expressed in feet to the same value expressed in miles. This conversion factor is based on the known fact that there are 5280 feet in a mile.

The factor named f3 is applied to the distance that is now expressed in feet converting it to a new value that expresses the same distance in miles (1 mile).

Analysis of the units

//feet*mile/feet = mile

is an analysis that shows the units that will result from applying the conversion factor to the distance at this point. As you can see, the feet terms will cancel and the result will be in miles.

That satisfies the specifications

That satisfies the original program specification. However, I mentioned earlier that if a conversion factor X can be used to convert from A-units to B-units, the reciprocal of X can be used to convert from B-units back to A-units.

Reversing the process

Continuing with Listing 1 , the comment that reads

//(pace/inch)*(inch/foot)*(foot/mile) = pace/mile

shows the units that survive from a product of the reciprocals of f1 , f2 , and f3 . As you can see, after canceling out inches and feet, the result of multiplying the reciprocals of those three conversion factors is a new conversion factor that can be used to convert a value expressed in miles to a new value that represents the same distance expressed in paces.

That conversion factor is applied to the distance in miles producing an output of 2112, which unsurprisingly, is the distance in paces that we started off with.

### More substantive JavaScript examples

Assume that you drop a rock from a balloon at a height of 10000 feet above the ground, Further assume that the positive direction is up and the negative direction is down.

What would be the height of the rock above the ground at the end of ten seconds? What would be the height of the rock at the end of twenty seconds?

An equation relating distance, acceleration, and time

As you will learn in a future module, the following equation gives the distance that the rock will travel as a function of time assuming that the initial velocity is zero . (The assumption is that the rock was simply dropped and not thrown .)

d = 0.5 * g * t^2

where

• d is the distance traveled
• g is the acceleration of gravity (approximately -32.2 ft/s^2)
• t is time is seconds

#### Free fall exercise

Please copy the code from Listing 2 into an html file and open it in your browser.

7
Listing 2: Free fall exercise.
>!-- File JavaScript02.html --<
>html<>body<
>script language="JavaScript1.3"<

//Function to compute free-fall distance for a given time
// in seconds.
function distance(time){
var g = -32.174; //acceleration of gravity in feet/sec^2
var d = 0.5 * g * time * time;//(feet/sec^2)*sec^2 = feet
return new Number(d.toFixed(0));
}//end function

//Compute and display height at ten seconds.
var t1 = 10;//time in seconds
var d1 = distance(t1);//distance traveled in feet
var h1 = 10000 + d1;//height in feet

document.write("At " + t1 + " seconds:" +"<br/>");
document.write("distance traveled = " + d1 +" feet<br/>")
document.write("height = " + h1 +" feet<br/>")

//Compute and display height at twenty seconds.
var t2 = 20;//time in seconds
var d2 = distance(t2);//distance traveled in feet
var h2 = 10000 + d2;//height in feet

document.write("<br/>At " + t2 + " seconds:" +"<br/>");
document.write("distance traveled = " + d2 +" feet<br/>")
document.write("height = " + h2 +" feet<br/>")

document.write("<br/>The End")

>/script<>/body<>/html<


Screen output

When you open the html file in your browser, the text shown in Image 6 should appear in your browser window.

8
Image 6: Screen output for Listing #2.
At 10 seconds:
distance traveled = -1609 feet
height = 8391 feet

At 20 seconds:
distance traveled = -6435 feet
height = 3565 feet

The End 

As you can see from Image 6 , after ten seconds, the rock will have traveled a distance of -1609 feet. (The minus sign indicates downward motion.)

Adding this value to the initial height of 10000 feet produces a value of 8391 for the height of the rock at the end of 10 seconds.

Similarly, Image 6 gives us 3565 for the height of the rock at 20 seconds.

Analysis of the code

The code in Listing 2 begins by defining a function that computes and returns the distance traveled for a rock falling toward the earth for a given time interval since release assuming that the initial velocity was zero (the rock was simply dropped).

This function implements the equation shown earlier, and expects to receive the time as an input parameter. It returns the distance traveled during that time interval.

Note that the interaction of units is shown in the comments with the result that the returned value is in feet.

Call the function twice in succession

Then the code calls that function twice in succession for two different time intervals (10 seconds and 20 seconds) to determine the distance traveled during each time interval.

In both cases, the distance traveled is added to the initial height of 10000 feet to determine the height of the rock at the end of the time interval.

Also, in both cases, the time interval, the distance traveled, and the resulting height of the rock above the ground are displayed as shown in Image 6 .

Note again that in all cases, the interactions of the various units are shown in the comments.

#### A plotting exercise

Let's do another exercise and this time plot the results.

Please prepare a piece of graph paper to plot a curve defined by several points. Interpret the grid lines such that you can plot values ranging from 0 to 10000 feet on the vertical axis and you can plot values ranging from 0 to 30 seconds on the horizontal axis.

JavaScript code

Copy the code from Listing 3 into an html file and open it in your browser.

9
Listing 3: A plotting exercise.
<!-- File JavaScript03.html --<
<html<<body<
<script language="JavaScript1.3"<

//Function to compute free-fall distance for a given time
// interval in seconds.
function distance(time){
var g = -32.174; //acceleration of gravity in feet/sec^2
var d = 0.5 * g * time * time;//(feet/sec^2)*sec^2 = feet
return new Number(d.toFixed(0));
}//end function

//Compute the height of the rock every two seconds from
// release until the rock hits the ground.
var t = 0;//seconds
while(t <= 30){
d = distance(t);//distance traveled in feet
h = 10000 + d;//height in feet

//Don't allow the height to go negative (underground)
if(h < 0){
h = 0;
}//end if

//Display time and height at current time.
document.write("time = " + t +
" height = " + h + "<br/<");
t = t + 2;
}//end while

document.write("<br/>The End")

</script<</body<</html<


The screen output

When you open the html file in your browser, the text shown in Image 7 should appear in your browser window.

10
Image 7: Screen output for Listing #3.
time = 0 height = 10000
time = 2 height = 9936
time = 4 height = 9743
time = 6 height = 9421
time = 8 height = 8970
time = 10 height = 8391
time = 12 height = 7683
time = 14 height = 6847
time = 16 height = 5882
time = 18 height = 4788
time = 20 height = 3565
time = 22 height = 2214
time = 24 height = 734
time = 26 height = 0
time = 28 height = 0
time = 30 height = 0

The End 

Plot the data

Plot the 16 points shown in Image 7 . Your horizontal axis should be the time axis and your vertical axis should be the height axis.

If we have both done everything correctly, the shape of your curve should be an upside-down parabola with its high point at a value of 10000. (If the word parabola is new to you, don't worry about it. It's not important for the purpose of this module.)

The graph

Image 8 shows an image of the graph that describes the trajectory of the falling rock. As usual, please ignore the lower-case letters scattered throughout the image. They were placed there when the image was used for a different purpose earlier.

Change in height increases with time

Getting back to the height versus time values shown in Image 7 and plotted in Image 8 , the value for height should decrease for each successive time value.

Also, the change in height should increase for each successive time interval until the height goes to zero. The height goes to zero when the rock has landed on the ground somewhere between 24 and 26 seconds. It continues at zero after that.

(Note that I put code into the script to prevent the value of height from going negative.)

The increase in the change in the height value during each successive time interval is the result of the time being squared in the equation given earlier . It is also the result of the acceleration of gravity that causes the downward speed of the rock to increase as the rock falls.

Analysis of the code

Listing 3 calls a function copied from the previous exercise inside a while loop to compute the distance traveled and the resulting height for a series of time values ranging from 0 to 30 seconds in two-second intervals.

Those values are displayed as shown in Image 7 .

Understanding the code in Listing 2 and Listing 3 is important. However, it is more important at this point that you understand the handling of units as shown in the comments in the code.

## Run the scripts

I encourage you to run the scripts that I have presented in this lesson to confirm that you get the same results. Copy the code for each script into a text file with an extension of html. Then open that file in your browser. Experiment with the code, making changes, and observing the results of your changes. Make certain that you can explain why your changes behave as they do.

## Miscellaneous

This section contains a variety of miscellaneous information.

### Note:

Housekeeping material
• Module name: GAME 2302-0350 Units and Dimensional Analysis
• File: Game0350.htm
• Published: 10/12/12
• Revised: 12/31/12

### Note:

Disclaimers:

Financial : Although the Connexions site makes it possible for you to download a PDF file for this module at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, you should be aware that some of the HTML elements in this module may not translate well into PDF.

I also want you to know that, I receive no financial compensation from the Connexions website even if you purchase the PDF version of the module.

In the past, unknown individuals have copied my modules from cnx.org, converted them to Kindle books, and placed them for sale on Amazon.com showing me as the author. I neither receive compensation for those sales nor do I know who does receive compensation. If you purchase such a book, please be aware that it is a copy of a module that is freely available on cnx.org and that it was made and published without my prior knowledge.

Affiliation : I am a professor of Computer Information Technology at Austin Community College in Austin, TX.

-end-

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks