# Calculator Programming Tutorial

## Fundamental Content

### Exercises

Traditional professional rivalry has mathematicians joking of engineers of being dull, and engineers joking of mathematicians of being unrealistic. Physicists get it from both sides, but give it back, also. There is a joke that purports to indicate whether you have a mathematical or an engineering mind set:

Problem 1: You are placed in a kitchen. In front of you are a stove, an empty pan, and a sink with running water. Your object is to boil a pan full of water. What process do you follow?

Answer to problem 1: Fill the pan with water. Put the pan and its water on a burner of the stove. Turn on the burner. Wait.

Problem 2: You are placed in a kitchen. In front of you are a stove, a pan filled with water, and a sink with running water. Your object is to boil a pan full of water. What process do you follow?

Your answer to problem 2 is the indicator. If you answered: “Put the pan and its water on a burner of the stove. Turn on the burner. Wait,” you have an engineering mind set. If you answered: “Empty the water from the pan into the sink, thereby reducing the problem to one previously solved,” you have a mathematical mind set.

Now, to keep the politics balanced, I will now tell an engineer joke. If you throw an engineer and a mathematician laterally out of an aircraft at the same time, who hits the ground first? The mathematician hits first. Why? The engineer gets lost on the way down. (Alternately, engineers can follow only after mathematicians show the way.)

So, the exercise for this section is to develop a procedure for boiling a pan full of water.

#### Part 1

Assume you are instructing an automation that understands language perfectly, but that has no idea how to perform a goal-directed action, how to reason by analogy, or of relationships between physical objects (such as controls and the controlled object). In detail, describe a procedure using the resources of a four burner stove, a one quart sauce pan, and a two basin sink with one faucet but separate hot and cold water controls to result in a pan of boiling water. You may assume the existence of a counter top, and that the locations of the requisite objects are known. Note that the initial states of the stove, the pan, the sink, and the faucet are not specified.

Hint: you will be surprised at the complexity of the process for boiling a pan of water.

#### Part 2

Did you break the dishes that were in the sink awaiting being washed? What happened to the stew simmering on the front right burner of the stove?

Did you fill the pan with water, or wet the bottom of the pan? (Did you specify motions to orient the pan appropriately under the faucet?)

Picking up the pan handle dumps the water, unless you mention to keep the pan handle horizontal and to not rotate the pan about the handle axis. Did you dump the water?

Keeping the pan horizontal while moving the pan to the stove dumps the water — at least if the pan is accelerated quickly. Did you specify a maximum lateral force on, or equivalently acceleration of, the filled pan?

Did you specify the axis and direction of rotation of all the controls, or did your automaton pry the dials off the stove?

Did you remember to turn off the water? Do you think you should? How about the burner?

Consider debugging your procedure by asking a friend to follow your procedure exactly, but give the friend the additional goal of ensuring the process does not result in a pan of boiling water. How creative is the friend in coming up with variations you did not think about in your procedure? Would you say the typical cause of not thinking about a possibility lies in an assumption of purposeful, goal-oriented behavior?

#### Part 3

Suppose you needed to add effector control, so that instead of saying “turn the knob,” you had to specify such things as ounce-inches of torque and range of motion. How do you feel about the problem now?

Suppose you needed to detect and handle exceptional conditions, such as the presence of a person blocking the automaton’s way to the stove. Assume trampling the person, crushing the person against the stove, shoving the pan through the person’s chest, incinerating the person on the stove, or otherwise harming or disturbing the person are regarded as undesirable outcomes. How do you feel about the problem now?

#### Part 4

Assume the water boiling automaton has been produced by someone else, and is great success. As a minor enhancement, marketing has a small change to the requirements, although they assure you it is “almost the same thing.” Instead of a pan of boiling water, the automaton is to produce a quart of fudge ripple ice cream. What resources will your automaton require? What modifications will you need to make to the process? What documentation do you wish the engineer who produced the water boiling automaton had left behind — other than a current telephone number?

Page last updated 30 December 2001.

# Brian’s Casio Calculator Corner

Home

Programs

Tutorial

Preface

Introduction

Fundamentals

Introduction

Process Design

Literature

Exercises

Building Blocks I

Modularization

Data Structures I

Recursion

Program Attributes

Building Blocks II

Algorithm Analysis

Structuring

Data Structures II

Abstract Types

Objects

Problem Analysis

Reference Card

References

Puzzles

Site Information