Using Evalf

Recall that n blocks, stacked according to our design, will extend

displaymath652

feet beyond the edge of the table. We previously calculated this value for n = 10. Let's do it again here:

EXECUTE1/2 + 1/4 + 1/6 + 1/8 + 1/10 + 1/12 + 1/14 + 1/16 + 1/18 + 1/20;

Even though this is an exact answer, what complaint might you have about it?

Click here for the answer

  As you already know, Maple always gives an exact answer, no matter how many digits are required, when all of the input values are exact integers or fractions. Fortunately, Maple provides a built-in function called evalf that will convert an exact value into a floating-point approximation. Thus, we can get a decimal approximation to the exact answer given above:

EXECUTEevalf(7381/5040);

Alternatively, we could have used evalf to obtain a floating-point approximation in the first place:

EXECUTEevalf(1/2 + 1/4 + 1/6 + 1/8 + 1/10 + 1/12 + 1/14 + 1/16 + 1/18 + 1/20);


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