Posted tagged ‘Algorithms’

Penny Rounding Problem

February 10, 2012

A computer rounding problem that I like to call “The Penny Rounding Problem” has been around for many, many years. At least two movies have been made with this problem a core element: The Office, and Superman III. The basic problem is that a column of numbers should add up to the total at the bottom. But they do not.

Mark Reynolds is currently at Southwestern Energy where he works in the Fayetteville Shale Drilling group as a Staff Drilling Data Analyst. In this position, he pulls his experiences in data processing, data analysis, and data presentation to improve Southwestern Energy’s work in the natural gas production and mid-stream market.

Recently, Mark has been working toward improved data collection, retention, and utilization in the real-time drilling environment.

www.ProfReynolds.com

For example: 1/3 is represented as .33, or even .333. But if you add .33 together 3 times, you get .99, not 1.00 – a penny off. This is why your final mortgage payment (if you ever actually paid it off) is never exactly the same as the monthly amount. Even worse, take 2/3 or .67. Multiple .66666… by 3 and you get 2.00; multiply .67 by 3 and you get 2.01.

Solving the problem is relatively simple, but requires diligence. Individual calculations must be individually rounded to the correct number of decimal places.

When I teach Excel at the college, I require the student to explicitly ROUND the answer to any mathematical operation involving

  1. possible sub-penny answers (divide by three, multiply by .0475, etc.)
  2. currency
  3. down-stream use of the answer.

Taken individually — addition of two numbers will never generate sub-penny digits, non-currency measurements (weight, speed, etc) do not bother people when the totals are off by small decimal fractions, and if the result to the mathematical calculation is never to be used then no one cares.

So when an interest equation is entered into Excel
= A3 * A4 / 12,
you should change it to be
= ROUND( A3 * A4 / 12, 2 ) so that the answer is rounded to 2 decimal places.

So can Richard Pryor get rich by taking all of the rounded, fractional pennies and putting them in his account? This is called Salami Slicing and snopes calls it a legend. But do gas stations do it with your pump price? read here for the answer

Advertisements

Artificial Intelligence vs Algorithms

February 9, 2012

I first considered aspects of artificial intelligence (AI) in the 1980s while working for General Dynamics as an Avionics Systems Engineer on the F-16. Over the following 3 decades, I continued to follow the concept until I made a realization – AI is just an algorithm. Certainly the goals of AI will one day be reached, but the manifestation metric of AI is not well defined.

Mark Reynolds is currently at Southwestern Energy where he works in the Fayetteville Shale Drilling group as a Staff Drilling Data Analyst. In this position, he pulls his experiences in data processing, data analysis, and data presentation to improve Southwestern Energy’s work in the natural gas production and mid-stream market.

Recently, Mark has been working toward improved data collection, retention, and utilization in the real-time drilling environment.

www.ProfReynolds.com

Consider the Denver International Airport. The baggage handling system was state of the art, touted as AI based and caused the delay of the opening by 16 months and cost $560M to fix. (more – click here) In the end, the entire system was replaced with a more stable system based not on a learning or deductive system, but upon much more basic routing and planning algorithms which may be deterministically designed and tested.

Consider the Houston traffic light system. Mayors have been elected on the promise to apply state of the art computer intelligence. Interconnected traffic lights, traffic prediction, automatic traffic redirection. Yet the AI desired results in identifiable computer algorithms with definitive behavior and expectations. Certainly an improvement, but not a thinking machine. The closest thing to automation is the remote triggering features used by the commuter rail and emergency vehicles.

So algorithms form the basis for computer advancement. And these algorithms may be applied with human interaction to learn the new lessons so necessary to achieving behavioral improvement with the computers. Toward this objective, distinct fields of study are untangling interrelated elements – clustering, neural networks, case based reasoning, and predictive analytics are just a few.

When AI can be achieved, it will be revolutionary. But until that time, deterministic algorithms, data mining, and predictive analytics will be at the core of qualitative and quantitative advancement.

Making of a Fly

February 6, 2012

While watching a TED video about algorithms, mention was made of an unrealistic price on Amazon. Apparently two retailers had an out-of-control computer feedback loop.

One company, with lots of good customer points, is in the habit of selling products a little higher than the competition. Anyone’s guess why, but facts are facts – they routinely price merchandise about 25% higher than the competition (and rely on the customer experience points to pull customers away?).

Well, the competition routinely prices merchandise a little lower than the highest priced competitor: about 1% less.

So these computer programs began a game of one-upmanship. A $10.00 product was listed for $12.70 by the first company. Later in the day, the second company’s computer listed the same product for 1% less – $12.57. So the process repeated:  $15.96 and $15.80. Then $20.07 and $1987. The process continued until the book was listed for $23,698,655.93, plus shipping. (all numbers illustrative)

This story illustrates one of the challenges to automated feedback loops. An engineering instructor once explained it – if the gain feedback is a positive value greater than 1, the feedback will either oscillate, or latch-up.

More on feedback controls for real systems another day.

Read more here: https://www.google.com/#q=making+of+a+fly


%d bloggers like this: