Assignment

When Maple computes an answer, it prints it out on the screen and then goes on to the next question. Often we would like to save an answer and use it later. Maple provides assignment as a way of doing this.

For example, you have already computed the surface area of the earth at least three times. Let's do the computation again, but this time let's save the result:

EXECUTE areaSqMi := 4 * 3.14 * 4000.^2;

The := symbol is called the assignment operator, and serves to associate a value with a variable. The variable areaSqMi now stands for the area of the earth's surface in square miles. (It is a good idea to choose descriptive names to make it easier to remember what they stand for.) We can use our new variable just like any other number. For example, we can easily determine its value:

EXECUTE areaSqMi;

When we started this problem, we were interested in computing area in units of square feet. Can you figure out how to assign the total surface area of the earth, expressed in square feet, to the symbol areaSqFt? (There are 5280 feet in a mile.)

Click here for the answer

So the earth's surface is 5,602,443,264,000,000 square feet!

We can now calculate the number of square feet per person by dividing areaSqFt by the earth's population, which is approximately 5.5 billion.

EXECUTE areaSqFt / 5.5 * 10^9;

This calculation tells us that every person has 1,018,626,048,000,000,000,000,000 square feet. That sure seems like plenty of elbow room--what do you think?


Joseph L. Zachary
Hamlet Project
Department of Computer Science
University of Utah