Math for Computer Architecture Part 1
Notes
- We will be doing some computation this semester
- The first topic is the factor-label method
- You can look up Conversion_of_units on Wikipedia for a further discussion
- This method of computation
- Requires that there be a conversion factor between different units.
- Has the person doing the computation include these units to assure accuracy and the ability to check correctness
- Please search for articles about the Mars Climate Orbiter, (Wikipedia Mars_Climate_Orbiter)
- Lockheed Martin used US Customary Units
- NASA used SI units (more on this later)
- And so it burned up in Mars' upper atmosphere.
- And so, $327.6 million was lost.
- Allows the person doing the computation to use the rules of algebra
- Keeps us from memorizing hundreds or more conversion formulas.
- This works when there is a relationship between units.
- 1 ft ≈ .3048 meter
- 1 second = 1000 milliseconds
- 1x106MB = 1 TB (for later)
- Do I need to do this?
- The Mars Climate Orbiter really makes me mad.
- So Yes, you do
- But it is too much writing/typing
- It is part of the problem solving required for this class.
- And as such, I reserve the right to mark any solution not showing this method as wrong.
- Finally, it allows partial credit.
- The Method
- Setup
- State the units you have and the units you want.
- State any conversion factors, but this can be done as part of the solution as well.
- Perform a series of computations
- Starting with the original unit
- Multiplied by a conversion factor containing
- The original unit
- The final unit
- An intermediate unit
- Include a dimension label with every number
- Cancel the
labels, but keep them visible. - Cary along the numbers, simplifying if necessary.
- Setup
- A simple example: I needed to walk 200KM to reach level 74 in Pokemon go. How far is that in miles?
- Setup:
- I have: km
- I want: miles
- I know: 1 km = 0.62 miles
- Start the conversion
0.62 miles 200 km x ---------- 1 km - This relies on the fact that
- 1km = 0.62 miles
- so 1 = 0.62miles/1km
- And I can multiply anything by 1 and not "change" it mathematically.
- "cancel" the units you can, are you at the answer?
0.62 miles 200kmx ---------- = 1km200 * 0.62 miles = ----------------- 1 = 200*0.62 miles = 124 miles - Notice how the conversion and each step of the calculation can be checked.
- And I don't need to remember any equations, it is derived as part of the computation.
- Setup:
- By the way, this provides some built in error detection.
- Why did I multiply by miles/km, why not km/mile
1 km 200 km x ---------- 0.62 miles 200km * 1km = ----------- (because km*km = km2) 0.62 mile 200km2 = ----------- 0.62 mile = 323 km2/mile - What is a km2/mile?
- Why did I multiply by miles/km, why not km/mile
- Remember, the word "per" means divide.
- Example 2, My truck gets 22 miles per gallon, and I need to drive to mom's house that is 141 miles away. How much will this cost?
- I have miles
- I want dollars
- I know
- 22 miles = 1 gallon of gas (22 miles/1 gallon)
- Gas costs $4.40 per gallon (4.40 dollars = 1 gallon of gas)
1 gallon 141 miles x ---------- 22 miles 1 gallon = 141milesx ---------- 22miles= 141/22 gallons = 6.41 gallons $4.40 = 6.41gallonsx -------- 1gallon= 6.41 * $4.40 = $28.20
- A problem for you
- A 3 minute song takes about 4MB to store in MP3 format (I made that up sort of)
- You have about 500 MP3s that average 3 minutes in your music library. (I made this up)
- A 128TB portable external ssd drive costs about $45 (I looked this up, and I don't care if you don't like this price)
- What does it cost to store your entire library?