(Message hop/d:533)
/home/mjd/bin/mailpager 533
Return-Path: hop-discuss-return-516-mjd=plover.com@plover.com
Delivery-Date: Sat Dec 31 03:28:25 2005
Return-Path: <hop-discuss-return-516-mjd=plover.com@plover.com>
Delivered-To: mjd-final-delivery-1@plover.com
Received: (qmail 16916 invoked by uid 119); 31 Dec 2005 03:28:24 -0000
Delivered-To: mjd-filter-sa@plover.com
Received: (qmail 16865 invoked by uid 119); 31 Dec 2005 03:28:23 -0000
Delivered-To: mjd-filter-deliver2@plover.com
X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on plover.com
X-Spam-Level: 
X-Spam-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,NO_RELAYS 
	autolearn=unavailable version=3.1.0
Received: (qmail 16807 invoked by uid 119); 31 Dec 2005 03:28:20 -0000
Delivered-To: mjd@plover.com
Received: (qmail 16724 invoked by alias); 31 Dec 2005 03:28:15 -0000
Mailing-List: contact hop-discuss-help@plover.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:hop-discuss@plover.com>
List-Help: <mailto:hop-discuss-help@plover.com>
List-Unsubscribe: <mailto:hop-discuss-unsubscribe@plover.com>
List-Subscribe: <mailto:hop-discuss-subscribe@plover.com>
Delivered-To: mailing list hop-discuss@plover.com
Received: (qmail 16671 invoked by uid 119); 31 Dec 2005 03:28:14 -0000
Message-ID: <20051231032814.16669.qmail@plover.com>
To: Mark Jason Dominus <mjd@plover.com>
cc: hop-discuss@plover.com, mjd@plover.com
Subject: Re: Amusing applications of Linogram: 9th century Islamic estate law 
In-reply-to: Your message of "Fri, 30 Dec 2005 01:37:05 EST."
             <20051230063705.24239.qmail@plover.com> 
Date: Fri, 30 Dec 2005 22:28:14 -0500
From: Mark Jason Dominus <mjd@plover.com>


> Mark Dominus:
> > One of the types of problems that al-Khwarizmi treats extensively in
> > his book is the problem of computing inheritances under Islamic law.
> 

> Well, these examples are getting sillier and sillier, but

... but maybe they're not silly enough:

        A rope over the top of a fence has the same length on each
        side and weighs one-third of a pound per foot. On one end of
        the rope hangs a monkey holding a banana, and on the other end
        a weight equal to the weight of the monkey. The banana weighs
        2 ounces per inch. The length of the rope in feet is the same
        as the age of the monkey, and the weight of the monkey in
        ounces is as much as the age of the monkey's mother. The
        combined ages of the monkey and its mother is 30
        years. One-half the weight of the monkey plus the weight of
        the banana is one-fourth the sum of the weights of the rope
        and the weight. The monkey's mother is one-half as old as the
        monkey will be when it is three times as old as its mother was
        when she was one-half as old as the monkey will be when it is
        as old as its mother will be when she is four times as old as
        the monkey was when it was twice as old as its mother was when
        she was one-third as old as the monkey was when it was as old
        as its mother was when she was three times as old as the
        monkey was when it was one-fourth as old as its is now. How
        long is the banana?


(Spoiler solution using, guess what, Linogram....)




        define object {
          param number density;
          number length, weight;
          constraints { density * length = weight; }
          draw { &dump_all; }
        }

        object banana(density = 24/16), rope(density = 1/3);
        number monkey_age, mother_age;
        number monkey_weight, weight_weight;

        constraints { 
          monkey_weight * 16 = mother_age;
          monkey_age + mother_age = 30;
          rope.length = monkey_age;
          monkey_weight / 2 + banana.weight  = 
                1/4 * (rope.weight + weight_weight);
          mother_age = 1/2 * 3 * 1/2 * 4 * 2 * 1/3 * 3 * 1/4 * monkey_age;
          monkey_weight = weight_weight;
        }

        draw { banana; }

        __END__

        use Data::Dumper;
        sub dump_all {
          my $h = shift;
          print Dumper($h);
        }


OK, seriously, how often do you get to write a program that includes
the directive "draw { banana; }"?

The output is:

        $VAR1 = bless( {
                         'length' => '0.479166666666667',
                         'weight' => '0.71875',
                         'density' => '1.5'
                       }, 'Environment' );

So the length of the banana is 0.479166666666667 feet, which is 5.75 inches.

