[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LOGO-L> Solving a Max Problem Using Logo



 
Dale R. Reed wrote:
Now if I was a little mathematician that had not yet had too much
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
volume.

But Yehuda wanted me to use Logo.  So I would write the following
simple little formula and let it do its thing.  Dale

to box
for [x 15 0] [(print :x (30-2*:x)*(30-2*:x)*:x)]
end

box

15 0
14 56
13 208
12 432
11 704
10 1000
9 1296
8 1568
7 1792
6 1944
5 2000  The value of x for maximum box volume is 5.
4 1936
3 1728
2 1352
1 784
0 0

Hi,

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:

    max_vol .1

(or use some other value for :delta)

to max_vol :delta
for[x 0 15 :delta][
   if (vol :x)>vol :x+:delta
      [(pr :x vol :x) stop]]
end

to vol :x
op(30-2*:x)*(30-2*:x)*:x
end

I taught this to kids of 14 years old, with no difficulty.

Attached is  a Logo graphic solution that shows clearly that the max volume is reached when x=5.

Regards...

[[Yehuda]

http://www.geocities.com/CollegePark/lab/2276/
e-mail: yehuka@softhome.net
 

GIF image



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