Now if I was a little mathematician that had not yet had too muchHi,
book-larning I would write down the formula for the volume and start
filling in the numbers. Make a table of the dimension x vs the
But Yehuda wanted me to use Logo. So I would write the following
simple little formula and let it do its thing. Dale
for [x 15 0] [(print :x (30-2*:x)*(30-2*:x)*:x)]
5 2000 The value of x for maximum box volume is 5.
Dale's solution is a good one, but has 3 points that can be improved:
* It goes on running even after the max point was reached;
* Most of the printed numbers are a "waste", as you use only one (pair) of them.
* The learner has to search by himself for the max among the output numbers.
The following program overcomes those inconveniences. For this he have to observe, that the maximal volume is reached, when any additional increase in x causes a decrease in the volume.
In order to make the search as fine as needed, I introduced a variable :delta. To run my solution say:
(or use some other value for :delta)
to max_vol :deltaI taught this to kids of 14 years old, with no difficulty.
for[x 0 15 :delta][
if (vol :x)>vol :x+:delta
[(pr :x vol :x) stop]]
to vol :x
Attached is a Logo graphic solution that shows clearly that the max volume is reached when x=5.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home