skip to main content - dyslexic font - mobile - text - print

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.

Correspondent

Charles in NJ


Host ID: 229
website:
email: catintp.nospam@nospam.yahoo.com
episodes: 7

1502 - Practical Math - Units - Distances and Area, Part 2 | 2014-05-06

HPR Episode: Using and Converting Between Units of Distance

Intro: Last time, we talked in general terms about units, numbers and
how they might be useful in practice.  In this episode, we address some
specific measurement units that apply to distance and area, and how we
might convert from one system to another to better understand both.

Entire point of this episode is this: Carry units in calculations on 
  distances and areas, and you'll have more success in using them in 
  your life.  



Segment 1:  Review of Distance and Area conversions in the English system

1. Links from last time

   Table of Units: 
      http://www.csgnetwork.com/converttable.html

   To see why the story is tremendously more complicated than my account
      http://en.wikipedia.com/wiki/Mile

   Fun article on the mile.
      http://www.sizes.com/units/mile.htm
   
   High school student theme on the furlong.
      http://www.writework.com/essay/history-furlong by silverAlex2000

   Brief dictionary article on the mile, referenced by Dr. Math 
      http://www.unc.edu/~rowlett/units/dictM.html#mile 
      Referred by http://mathforum.org/library/drmath/view/61126.html

   Resource: StackExchange Physics and Maths sections ("mile" question)
      http://physics.stackexchange.com/questions/57785/difference-between-nautical-and-terrestrial-miles


2. Converting between units
   a. Units of distance usually defined as multiples of each other
      - 1 mile = 5,280 feet            - 1 hand = 4 inches
      - 1 foot = 12 inches             - 1 yard = 36 inches
      
      Skipping ahead to look at the metric system, we now have:
      - 1 inch = 2.54 centimeters (exact). Regularized in recent years.

   b. This works because there's consensus on Zero distance, so we don't
         have to adjust for differing origins, as we do with the 
         non-absolute temperature scales like Fahrenheit and Celsius. 
      
      - We'll get to temperature, non-absolute scales in a later show.

   c. For absolute scales, we can convert from one unit to another using
         a "conversion factor".  That is, we can convert a measurement 
         expressed in one unit to its equivalent in another unit by 
         multiplying or dividing by some number to stretch or compress 
         the original unit to match the target unit.
	 
      - Example: I know that 1 foot is 12 inches, so how many inches are
          there in 10 feet?  How feet are there in 660 inches?
      
      - It is clear that a factor of 12 ought to be involved, but how do
          I know when to multiply or divide by 12 in the conversion?
      
      - Wait!  I'm serious.  When you see this problem for the first 
          time, you have to think this through to get it right.  
        * Without a system in place, you always have to think about it.
      
      - Answers in naive setup:
          (i) 10 feet = (12 * 10) inches = 120 inches
         (ii) 660 inches = (660 / 12) feet = 55 feet

3. Having a system.  Or units conversion as "multiplying by One"
   
   a. In each of the solutions I wrote down above, I start with an 
         equation that looks like this: X inches = Y feet.

   b. Inches are not feet, and this way of writing down the calculation 
        does NOT help you figure you how the conversions should work, or
        whether you should multiply or divide to get the right answers.

   c. Here's a system for creating conversion factors that tell you what
        to do at each step in the units conversion process.  It is based
        on the very obvious fact that when I multiply any number by '1',
        its value remains unchanged.
	
      - Start with one of the identities we wrote down at the beginning.
	    In this case, let's use:  12 inches = 1 foot
	  
      - If I divide equals by equals, the results are equal.
	    So I can write:
	  
	                                   12 inches      1 foot
	  12 inches = 1 foot implies that  ---------  =  --------- = 1
		                                 1 foot      12 inches
      
      -	Get the first term by dividing my original identity by (1 foot).
      - Get the second term by dividing my original identity by (12 in).


   d. To make a conversion from feet to inches, I use:
   
                           12 in    10 ft 
      10 ft * 1 = 10 ft * ------- = ------ * 12 in = 10 * 12 in = 120 in
                           1 ft      1 ft
      
      - Note: In the fraction (10 ft) / (1 ft), the units "cancel out", 
                which leaves a unitless number.
	      
      - Suppose we start with the other form for the conversion factor:
   
                               1 ft    10 square feet 
      10 feet * 1 = 10 feet * ------ = -------------- = ???
                              12 in       12 inches
      
      - See?  When I use the form where the units don't cancel each 
          other, I get a resulting equation that is still correct.  It 
          just doesn't make much sense to me as a reader.
      
      - This is what you get when you "divide by 12" to convert feet to 
          inches, but the difference is that you KNOW something's wrong.  
      
      - You do not have to even look at the numbers to know that this 
         could not possibly be the right number of inches in 10 feet.


Brilliant Insight #2: When you use unit conversion factors, you help 
  your cause by carrying along both sets of units in the form of a 
  fraction as you go through your calculation.  
  
  - If the units on the right-hand side of your final equation don't 
    match the units you want (after everything else cancels out), your 
    numerical answer is almost certainly WRONG.
  
  - The implication here?  To convert units of distance, you need to 
       multiply or divide by a 
       
       conversion factor = (X New_Units) / (Y Old_Units).  
       
    When you do this, write the conversion factor in its full fractional
       form, and carry out all of the multiplications and cancellations.
  
  - If you do the conversion this way, and the units match, you only 
       have to check your arithmetic to be sure you've got it right.

  - If the units you want do not match those on the right side of the 
       equal sign, you are solving the wrong problem.  The equation may 
       be correct, but it is not expressed in the units you wanted.


 6. Let's use the system to solve the second example:
  
                               1 ft       660 in * 1 ft 
      660 in * 1 =  660 in *  -------  = --------------- = 55 feet
                               12 in        12 in
 
      Why?  The "inches" units cancel out because they appear in both 
        numerator and denominator (top/bottom, upstairs/downstairs) of
	    the fraction in the next to last term, leaving only "feet".

  Why people hate units and conversion problems:
  http://www.regentsprep.org/regents/math/algebra/am2/leseng.htm

  Comment: The "algebraic" approach suggested here is ugly, ad hoc in
    nature, and unnecessarily complicated.  Forget about setting up
    equations and going through formal operations to solve them.
    
    Choose your conversion factors so that the units work out properly
    as a straight multiplication problem with cancellation of all the
    units you don't want.  You may have to "divide" numbers, but you
    can use your calculator for working through the numbers.
    
  Cranky Summary: You should not have to solve equations to convert
    between units. Phooey on anyone who says otherwise. :-)
 

Segment 2: Conversions using compound conversion factors.

1. Suppose I want to find the number of inches in a furlong, or the 
   number of acres (or hectares) in a square mile?
   
   - My almanac doesn't carry these conversion factors, so I start with 
       what I do have and work my way through it.
       
                                       4 rods    16.5 ft    12 in
   1 furlong = 10 chains = 10 chains * ------- * ------- * -------
                                       1 chain    1 rod      1 ft
	
	     = 10 * 4 * 16.5 * 12 inches = ... = 7920 inches 


2. For acres in a square mile (1 mi^2), we have a bit more to do.

     Abbreviations used: miles = mi, furlong = fur, chain = ch
     
     Area means that we are dealing in two dimensions, so we have to 
        convert the lengths in each dimension.  An acre is already a 
        measure of area, so we're good.
	
                       1 acre    10 ch    8 fur   10 ch   8 fur
   1 sq mi = 1 mi^2 * -------- * ------ * ----- * ----- * -----
                       10 ch^2   1 fur    1 mi    1 fur   1 mi
		      
	   = (1 mi * 1 mi) * 1 acre * 10 ch * 10 ch   8 fur * 8 fur
	                              ------------- * -------------
                                       10 ch * ch     1 mi * 1 mi
     
   Units cancel, leaving this:
   
   1 sq mi = 1 acre * (100/10) * (8 * 8) = 10 * 64 acres = 640 acres
  
   

Segment 3: Hey!  Ready to try metric?

1. Metric system never caught on in the US, although most of English-
     speaking world has adopted it.  Units conversion is easy in the 
     metric system, because everything is in powers of 10.
   
   - But you still need to carry along units in calculations!
   
2. Area and distance units in the metric system

   - Basics of distance: Centimeter is easy for us to see, and now the 
       factor to convert centimeters to inches is exact.
       
       1 inch = 2.54 centimeters (cm) exactly
       
                                    1 inch
       1 meter = 100 cm = 100 cm * --------- = 39.37 in (approximate)
                                    2.54 cm 

       1 kilometer = 1,000 meters
       

   - Basics of area:
 
       1 are = 100 sq meters  (area of a square that's 10m on each side)
       
                                          100 sq m
       1 hectare = 100 ares = 100 ares * ---------- = 10,000 sq meters
                                           1 are

3. For short distances, we should do our conversions fairly precisely.

   - There's usually a higher relative error from rounding off too soon.
   - If you measure wood for a small project, you want to be "close".

                        2.54 cm
   So 1 foot = 12 in * --------- = 30.48 cm exactly.  Cut carefully!
                        1 in
			    
4. For larger distances, like distances covered in track and field, or
     the length of a football pitch (to a spectator), approximations can 
     give you a nice intuition for comparing units you know and a new
     set of units that you don't know as well.
     
   - 1 meter is around 39.37 inches.  Suppose I call it about 1.10 yards
        as a kind of approximate benchmark (39.60 in), so each meter in 
        my reckoning is about a quarter of an inch too long?  
   
   - If I'm planning a space mission, I could be in trouble. 
       But how bad would this be for getting an intuitive feel of the 
       distances covered by the athletes in the Olympic Games?

   - Error at  100 meters is about 0.23 in (0.6 cm) * 100 = 60 cm over
           at  200 meters, it's 1.1 m over.
           at 1 kilometer, it's 5.6 m over.
	   
     Unless you're a long-range sharpshooter, 5.6m off in 1 km seems OK.


5. Bonus: The news talked about a wildfire that burned 100,000 hectares.
      What kind of area are we talking about?

   - Let's use our approxmation of 1 meter is about 1.1 yards.
   
   - Acres are defined in terms of "square chains", so let's look at 
        meters vs chains to see what we get.
	
	                                               1 m
     1 chain = 4 linear rods = 22 yds = 22 yds * -------- = about 20m
                                                  1.1 yd

                                                 20m     20m
     1 acre = 10 square chains = 10 ch * 1 ch * ----- * ------
                                                1 ch     1 ch
						       
	    = 10 * 1 * 20m * 20m = 4,000 square meters, or 0.4 hectares

   - Wow!  An acre's about 0.4 hectares, or 1 hectare's about 2.5 acres.


   So what's the answer?
                                               2.5 acres   
      a) 100,000 hectares = 100,000 hectares * --------- = 250,000 acres
                                               1 hectare 


                                            1 sq. mi    250,000
      b) 100,000 hectares = 250,000 acres * --------- = ------- sq. mi
                                            640 acres     640
					    
	                  = 391 sq. miles (about 400 sq miles)

   Note: This suggests a shortcut conversion (hectares to square miles).

                                 640 acres   1 hectare
    1 square mile = 1 sq. mile * --------- * --------- = 256 hectares
                                 1 sq. mi.   2.5 acres


6. Final check: Error analysis on this approximate conversion from 
      hectares to acres or square miles.

   - Using Google or 'units' in the shell, we have:
   
     1 sq mi = 259 hectares to 6 significant digits, versus 256 (1%)

     Note: If we used 250 hectares per square mile, the relative error 
       is 3.5%.  That's less than the error in the news report.

     1 hectare = 2.47105 acres, versus 2.5 (1% error)

   Units shell command: Dann Washko did a really nice job on 'units' for HPR.
    * Linux in the Shell #26: http://www.linuxintheshell.org/
    * HPR Episode #1213: http://hackerpublicradio.org/eps.php?id=1213


Final word: Unless you are buying, selling or cultivating land, use the 
  cruder approximations here to understand the relationships between 
  acres, hectares and square miles.  It will make you seem smarter.
  
  - If someone calls you out and says it's wrong, blame "that guy on HPR."


Next Topic?  Volumes and recipes, other than medicines (separate topic)
  - Volumes are the bottom line in cooking, unless they aren't.
  - Hint: You should weigh some items, like some kinds of flour.

1497 - Practical Math - Units - Distances and Area, Part 1 | 2014-04-29

HPR Episode: Using and Converting Between Units of Distance

Intro: Last time, we talked in general terms about units, numbers and
how they might be useful in practice.  In this episode, we address some
specific measurement units that apply to distance and area, and how we
might convert from one system to another to better understand both.

Entire point of this episode is this: Carry units in calculations on 
  distances and areas, and you'll have more success in using them in 
  your life.  



Segment 1:  Distance and Area in the English system

1. Series will focus on English and Metric systems.
   a. Basic units of distance: inch, foot, yard, mile
   b. Basic units of area: square inch, square foot, acre, square mile


2. Other units of distance and area do exist
   a. Barleycorn for shoe sizes (1/3")
   b. Hand for describing horses (4")
   c. Rod for surveying (16-1/2 feet)
   d. Chain, also for surveying (4 linear rods, 66 feet, 22 yards)
   e. Furlong from horse racing and agriculture (220 yards, 10 chains)
   f. League (about an hour's walk) usually assumed to be 3 miles
      - Nautical: technical unit that's exactly 3 knots
   g. Square yard may be used in quotes for carpet installations

Table of Units: http://www.csgnetwork.com/converttable.html


Brilliant Insight #1: Units of distance were originally arbitrary.  We 
  did not standardize on inches, feet, miles, and so on because these 
  are magical units with special merits.  They were convenient at the 
  time and place where they were invented. 
  
  Standards let us talk to each other about distance without having to 
  be in the same place at the same time.  We'd have trouble if builders
  builders had to ask for boards "as long as my arm", or a plank 
  that's "Yea long". 


3. Bizarre properties of some English units explained:

   a. Rod/Chain: Used in measuring farmland and building plots
      - Rod is 5-1/2 yards, or 16-1/2 feet.
      - Chain is 4 linear rods, or the length of a surveyor's chain
      - Could have been longer or shorter.  Standard emerged from usage.
      
   b. Furlong: Longest row you can plow without resting the animals
      - Defined as 10 chains (220 yards)
      
   c. Acre: If you are on a quiz show, it's 43,560 square feet.  Huh?
      - Defined as the area of a plot that's 1 chain wide by a furlong 
      - Putting definitions together, we peek ahead to make sense of it.
      
        1 acre = 1 chain x 1 furlong x 10 chains   <--- multiply by 1
                                       ----------       (1 furlong is 
		                       1 furlong         10 chains)
      
        Cancelling out furlongs upstairs and downstairs, we get
	
            1 acre = 1 chain x 10 chains = 10 "square chains"
      
      - So the square feet in an acre is not (completely) arbitrary
      - It's just mostly arbitrary, but consistent with shorter units.

   d. Mile: Why is it 5,280 feet?  Similar story [Simplified version!]
      - Roman occupation brought in a 5,000 foot mile ("mille passus")
        Warning!  The Roman mile was defined in Roman feet, so it was
           a bit shorter than I've painted it.  
      
      - Originated as 1,000 double-steps or "paces"
      - Since 1,000 was "mille", unit naturally became "mile" in English
      
      - Elizabeth I (1603, or was it 1593?): 
        * Statute mile set to 8 furlongs (1,760 yds; 5,280 ft)
        * Why 8 furlongs?  Why not 10 furlongs?

        * Goal: Set new mile close to existing mile, but as N furlongs.
	    * New "statute mile" only about 5% longer than Roman mile
	      Note: Similar analysis could be used with other "miles".
	      
	    * Setting a mile to a even multiple of a furlong had practical 
	        benefits, and keeping it close to the old unit reduced 
	        conversion costs for "legacy users".
	        
      - That's why we've inherited a mile that measures 5,280 feet.

   To see why the story is tremendously more complicated than my account
      http://en.wikipedia.com/wiki/Mile

   Fun article on the mile.
      http://www.sizes.com/units/mile.htm
   
   High school student theme on the furlong.
      http://www.writework.com/essay/history-furlong by silverAlex2000

   Brief dictionary article on the mile, referenced by Dr. Math 
      http://www.unc.edu/~rowlett/units/dictM.html#mile 
      Referred by http://mathforum.org/library/drmath/view/61126.html

   Resource: StackExchange Physics and Maths sections ("mile" question)
      http://physics.stackexchange.com/questions/57785/difference-between-nautical-and-terrestrial-miles


4. Converting between units
   a. Units of distance usually defined as multiples of each other
      - 1 mile = 5,280 feet            - 1 hand = 4 inches
      - 1 foot = 12 inches             - 1 yard = 36 inches
      
      Skipping ahead to look at the metric system, we now have:
      - 1 inch = 2.54 centimeters (exact). Regularized in recent years.

   b. This works because there's consensus on Zero distance, so we don't
         have to adjust for differing origins, as we do with the 
         non-absolute temperature scales like Fahrenheit and Celsius. 
      
      - We'll get to temperature, non-absolute scales in a later show.

   c. For absolute scales, we can convert from one unit to another using
         a "conversion factor".  That is, we can convert a measurement 
         expressed in one unit to its equivalent in another unit by 
         multiplying or dividing by some number to stretch or compress 
         the original unit to match the target unit.
	 
      - Example: I know that 1 foot is 12 inches, so how many inches are
          there in 10 feet?  How feet are there in 660 inches?
      
      - It is clear that a factor of 12 ought to be involved, but how do
          I know when to multiply or divide by 12 in the conversion?
      
      - Wait!  I'm serious.  When you see this problem for the first 
          time, you have to think this through to get it right.  
        * Without a system in place, you always have to think about it.
      
      - Answers in naive setup:
          (i) 10 feet = (12 * 10) inches = 120 inches
         (ii) 660 inches = (660 / 12) feet = 55 feet

5. Having a system.  Or units conversion as "multiplying by One"
   
   a. In each of the solutions I wrote down above, I start with an 
         equation that looks like this: X inches = Y feet.

   b. Inches are not feet, and this way of writing down the calculation 
        does NOT help you figure you how the conversions should work, or
        whether you should multiply or divide to get the right answers.

   c. Here's a system for creating conversion factors that tell you what
        to do at each step in the units conversion process.  It is based
        on the very obvious fact that when I multiply any number by '1',
        its value remains unchanged.
	
      - Start with one of the identities we wrote down at the beginning.
	    In this case, let's use:  12 inches = 1 foot
	  
      - If I divide equals by equals, the results are equal.
	    So I can write:
	  
	                                   12 inches      1 foot
	  12 inches = 1 foot implies that  ---------  =  --------- = 1
					     1 foot      12 inches
      
      -	Get the first term by dividing my original identity by (1 foot).
      - Get the second term by dividing my original identity by (12 in).


   d. To make a conversion from feet to inches, I use:
   
			   12 in    10 ft 
      10 ft * 1 = 10 ft * ------- = ------ * 12 in = 10 * 12 in = 120 in
                           1 ft      1 ft
      
      - Note: In the fraction (10 ft) / (1 ft), the units "cancel out", 
                which leaves a unitless number.
	      
      - Suppose we start with the other form for the conversion factor:
   
	                       1 ft    10 square feet 
      10 feet * 1 = 10 feet * ------ = -------------- = ???
                              12 in       12 inches
      
      - See?  When I use the form where the units don't cancel each 
          other, I get a resulting equation that is still correct.  It 
          just doesn't make much sense to me as a reader.
      
      - This is what you get when you "divide by 12" to convert feet to 
          inches, but the difference is that you KNOW something's wrong.  
      
      - You do not have to even look at the numbers to know that this 
         could not possibly be the right number of inches in 10 feet.


Brilliant Insight #2: When you use unit conversion factors, you help 
  your cause by carrying along both sets of units in the form of a 
  fraction as you go through your calculation.  
  
  - If the units on the right-hand side of your final equation don't 
    match the units you want (after everything else cancels out), your 
    numerical answer is almost certainly WRONG.
  
  - The implication here?  To convert units of distance, you need to 
       multiply or divide by a 
       
       conversion factor = (X New_Units) / (Y Old_Units).  
       
    When you do this, write the conversion factor in its full fractional
       form, and carry out all of the multiplications and cancellations.
  
  - If you do the conversion this way, and the units match, you only 
       have to check your arithmetic to be sure you've got it right.

  - If the units you want do not match those on the right side of the 
       equal sign, you are solving the wrong problem.  The equation may 
       be correct, but it is not expressed in the units you wanted.


 6. Let's use the system to solve the second example:
  
                               1 ft       660 in * 1 ft 
      660 in * 1 =  660 in *  -------  = --------------- = 55 feet
                               12 in        12 in
 
      Why?  The "inches" units cancel out because they appear in both 
        numerator and denominator (top/bottom, upstairs/downstairs) of
	    the fraction in the next to last term, leaving only "feet".

  Why people hate units and conversion problems:
  http://www.regentsprep.org/regents/math/algebra/am2/leseng.htm

  Comment: The "algebraic" approach suggested here is ugly, ad hoc in
    nature, and unnecessarily complicated.  Forget about setting up
    equations and going through formal operations to solve them.
    
    Choose your conversion factors so that the units work out properly
    as a straight multiplication problem with cancellation of all the
    units you don't want.  You may have to "divide" numbers, but you
    can use your calculator for working through the numbers.
    
  Cranky Summary: You should not have to solve equations to convert
    between units. Phooey on anyone who says otherwise. :-)
 

Segment 2: Conversions using compound conversion factors.

1. Suppose I want to find the number of inches in a furlong, or the 
   number of acres (or hectares) in a square mile?
   
   - My almanac doesn't carry these conversion factors, so I start with 
       what I do have and work my way through it.
       
                                       4 rods    16.5 ft    12 in
   1 furlong = 10 chains = 10 chains * ------- * ------- * -------
                                       1 chain    1 rod      1 ft
	
	     = 10 * 4 * 16.5 * 12 inches = ... = 7920 inches 


2. For acres in a square mile (1 mi^2), we have a bit more to do.

     Abbreviations used: miles = mi, furlong = fur, chain = ch
     
     Area means that we are dealing in two dimensions, so we have to 
        convert the lengths in each dimension.  An acre is already a 
        measure of area, so we're good.
	
                       1 acre    10 ch    8 fur   10 ch   8 fur
   1 sq mi = 1 mi^2 * -------- * ------ * ----- * ----- * -----
                       10 ch^2   1 fur    1 mi    1 fur   1 mi
		      
	   = (1 mi * 1 mi) * 1 acre * 10 ch * 10 ch   8 fur * 8 fur
	                              ------------- * -------------
					10 ch * ch     1 mi * 1 mi
     
   Units cancel, leaving this:
   
   1 sq mi = 1 acre * (100/10) * (8 * 8) = 10 * 64 acres = 640 acres
  
   
Next time:  "Hey!  Ready to try metric?"


1353 - Practical Math - Introduction to Units | 2013-10-09

Introduction: Units are the bridge from learning abstract arithmetic 
  operations on numbers to actually using maths to navigate the world of 
  objects, distance, time, rates, volume, temperature, heat, current,
  voltage, and even cooking using recipes.

Goal for the series: Embracing units, and carrying them along as you go,
  can help you work with confidence in using maths in your life. 
  
  When you start to use maths to solve real problems, you are going to 
  run into units.  This series is intended to show you that units are
  your friends, and that they're here to help you.
    
Goal for this episode: We want to look at what units are, what they do, 
  types of units, and how to mix unitless numbers with units.
  

Resource for the series:

 * Khan Academy pages on Rates, Ratios and Units
   https://www.khanacademy.org/math/arithmetic/rates-and-ratios


Most articles that would be relevant to this introductory episode were
about teaching physics and chemistry, or discussions of philosophical 
implications of doing what we will be doing at every turn in this 
series.  

All of the formal operations that we will learn to do with units are
done every day in real life by experts in their respective fields.  I am
not worried about what it means to say, "There are 12 inches in a foot."

Later shows will have more links and resources.


Segment 1:  What do we mean by units?

1. Definition: Two types of units are useful in practical maths:
   
   a. Counting units: An individual thing treated as single or complete.
      Units can also apply to an individual component of a larger or 
      more complex system.  E.g., mufflers can become part of a car. 

      - Think of objects that you would keep in an inventory in your 
          pantry or in a warehouse.

   b. Measurement units: A quantity chosen as a standard that you can 
      use as a common benchmark for comparing other quantities (of the
      same kind).

      - "Same kind": Don't try to compare distances to times or volumes.
      
      - "Standards": Communication tool for talking about quantities
            without being face-to-face.  If you have standard units,
            you avoid expressions like "yea long", "kind of tall", etc.
      
      - Probably invented by buyers and sellers, or by the spouse of an
            avid fisherman.

   c. Composite units: Units can be multiplied together (or divided) to
      create new types of units.  Some people call these "derived
      quantities", but that may sound too much like programming talk.
      I use composite units because of the mental picture it creates of
      putting things together, or doing one operation after another.
      
      - Dimensionality changes: 
        * 1 ft * 1 ft = 1 square foot: distance^2 --> area
        * 1 ft * 1 ft * 1 ft = 1 cubic foot: distance^3 --> volume
        
      - Rates: 
        * Speed: distance / time = average speed, as in kilometers/hour
        * Flow rates: volume / time, as in liters/minute
        * Pressure: force / area, as in pounds / square foot
        * Density: mass / volume, as in kilograms / liter
        * Rationing: (1 period) counting units / time, as in apples/day
                  (longer time) apples / family_member / day
      
      - We will run more of these types of units in later shows.
       
   
2. Other kinds of numbers: Not every quantity has units attached

   a. Numbers can be unitless. Unitless numbers help you make sense of
         quantities with units through comparisons, extrapolations, etc.
         
     - Example: Percent changes are unitless floating point numbers, 
          unless it is tied to an elapsed time.  That's a "rate", which
          has units of "% per year" (say).
            
     - Example: Percentage of Total values are unitless fractions, too.
     
     - Example: Any unit can be multiplied by a unitless integer.
          * 2 feet, 3 apples, 4 quarts, 10 meters, etc.
          * "Twice as many", "ten times as far", "double a recipe"
     
     - Counting units can be multiplied by a unitless fraction, but the
          result will be rounded off to the nearest integer value.
          * "Mary has 2-1/2 times as many apples as John," is fine if
               John has 4 apples, and Mary has 10 apples.
          
     - Example: Measurement units can be multiplied by any arbitrary
          scale factor.
          * How big: "A land area 3.6 times the size of New Jersey..."
          * How far: "I'll meet you halfway..."
          * How much: "If using white flour, you'll need 30% more..."   

   b. When values with units are divided by other values with the very
        same units, the result is a unitless number.
      - Percent of Total and Percent Change are prime examples
      - Comparison of distances: 
        * "St. Johnsbury is 45 miles away, and Barton is only 15 miles.
             So you have to drive 3 times as far to get to St. J."
      
   c. Conversion factors between units work in this way.  They are given
          as ratios of some number of new_units divided by some other
          number of original_units.  
        
        * The original_unit quantities cancel in multiplication, just as
            numbers do, so you get an answer with the correct units!
        
        * You could call conversion factors "derived quantities", 
            because you create them from something called an identity,
            or a statement of equality that you know to be true. 
   
   d. Conversion factors will be covered next time.
   
   
3. Why bother with "counting units"?  Aren't these just names?

   a. Counting units are labels or names applied to individual items in
      a total count, but they are still useful.
   
   b. Using counting units helps us to make distinctions between items
      that are not interchangeable, so we can keep track of the counts
      for each individual kind of item.
      
      - If you need 2 apples, having 10 onions does not help you.
   
      - Thinking with units will help you keep inventories and to start
           setting up accounting systems for your business.  It will 
           also help you manage your kitchen and your budget at home.
      

Segment 2: Counting Units?  Are you serious?

1. Counting units give context to the numbers that you are using in any
   calculations that arise when you are buying, selling, trading or just
   using up items in a beginning inventory.
   
   Here's what happens when you don't track units in counting problems.
   
   - Example: "John has 9 apples in his basket.  If he gives 2 apples
     to Mary, how many does he have left?"
     
   - Speed test preparation textbooks seem to teach you to parse the 
     problem as if you were a word problem "compiler":

     a. Fish out the numbers and their roles.
       
        --> Notice that 9 is near "in his basket", 
                              and "how many does he have left?", 
            
            It must be the source.
	
	    --> Notice that 2 is next to "gives away". 
	    
	        It must be the change in quantity.
	
     b. Parse out the operation: "gives away" is code for subtraction.

     c. Do the calculation and supply a numerical answer: 9 - 2 = 7


2. Re-work the problem by tracking units.
   a. Read the problem.  I'll wait.  We will parse it together.
   b. John has a basket with 9 apples in it --> beginning inventory
   c. John gives away two (2) apples to Mary.
      - John's inventory of 9 apples is reduced by 2 apples, 
      - John now has 7 apples in his basket.
      
   d. Mary now has 2 additional apples in her inventory.
      - The apples were neither created out of nothing nor destroyed.
      - They came from somewhere (John), and they went somewhere (Mary).
      - If "apples out" does not equal "apples in", something's wrong. 
   
   e. Having this information lets you answer questions with confidence.
   
   f. Answer the question: "John now has 7 apples."
      - John does not have '7'.  John has '7 apples'.


3. Ho hum.  That solution is exactly the same. You're picking nits.

   a. For a trivial problem, this looks the same.  But there are some 
      benefits of using units, even if they appear to be "just labels".
 
   b. If the problem had said that "John gave 2 oranges to Mary", we
      would have spotted the discrepancy immediately.
      - Giving away oranges does not affect John's apple inventory
      - The oranges must have come from another supply (account)
      - We can still talk about an increase in Mary's oranges count, and
          the decrease in John's oranges -- even though we don't know
          the beginning or ending balances.
   
   c. What if the problem had said, 
         "Mary has three times as many apples as John.  How many apples
           would Mary have to give to John to leave each of them with 
           the same number of apples?"
   
   d. Better yet, what if the problem read:
         "John has 19 apples, and Mary has 14 oranges. Now John likes 
           oranges twice as much as he likes apples, but Mary likes 
           apples three times as much as she likes oranges.  
           
           How can John and Mary exchange apples and oranges to get the 
           best (equal) gain in happiness?"

      - This problem involves not only the tracking of apples and 
          oranges, but probably some type of "happiness" function 
          that gives a value that carries some kind of units.
        
        Warning: There's not enough information to really solve this
          problem without further assumptions.  It is meant as an 
          illustration of how complicated a setup can become when you
          get into real life situations.
      
      - Problems like this are what make people hate economics.  One 
          way to solve it is to define utility functions for each party.
      
      - Their preferences are so different from their inventories, that
          simply trading baskets is pretty close to an optimal solution.       
      
   e. If the problem had involved trading some of John's apples for 
        some of Mary's oranges, and possibly an offsetting cash payment
        to correct an imbalance, we would make the best use of our 
        information about the sources and uses of resources by tracking
        the units of each object or currency involved in the exchange.
   
      Point:  Problems can become complicated.  Units can help with the
              bookkeeping needed to work through to the answers.

              If someone poses a problem like this one to a group at a
              dinner party, it is time to remember that you forgot to
              iron your curtains.
              
              
4. Final properties of counting units

   a. Compatible counting units can be added and subtracted.
      - Example: 6 apples + 4 apples = (6 + 4) apples, or 10 apples.
      - Example: 6 apples + 2 oranges is a mixed expression.  They 
          cannot be added, except as part of a fruit salad.
   
   b. An amount that's given in counting units can be multiplied by an 
        integer, since that is like repeated additions.  They can also
        be multiplied by a fractional amount, but we would want to 
        interpret the result as a whole number.
        
   c. Any multiplication by a floating point number would have to be 
      defined, and it's usually not worth the effort.
   
   d. Counting units have weaknesses, especially in classification:
      - Organic items are usually not identical.  Apples can vary. 
        * Size: A recipe calls for "3 large apples".  Are these large?
        * Varieties: "Apples" in the US can include Macintosh, Rome, 
             Gala, Granny Smith, etc.  These can be quite different.
       
      - Animals also vary within categories:
        * Cats: Lions, lynxes and Little Puff can all qualify
        * House cats: Siamese, Persians, Tabby cats are all just cats,
            until you have them living in your home.
      
      - Some living things are hard to pin down: sponges, paramecia
      
      - Other items can also create classification issues, depending on
           your purpose.
        * Units are just tools.  Let them work for you, and not the 
            other way round.


Segment 3: Units of measurement

1. Measurement units are often continuous (or just about), so they can
     be divided conceptually into smaller and smaller subunits as many
     times as we like.  

   - They can also be lumped together into larger and larger wholes.

   - Physical limitations place practical limits on how finely we can
       actually chop things up, and still get a measurement.
       
   - There are real world limitations on how much we can lump together.

   - But you get the idea.


2. Measurement units can be applied to distance, time, area, volume, 
     weight or mass, energy, frequencies of light or radio waves, 
     voltages, current, heat, temperature, and a host of other things.

   - We can measure these quantities with differing levels of precision,
       based on the instruments and abilities that we have.

   - For all practical purposes, we measure within tolerances that we
       can meet without spending our whole lives measuring. 


3. Applications of measurement units

   a. Understanding the news: hectares of forest endangered by a fire,
        square miles of arable farmland in South Africa,
        temperatures given in unfamiliar scales such as Fahrenheit,
        snowfall measurements in Canada versus neighboring Montana, etc.
   
   b. Following recipes to make bread, cookies, beer and other items 
        that promote World Peace
   
   c. Mixing chemicals for an old-school darkroom, or for a very cool 
        low-tech electronics home "fab lab"
   
   d. Buying gasoline (petrol) in other countries, and understanding
        their speed limits in foreign units.
        
      - Can't help you with driving on the wrong side of the road
   
   e. Helping your kids with their maths homework, and understanding it
        for once!
   
   f. Checking the dosages of your medications against your prescription
         to find out if this is my medicine or my child's.  You just
         have to be able to get this one right.

We'll get to all of this and more in future episodes in this series.

1292 - Doomsday Remainders | 2013-07-16

Last Episode on Conway's Doomsday Rule ends with teaser on MOD(), a
"remainder" function defined for integer values (whole numbers):

   MOD(K, m) = remainder when K is divided by "modulus" m.
   
Examples: 
  a. MOD(207, 7) = MOD(207 - 140, 7) = MOD(67, 7) = 4
  b. MOD(1234567, 2) = 1 because the number is odd
  
MOD() function found in most spreadsheet programs, but it also shows up
as an operator in some programming languages: (a % b), or (a mod b).


Other functions referenced:
   DIV(K, m)    = quotient in integer division
      where K = m * quotient + remainder (not returned)
            0 <= remainder < m

   DIVMOD(K, m) = (quotient, remainder) when K is divided by m
      where remainder = MOD(K, m)
            quotient  = DIV(K, m)
            K = m * quotient + remainder

Full Show Notes

http://hackerpublicradio.org/eps/hpr1292.txt

Links


1240 - Doomsday Rule | 2013-05-03

HPR Episode: Doomsday Perpetual Calendar Method

What is it?  http://en.wikipedia.org/wiki/Doomsday_rule  
  (due to John H. Conway, a mathematician born in Liverpool)

  * He's done other research that hackers might like to check out.  
  * Look up the "Game of Life" and "cellular automata".  
  * There may be episodes on these topics, but those should come
      with visualization software.

John H. Conway
  http://en.wikipedia.org/wiki/John_Horton_Conway

Game of Life
  http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
  

Doomsday Rule lets you find the day of the week for any date
  * Dates in history, in immediate past or in future are all good.
  * Works for both the Gregorian and Julian calendar.  
    - I'll only be looking at Gregorian dates for now.
    - Method should work well for dates from 1800 onward.
    - If dates for non-Gregorian calendars are converted to their
        (extrapolated) Gregorian equivalents, this method works.

Wikipedia entry (includes recent optimization):
  http://en.wikipedia.org/wiki/Doomsday_algorithm


Why do this?  It came up in Episode Zero of my "N Days" show on 
calendar counting, where I used it without explanation.

  http://hackerpublicradio.org/eps.php?id=1143


Demos: Check these answers at www.day-calculator.com  
  * Some listeners may now adjourn to the latest Linux Outlaws episode.


Method: Get Century Anchor Day, calculate offset for the year to find
   Doomsday's reference location for current year, find closest 
   reference date to target date, and count off to the answer.

a) Isaac Newton's date of birth: 
   - 25 December 1642 - 1600's Tuesday. 
     Year 42 = 3*12 + 6 and (6/4) = 1. 
     Hence 3 + 6 + 1 = 10 for an offset of 3.
     Tuesday + 3 = Friday.  12/12 is Friday, so 12/26 is Friday
     Newton was born 12/25, so that was a Thursday

b) My grandfather's date of birth:
   - 20 January 1898 - 1800's anchor is Friday.  
     Year 98 = 8*12 + 2, (2/4) = 0.  
     So 8 + 2 + 0 = 10 gives an offset of 3.

   - 1898 wasn't a leap year, so 10 January was Monday 
   - That means 17 January was a Monday, too.
   - So 20 January 1898 was a Thursday.

c) A wedding anniversary that I like to remember: 15 May 2000
   - 2000 has anchor day on Tuesday, and no offset.
   - Rule: "I work 9 to 5 at 7-11", so 9 May (16 May) are on Tuesday.
   - 15 May 2000 was a Monday.  True.  'Twas the day after Mother's Day.
   
d) My parent's wedding day: 19 May 1957
   - 1900 has anchor day Wednesday.  57 = 4*12 + 9 and (9/4) = 2. 
   - So 4 + 9 + 2 = 15 or an offset of 1.
   - 9 May is Thursday, as is 16 May.  The 19th is 3 days later.
   - So 19 May 1957 was a Sunday.


Plan: I'm going to reveal the magic behind this, and introduce some 
mental shortcuts to help you learn to do this in your head.  

If you can master the 12's row in your times tables up to 8 times 12, 
and the 4's row up the 20s or 30s, and you can tell time on a 12-hour 
clock, you should be able to do this.  

We're not in school, so paper and pencil to track the numbers, and 
finger-counting offsets to days of the week are all allowed. 


Explanation:
1. Certain memorable dates fall on the same day of the week as
   "Doomsday" = last day of February, whatever that is.

2. Dates recycle every 400 years, and Doomsday Anchor dates by Century
   are 1600: Tuesday, 1700: Sunday, 1800: Friday, 1900: Wednesday.

3. That's enough, but to simplify mental math notice 12-year cycles.
   - Every completed 12 years pushes the days of the week ahead by +1
   - Each year within the current incomplete cycle adds +1
   - Each leap year in current cycle adds +1 (including current year) 

4. Doomsday dates are:
   a. January 10 and Doomsday (last day of February)
   
   b. Odd months: Add +4 through July, then subtract 4.
      7 March, 9 May, 11 July
      5 September, 7 November
   
   c. Even months are reflexive: 4/4, 6/6, 8/8, 10/10, 12/12


See the attached spreadsheets for examples and annotated calculations.

 - LibreOffice Calc: 229-Charles-in-NJ-Doomsday-Rule-v1.ods
 
 - Excel 5/95 'xls' for LibreOffice or Gnumeric:
     229-Charles-in-NJ-Doomsday-Rule.xls
 
 - Gnumeric: 229-Charles-in-NJ-Doomsday-Rule-v1.gnumeric


Bonus Content:
 - Excel VBA module: 229-Charles-in-NJ-Doomsday-Rule.vbaxl.bas 
     * Import the .bas module
     * Input is an Excel "Date" object
     * Very proprietary formats and code, but some people use it.
 
 - Python:  doomsday.py
     * Contains two functions:  Each returns a string value for the day
          of the week, e.g., "Sunday"
       
       dayOfWeek(year, month, day): Doomsday is last day of February,
          and the (month, day) are converted to relative ordinal dates.
          For leap years, we have to push both Doomsday and any target
          date after 28 February up by one for the leap day.
       
       dayOfWeek2(year, month, day): Doomsday date anchors are computed
           for each month, so leap years require adjustments to the
           anchors for January and February to account for the shift
           in the February ending date.  Later months are fine.

 - Script for GNU 'bc': doomsday.bc is a bc 'port' of the Python code
     * Differences: Return value is a number from 0-6 that represents
         the day of the week by its relative position.
         
       0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 
       4 = Thursday, 5 = Friday, 6 = Saturday
 
     * In a shell, run 'bc' with the filename as an argument:
       catintp@Derringer:~$  bc doomsday.bc
       
       - This loads the two functions in the file.  You can invoke them
           within 'bc' like any other function:
           
       dayofweek(1981, 5, 15)
       dayofweek2(1642, 12, 25)
       dayofweek(2013, 11, 22)
       dayofweek2(2059, 5, 19)

 - Alternate Script for GNU 'bc': doomsday2.bc 
     * Return value is still a number from 0-6 that represents
         the day of the week by its relative position.
     
     * Uses a side effect to print a human-friendly answer.   
     
     * English only, but localisation should be easy.

Links


1189 - Part One: Counting Partridges and Gold Rings | 2013-02-21

Edited version - re sent

The Sonar Project has $9,838 raised with 256 people contributing. A big thanks to all the !HPR Listeners who helped out.
It's not too late to contribute to the ACF. See http://accessiblecomputingfoundation.org/ for more information.

Tomorrow The Eleventh Annual Southern California Linux Expo starts. Running from February 22 to the 24, 2013 in the Hilton Los Angeles International Airport. Speakers include Kyle Rankin, Joe Brockmeier and Matthew Garrett.
See http://www.socallinuxexpo.org/scale11x for more information

The N Days of Christmas? Intro to Recreational Math Part One: Counting Partridges and Gold Rings

The complete shownotes can be found here:

Pascal's Triangle:

Background on Pascal's Triangle and the Binomial Theorem, see the excellent videos by Sal Khan at http://KhanAcademy.org

Contact: Charles in NJ Email: catintp@yahoo.com

Charlie + Alpha + Tango + India + November + Tango + Papa.


1143 - The N Days of Christmas? Intro to Recreational Math | 2012-12-19

Hacker Public Radio: 206 203 5729

The N Days of Christmas? Intro to Recreational Math
Part Zero: Calendar Counting

First episode of HPR that contains a direct discussion of a math topic.
 - Episode 479 Ohio Linux Fest, Klaatu interviews DWick about math 
      software for Linux
      
 - Episode 523 Using Petunia software to teach math


Inspired by a traditional song that is proof that some songs do not
   need to be recorded by William Shatner to be annoying.
 - Repetitive and formulaic
 - Involves a lot of counting, and that's our focus here. 
 
 
What is the 12 Days of Christmas?
 - Starts on Christmas Day, runs through the day before the next Season
 - Hint: That's 'Epiphany', which starts January 6.
 - Counting calendar days comes hard, so we tend to use our fingers
 - Turns out that using our fingers is quite mathematical. Here's why.
 
Finger Counting: How do I count Twelve Days?
 - Let's start easy, with the fingers on one hand. My hands have five.
 - To name the Five Days of New Years is easy: January 1-5 
 
 - What about the Five Days of Christmas?
        Physical way                   General way
   * Christmas Day gets 1 (thumb)     Dec 25 is one day after Dec 24
   * Dec 26 gets 2 (index)            26 - 24 = 2 days
   * Dec 27 gets 3 (salute finger)    27 - 24 = 3 days
   * Dec 28 gets 4 (ring)             28 - 24 = 4 days
   * Dec 29 gets 5 (pinky)            29 - 24 = 5 days
 
 - Notice that counting 5 days, starting with Dec 25, is the same
     as numbering the days after Dec 24 (Christmas Eve).
   * In math, we call this "1-1 correspondence with natural numbers"
   * Math can give you the same certainty as using your fingers.  
   * But it handles larger problems, because you don't run out.
 
 - Example: I'm booked to speak on Day 4 of a 5-day conference
   * Starts on the 25th of the month
   * When do I have to show up?
     - Wrong: Add 4 to first day (25), and arrive a day late.
     - Correct: Add 4 to date of pre-registration cocktail party (24),
          and arrive on time.
      
 - OK. Back to Twelve Days of Christmas.  
   * The labeling approach tells us that December can hold only the 
       first seven of the Twelve Days of Christmas, 
   * December 31 - December 24 gives me 7 days.
 
 
 Partitioning: Adding hands full of additional fingers as needed
  - How do we handle the case where we go into the next month?
  - Key insight: Running out of December days for the Twelve Days is 
       like running out of fingers on one hand when we count to 8.
  - We are so good at counting on our fingers that we don't recognize 
       the act of partitioning the number 8 between our two hands.
    *  Left hand gets 1, 2, 3, 4 and 5.
    *  Right hand picks up 6, 7 and 8 by mapping them to fingers 1,2,3.

  - To count even higher, we could:
      1) keep borrowing other people's hands, or
      2) track the number of times we reuse our two hands as we go
    
    * First method mirrors calendar math ("Annexing" hands, or months)
    * Second is positional notation ("base 10" and all that)


Back to the Twelve Days
 - I have Twelve Days: 1, 2, ... 12 to assign to dates, even though I 
     may only be interested in the first and last dates right now.
   * Start: How many can I fit into December?
   * December 31st is last. It gets assigned 31 - 24, or 7. 
   * By "finger math", that means I have mapped 7 of the Twelve Days
   * That leaves 12 - 7, or 5 days into January.
 
 - Who can tell me which days are assigned in January? Anyone?
   * That's right, Ken.  January 1, 2, 3, 4 and 5.
   * So the Twelve Days of Christmas runs 25 December to 5 January 


Question: What if there were 72 Days of Christmas?  When would it end?
 - Note: Don't worry.  This is purely hypothetical.

 - Let's attack this with finger math, with partitioning and annexing
   * December, as we have seen, accounts for 7 days: 25 through 31
   * That leaves 72 - 7, or 65 days
   * January easily picks up 31 days: 1 to 31, leaving 65 - 31 = 34 days
   * February can handle either 28 days, or 29 on a leap year.
   * This leaves us either 5 or 6 days into March

 - Final Answer: 72 Days of Christmas would run from Christmas until the
     following March 5 (leap year), or March 6 (all other years).
   * On Day 73, everyone would enter treatment for Christmas overdose.

Let's check the answer: Day 72 would end ten weeks and 2 days after 
   the opening cocktail party (Monday). So Day 72 should be Wednesday.
   * Next year is not a leap year, so last day is March 6.
   * By the Doomsday perpetual calendar method, Feb 28 is Thursday.
   
   Doomsday method: http://en.wikipedia.org/wiki/Doomsday_rule
   
   * So March 7 is Thursday, and March 6 is Wednesday.
   * It worked.
 
Why should I bother with Calendar Math?
 - I learn to look for ways to partition hard problems into easier ones.
 - I learn the same skills that I'll need to debug "off-by-one" errors
     and other boundary violations, which kill you in C programs.
 - I will never miss a speaking engagement, as long as I count my 
     Conference Days from the cocktail party, not from the Keynote.


Next episode: Part One
  Counting partridges and gold rings with Pascal
  - Warning: There will be two semi-magic formulas at the end.
  - I'll show you an easy way to do running sums in a spreadsheet.
  - You can skip the formulas, and I'll never know.
  - Since this is HPR, not school.  We can look up the formulas.


Contact: Charles in NJ
Email: catintp@yahoo.com

Charlie + Alpha + Tango + India + November + Tango + Papa.


Become a Correspondent