1 / 12

Tiny Experiments for Algorithms and Life

Explore tiny experiments in Math, Science, and Engineering, teaching college undergraduates and algorithms researchers practical applications in MSE. Discover the small end of the scale with fun and useful activities in a negative class time setting.

brettv
Download Presentation

Tiny Experiments for Algorithms and Life

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tiny Experiments forAlgorithms and Life Jon Bentley Avaya Labs Research

  2. “Tiny” The Real Topic: Tiny MSE • Math, Science and Engineering (MSE) • Broad umbrella; “I know it when I see it” • Math: Symbolic reasoning, computation, statistics, … • Science: Experiments, physical models, … • Engineering: Applications, apparatus, calibration, … • Size • Ad hoc divisions from nano to jumbo • The small end of the scale • In one’s head – a fraction of a minute • On the back of an envelope – a few minutes • On a blank spreadsheet – fraction of an hour • ….

  3. The Thesis • Tiny MSE can be • Fun • Simple • Performed when and where it matters • Taught to college undergraduates • Useful • To algorithms researchers • To computer scientists • To real people making real-life decisions • To MSE teachers who want to motivate students • Ideally, in negative class time

  4. A Great Bug Report • We [Wilks and Becker] found that qsort is unbearably slow on ``organ-pipe'' inputs like ``0123443210'': • main(int argc, char **argv) • { int n=atoi(argv[1]), i, x[100000]; • for (i = 0; i < n; i++) • x[i] = i; • for ( ; i < 2*n ; i++) • x[i] = 2*n-i-1; • qsort(x, 2*n, sizeof(int), intcmp); • } • (Continued …)

  5. Wilks and Becker, Cont. • Here are the timings on a Pentium: • $ time a.out 2000 • real 5.85s • $ time a.out 4000 • real 21.65s • $ time a.out 8000 • real 85.11s • $ • This is clearly quadratic behavior – each time we double the input size, the run time goes up by a factor of four. • A simple experiment to reveal functional form: quadratic when it should be (n log n)

  6. Tiny MSE Outdoors? Dec 25, 2002

  7. How Much Snow? • Facts • The tent is a square, 2.7m on a side • The snow is 75cm high • Weight of snow • Light snow is about one-tenth as dense as water • A cc of water weighs 1g; a 10cm cube of water weighs 1kg • Calculation • A square meter of water 10cm deep weighs 100kg • A square meter of snow 75cm deep weighs about 75kg • The tent is about 7.2 square meters • The snow above me weighs about 540kg

  8. Mental Arithmetic • A hard problem • (2.7m)2 75kg/m2 • Some easy problems • (3  0.9)2 = 32  0.92 = 9  .81 ~ 9  .8 = 7.2 • 7.2  75 = 720  ¾ = 3  (720 / 4) = 3  180 = 540 • Principles • Re-express to convenient units • Re-order • Algebraic identities • Memorize tables of squares and powers of two • Rounding (slide rule arithmetic) • Tastefully choosing where to round

  9. Algorithmic Qsort CPU times Strings per second Frequency of names Qsort comparison counts K-d trees CPU times of sorting String reversal Other Snow on my tent Depth of a river Cost of memory Pressure in guns Shape of Pascal’s triangle Typeface design PE FF PE PE PE PE HT FF FF FF HR FF HR Functional Form Parameter Estimation Hypothesis Test Horse Race Review of Experiments

  10. Sizes of Algorithmic Experiments • Minutes • A few CPU times • Quarter hour • A single graph, perhaps of operation counts • Hour • A directory and a few graphs • Day • A spreadsheet • Week • www.cs.amherst.edu/ccm/alglab/ • Larger • …

  11. How I Live with Tiny MSE • Outdoors • To what temperature will my gear keep me alive? Comfy? • How far can I walk in a day? How much water do I need? • Checking: news, politics, … • Automobiles: debugging, mileage, … • Weather: thunderstorms, barometers, … • Cell phone: battery life, range, • Setting the temperature on my water heater • Shopping (beware opening price points) • Emergency medicine: linear fits, functional forms, …

  12. Outline • Two Pretty Examples • Qsort, Snow • Science • A zoo of experiments: Parameter estimation, Hypothesis testing, Functional forms, Horse races • Math • Quick calculations, Rule of 72 • Engineering • Eyeball Analyses, Heuristics, Cost Models • Teaching Tiny MSE

More Related