Using a Computer to Take Care of Tedious, Repetitive Calculations

advertisement
Using a Computer to Take Care of Tedious, Repetitive Calculations
Most good physics projects involve a lot of calculations. You can do these calculations
by purely hand, or by hand and with a calculator, but one of the original reasons
computers were built was to do tedious, repetitive physics calculations so physicists
could do as little by hand as possible. In fact, one of the first “electronic computers” ever
built was built for the purpose of doing the tedious task of calculating the physical paths
of artillery projectiles in the 2nd World War. Most computers at Jefferson are equipped
with Microsoft EXCEL, which is an excellent program for doing calculations. With an
EXCEL-equipped computer you have better number-crunching power at your fingertips
than anyone had in World War II.
Suppose you are given this simple assignment:
Calculate the volume of a cube that measures 2 cm on a side. Repeat
for side lengths of 5, 10, 20, 30, 40, 50 and 100 cm. Calculate the
density of these cubes in g/cm3 if each has a mass of 500 grams.
You could do this easily enough with a calculator. The volume of a cube is Volume =
(side length)3. Density = Mass divided by Volume. You would have to find the volume
of each, write it down, and then divide 500 grams by that volume. You would fill half a
page or more with calculations, and it would take you several minutes, if you didn’t make
any mistakes. And you would have to watch out for errors in rounding.
With EXCEL you can do the whole thing in under a minute, once you learn the program.
This tutorial will show you the basics of using EXCEL to do tedious, repetitive
calculations.
First start EXCEL. On Jefferson computers, click on the Windows “START” button,
then on “PROGRAMS”, then look for EXCEL or MICROSOFT OFFICE. EXCEL
might be by itself or you might have to click on OFFICE first to find it. If you are using
a library computer you can ask a member of the library staff to show you how to find
EXCEL. Once you find it, click on it to start the program.
When you get EXCEL running, you will see a
grid of little boxes as shown here. These are
called “cells”. The cells run in columns (A, B,
C, D, etc.) and rows (1, 2, 3, etc.). You can
click on any cell and type in it.
We will start with creating a cell labeled “Side
(cm)” to help us keep track of what is in the
cells. Type Side (cm) in cell A1 as shown here.
Then, in cell A2 (you can move down to A2
using either your mouse or the keyboard arrow
keys) type the number 2 (the length of the side
of the cube).
Now we’ll have EXCEL calculate the cube’s
volume. The volume is the side cubed. Move
to cell B2 with the mouse or the arrows keys on
the keyboard. In cell B2 we type =A2^3. This
tells EXCEL that in cell B2 we want it to take A2 and raise it to the power of 3. The =
sign tells EXCEL to do a math operation, and in EXCEL raising to a power is done using
the ^ sign (the ^ is the character above the number 6 on
the keyboard). We hit the ENTER key and EXCEL
will now do the operation.
Here is where EXCEL gets fast. In cells A3 through A9 now type in all the other side
lengths for which we have to find volumes.
Now take your mouse and click on cell B2. Hold the left
mouse button down and slide the mouse down so that you
highlight cells B3 through B9 as shown in the figure at right.
This sometimes takes a little practice to learn how to do. Just play with it a bit. If
EXCEL gets hopelessly messed up, just exit the program and start over.
Once you’ve got the cells highlighted, let go of the mouse button. The cells should stay
highlighted. If something goes wrong, try highlighting again. Remember if EXCEL gets
hopelessly messed up, you can always just exit the program and start over.
Now, hold down the “control” key (often labeled CTRL and usually located in the bottom
left corner of the keyboard) and press the “d” key. This CTRL-D tells EXCEL to
replicate cell B2 down through the highlighted cells. B2 is set to cube the cell to the left
of it, so this will tell all the highlighted cells to cube the cells to the left of them , too.
And BAM! You now have the volumes of all eight of the cubes for which you were to
do calculations.
Now lets get those densities. But first, in cell B1 type Volume (cm^3) just to keep track
of what values are in what cells.
To calculate density you will need mass. Move over a couple cells. In D1 type Mass (g),
and below that, in D2, type 500.
Now replicate D2 down the column by
highlighting cells D3 through D9 and using
CTRL-D.
Make the E column your density
values. Type Density (g/cm^3) in
cell E1 for the purpose of keeping
track of things. Then in cell E2
type =d2/b2. This tells EXCEL to
take the value in cell D2 (the 500
gram mass) and divide it by the
value in cell B2 (the 8 cm3 volume).
This is mass/volume, or density.
The / is used for division in
EXCEL.
Hit ENTER and EXCEL will calculate 500/8 for you, which is 62.5.
In EXCEL:
Addition is +
Subtraction is –
Multiplication is *
Division is /
Exponents (powers) is ^
Now highlight the seven cells
below E2 and use CTRL-D to
replicate down. Now you
have all your density
calculations done. You can
send this to the printer, add
your name and turn it in. You
better include an explanation
of how you did the
calculations, or better yet a
written-out sample showing
the first calculation worked
out.
A properly written assignment might look like the sample on the next page.
J. Smith
Physics – Cube Density Assignment
I did my calculations using EXCEL. I used the formulas
Vol = s3 (for a cube)
Density = m/Vol.
Sample calculation for the 2 cm cube:
V = (2 cm)3 = 8 cm3
D = 500 g/8 cm3 = 62.5 g/cm3
I did all the other cubes the same way using EXCEL. Here are my results
from EXCEL, printed out:
Side (cm) Volume (cm^3)
Mass (g) Density (g/cm^3)
2
8
500
62.5
5
125
500
4
10
1000
500
0.5
20
8000
500
0.0625
30
27000
500
0.018519
40
64000
500
0.007813
50
125000
500
0.004
100
1000000
500
0.0005
Here are my answers, cleaned up and rounded to a reasonable number of
digits:
Side (cm) Volume (cm3)
2
8
5
125
10
1000
20
8000
30
27000
40
64000
50
125000
100
1000000
Density (g/cm3)
62.5
4
0.5
0.0625
0.0185
0.00781
0.004
0.0005
Download