Updated 2017-03-12 14:06:07 by gold

Babylonian Field Expansion Procedure Algorithm and eTCL demo example calculator, numerical analysis edit

This page is under development. Comments are welcome, but please load any comments in the comments section at the bottom of the page. Please include your wiki MONIKER in your comment with the same courtesy that I will give you. Its very hard to reply intelligibly without some background of the correspondent. Thanks,gold

gold Here is some eTCL starter code for Babylonian Field Expansion Procedure Algorithm in calculator shell. Additional console program below is used to check or improve subroutine.

The Babylonian field expansion procedure algorithm from clay tablets was loaded into an eTCL calculator. The Babylonians did not use algebra notation, so the reader will have to bear some anachronisms in the eTCL pseudocode. The field expansion procedure is defined as the method used by scribes to succesively reduce or add numbers or number products by integer fractions, usually 1/60, 2/60, 3/60 et al. In modern terms, the numbers in base 60 that appeared on the tablet would be n+(1/60), n+(2/60), n+(3/60) until a desired goal for is reached. On some clay tablets to reach a desired field area of 100 square units called a iku (Akkadian for field), the succesive altered sides a*b would be (a+(1/60))*(b+(1/60)),(a2+(1/60))*(b2+(1/60))...until (a_f+(1/60))*(n_f+(1/60)) ~= 100. Allowing for some number rounding, the field expansion procedure would produce an almost square field of 100 square units. The inherent error should be less than 1/60, error <= (/ 1. 60.). The field expansion procedure can be extended to produce rectanglar fields of certain desired areas or side a/b ratios. The bare numbers on the tablets were not usually marked with units or annotated. Succesive or iterated math solutions are called algorithms and the field expansion procedure is one of the earliest algorithms documented. The TCL procedures are descendants of this idea. For restating the problem in a computer algorithm, the sides and field area will be in meters and square meters, respectively.

The reason for the field expansion procedure is not completely understood. However, there are some peg points or analogies available. The early examples of the field expansion procedure are from clay tablets of the proto-literate mathematical texts around 3000 BCE and metro-mathematical school texts from the Early Sumerian Dynastic III Period around 2500 BCE, ref Friberg. The successive addition and clay marks/counterpieces look somewhat like the pebble math problems, pebble games, or penny problems of some later cultures. Possibly, the concern with sides of 10 units and area of 100 square units may be a separate or earlier tradition than base sixty. For example, one would think that side of 12 units and area of 144 square units would track better with base 60. The almost square fields or concern with squares in some problems suggest the field expansion procedure was a method that avoided square roots or predated taking square roots.

The multiplication term 1/60 was also found in much later cuneiform tax records as the interest rate for one (lunar) month. Possible yearly tax rate was 12*(1/60) or 12/60 for a solar year or 18*(1/60) or 18/60 for a lunar calendar. The analysis is not suggesting the field expansion procedure was calculating taxes, but it is difficult to rule anything just looking at bare numbers without text explanation.

The cuneiform methods for taking areas of squares and rectangles were accurate, a*a or a*b. In those eras, the common approximate quadrilateral formula for area (a+c)*(b+d)*.25 was very inaccurate, inconsistent, and lead to unfair tax assessments. Taxes or interest were 1/60 per month or 12/60 per year of the harvest in some eras, so an accurate survey would almost pay the years taxes. There probably was some motivation to extend an accurate confirmed square area into an accurate rectanglar field vis using the inconsistent approximate quadrilateral formula. The Babylonian false position algorithm on this wiki does take a square root and may be a later development.

Depending on the settings for the correction fraction, the field expansion procedure algorithm can generate crude square roots. The accuracy of the field expansion procedure is dependent on the fineness of the intervals, which in the notation of Babylonian base 60 fractions would be 1/60/ 1/3600, or 1/216000. For square sides of 1.0001/1, desired area of 2, and correction fraction (1/60), the square root solution of 2 was 1.4, leaving off incorrect digits. For square sides of 1.0001/1, desired area of 2, and correction fraction (1/3600), the square root solution of 2 was 1.414, leaving off incorrect digits. Not sure the Babylonians and Sumerians were aware of using the field expansion procedure for obtaining square roots, but the use in the eTCL code does show the power of the field expansion procedure. At least, the Babylonians in later eras had different, faster methods, and fewer hand calculations to obtain square roots.

The first eTCL code was based on the tablet calculations and was working when solution approaches the goal from below the desired number. However, the eTCL calculator solution needs to approach correctly from either below or above the desired number goal. This routine is sort of like a double barreled Newton's method from Square Root, especially proc SqrtB. Another possible improvement for the field expansion procedure is having the slice rates or intervals proportional to the distance from the goal. In the eTCL code, distance from the goal or delta from the goal is measured by <- $goal <* $side1 $side2 1. > >. For example, if delta is less than 1/4, set the slice interval at (1/3600). If delta is greater than 1/4, set the slice interval at (1/60). Fewer computations at the higher slice rates will speed up computations and reduce wait time. Some of the Babylonian problems appeared to freeze the width of a calculated square and use a constant side a/b ratio to morph into a rectangle. Although probably not classic Field Expansion procedures, there are Babylonian math problems that increase the height of a grain bin by 1/60 or some other fraction. Meaning that modifying the Field Expansion procedure from the area a*b calculations to 3 dimensions of a*b*c or cubic equations is possible.

Rectangular Test Cases edit

Testcase 4. A rectangular field problem can be set up as follows, using modern notation. The rectangular field will have length to width ratio of 3/2 and an area of 100 square rods, rod = 6 meters. The modern notation is (1*x)*(2/3)*x=100 square rods, x*x=(3/2)*100, x=sqrt(150),x=12.24, length ~~12 rods. For the width, w=12*(2/3), 8 rods. From the easy eye calculator, the original area is <expr 12*8 > or 96 square rods. The original area is short of the goal as <expr 100-94> or 6 square rods. The eTCL calculator is loaded as 12/8/100 and the field exspansion algorithm returns length/width/area as 12.19/8.2/100.039.

Testcase 5. A rectangular field problem can be set up as follows, using modern notation. The rectangular field will have length to width ratio of 3/2 and an area of 1800 square rods, rod = 6 meters. The modern notation is (1*x)*(2/3)*x=1800 square rods, x*x=(3/2)*1800, x=sqrt(2700),x=51.961, length ~~50 rods. For the width, w=50*(2/3), 33 rods. From the easy eye calculator, the original area is <expr 50*33 > or 1650 square rods. The original area is short of the goal as <expr 1800-1650> or 150 square rods. The eTCL is loaded as 50/33/1800 and the field exspansion algorithm returns length/width/area as 50/33/1719. A second run on the eTCL calculator is loaded as 51/33/1800 and returns 51.83/33.83/1753 square units.

Testcase 6. A rectangular field problem can be set up as follows, using modern notation. The rectangular field will have length to width ratio of 3/2 and an area of 11700 square rods, rod = 6 meters. The modern notation is (1*x)*(2/3)*x=11700 square rods, x*x=(3/2)*11700, x=sqrt(17550),x=132.476, length ~~132 rods. For the width, w=132*(2/3), 88 rods. From the easy eye calculator, the original area is <expr 132*88 > or 11616 square rods. The original area is short of the goal as <expr 11700-11616> or 84 square rods. The eTCL calculator is loaded as 132/88/11700 and the field exspansion algorithm returns length/width/area as 132.38/88.38/11700.48.

Pseudocode Section edit

    # using  pseudocode for Babylonian  field expansion procedure algorithm. 
    # possible problem instances include add 1/60 to sides until area goal reached
     long_side = supplied value
     short_side  =  supplied value
     desired_goal  =  supplied value 
    # desired_goal usually 100 square units in some early math problems
     set old_field_area = a*b ,  old field_area = long_side * short_side  
     set new_side_a = long_side + 1/60
     set new_side_b = short_side + 1/60
     set new_field_area = (long_side + 1/60) * ( short_side + 1/60 )
     is  new_field_area =? desired_area within +/- (1/60) , yes = finished loop
     check error , abs (desired_goal -  new_field_area) <= [/ 1. 60.] 
     half area =  area  * .5
     quarter area = area * .25
     check_answer   new area =? desired goal , desired goal reached (yes/no)
     set answers and printout with resulting values

Testcases Section

In planning any software, it is advisable to gather a number of testcases to check the results of the program. The math for the testcases can be checked by pasting statements in the TCL console. Aside from the TCL calculator display, when one presses the report button on the calculator, one will have console show access to the capacity functions (subroutines).

Testcase 1 , almost square field

table 1printed in tcl wiki format
quantity value comment, if any
1:testcase_number
10.2 :long side meters
9.5 :short side meters
100.0 :desired area (usually 1 iku, 100 square units)
96.899 :answers: old area meters squared
0.166 :area lacking meters squared
100.211 :area from new sides meters squared
10.366 :long side meters
9.666 :short side meters

Testcase 2 , almost square field

table 2printed in tcl wiki format
quantity value comment, if any
2:testcase_number
9.599 :long side meters
9.060 :short side meters
100.0 :desired area (usually 1 iku, 100 square units)
86.975 :answers: old area meters squared
0.683 :area lacking meters squared
100.193 :area from new sides meters squared
10.283 :long side meters
9.743 :short side meters

Testcase 3 , almost square field

table 3printed in tcl wiki format
quantity value comment, if any
3:testcase_number
9.5 :long side meters
9.0 :short side meters
100.0 :desired area (usually 1 iku, 100 square units)
85.5 :answers: old area meters squared
0.7666 :area lacking meters squared
100.271 :area from new sides meters squared
10.266 :long side meters
9.766 :short side meters

Testcase 4 , rectangular field

table 4printed in tcl wiki format
quantity value comment, if any
2:testcase_number
12.0 :long side rods
8.0 :short side rods
100.0 :desired area (usually 1 iku, 100 square units)
96.0 :answers: old area rods squared
0.200 :area lacking rods squared
100.0399 :area from new sides rods squared
12.199 :long side rods
8.199 :short side rods

Testcase 5 , rectangular field

table 5printed in tcl wiki format
quantity value comment, if any
5:testcase_number
50.0 :long side rods
33.0 :short side rods
1800.0 :desired area (usually 1 iku, 100 square units)
1650.0 :answers: old area rods squared
0.833 :area lacking rods squared
1719.861 :area from new sides rods squared
50.833 :long side rods
33.833 :short side rods

Testcase 6 , rectangular field

table 6printed in tcl wiki format
quantity value comment, if any
6:testcase_number
132.0 :long side rods
88.0 :short side rods
11700.0 :desired area (usually 1 iku, 100 square units)
11616.0 :answers: old area rods squared
0.383 :area lacking rods squared
11700.480 :area from new sides rods squared
132.383 :long side rods
88.383 :short side rods

Screenshots Section

figure 1.


References:

  • A Geometric Algorithm with Solutions to Quadratic Equations
  • in a Sumerian Juridical Document from Ur III Umma
  • Joran Friberg, Chalmers University of Technology, Gothenburg, Sweden
  • google search engine <Trapezoid area bisection>
  • Wikipedia search engine <Trapezoid area >
  • mathworld.wolfram.com, Trapezoid and right trapezoid
  • Mathematical Treasure: Old Babylonian Area Calculation, uses ancient method
  • Frank J. Swetz , Pennsylvania State University
  • Wikipedia, see temple of Edfu, area method used as late as 200 BC in Egypt.
  • Oneliner's Pie in the Sky
  • One Liners
  • Category Algorithm
  • [Babylonian Number Series and eTCL demo example calculator]
  • Brahmagupta Area of Cyclic Quadrilateral and eTCL demo example calculator
  • Gauss Approximate Number of Primes and eTCL demo example calculator
  • Land surveying in ancient Mesopotamia, M. A. R. Cooper
  • [Sumerian Approximate Area Quadrilateral and eTCL Slot Calculator Demo Example , numerical analysis]
  • Thomas G. Edwards, Using the Ancient Method of False Position to Find Solutions
  • Joy B. Easton, rule of double false position
  • Vera Sanford, rule of false position
  • www.britannica.com, topic, mathematics trapezoid
  • [Sumerian Equivalency Values, Ratios, and the Law of Proportions with Demo Example Calculator]
  • Babylonian Sexagesimal Notation for Math on Clay Tablets in Console Example
  • Babylonians Tracked Jupiter With Advanced Tools: Trapezoids, Michael Greshko, news.nationalgeographic.com
  • Geometry in Babylonian Astronomy, Cluster of Excellence Topology, Humboldt University of Berlin
  • Mathieu Ossendrijver: „Ancient Babylonian astronomers calculated Jupiter’s position
  • from the area under a time-velocity graph“, in: Science, January 29, 2016.
  • Late Babylonian Field Plans in the British Museum, books.google.com/books
  • Karen Rhea Nemet-Nejat
  • Late Babylonian Surface Mensuration Author(s): Marvin A. Powell Source: jstor
  • translation: trapezoid in two babylonian astronomical cuneiform
  • texts for jupiter (act 813 & act 817) from the seleucid era , 310 BC -75 AD
  • Otto Neugebauer, Astronomical Cuneiform Texts, 3 Vols.
  • Lund Humphreys, London, 1955:405,430-31.
  • DeSegnac, MS 3908 A RE-CONSTRUCTION, D.A.R. DeSegnac
  • A draft for an essay
  • DeSegnac, MENTAL COMPUTING OF THREE ARCHAIC
  • MESOPOTAMIAN PUZZLES W 20044, 35, W 20044, 20 & W 20214, essay draft
  • DeSegnac, HARMONY OF NUMBERS I and II, D.A.R. DeSegnac, A draft for an essay

Appendix Code edit

appendix TCL programs and scripts

        # pretty print from autoindent and ased editor
        # Babylonian Field Expansion Procedure Algorithm calculator
        # written on Windows XP on eTCL
        # working under TCL version 8.5.6 and eTCL 1.0.1
        # gold on TCL WIKI, 15jan2017
        package require Tk
        package require math::numtheory
        namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory }
        set tcl_precision 17
        frame .frame -relief flat -bg aquamarine4
        pack .frame -side top -fill y -anchor center
        set names {{} { long side meters :} }
        lappend names { short side meters :}
        lappend names { desired area (usually 1 iku, 100 square units) : }
        lappend names { answers: old area meters squared : }
        lappend names { area lacking meters squared :}
        lappend names { area from new sides  meters squared: }
        lappend names { long side meters : }
        lappend names { short side meters :} 
        foreach i {1 2 3 4 5 6 7 8} {
            label .frame.label$i -text [lindex $names $i] -anchor e
            entry .frame.entry$i -width 35 -textvariable side$i
            grid .frame.label$i .frame.entry$i -sticky ew -pady 2 -padx 1 }
        proc about {} {
            set msg "Calculator for Babylonian Field Expansion Procedure Algorithm 
            from TCL WIKI,
            written on eTCL "
            tk_messageBox -title "About" -message $msg } 
       proc calculate {     } {
            global answer2
            global side1 side2 side3 side4 side5
            global side6 side7 side8 
            global testcase_number 
            incr testcase_number 
            set side1 [* $side1 1. ]
            set side2 [* $side2 1. ]
            set side3 [* $side3 1. ]
            set side4 [* $side4 1. ]
            set side5 [* $side5 1. ]
            set side6 [* $side6 1. ]
            set side7 [* $side7 1. ]
            set side8 [* $side8 1. ] 
            set true_area [* $side1 $side2 ]
            set desired_area $side3
            # initialize ancient correction fraction
            set correction_fraction [/  1. 60. ]
            set correction_fraction [* [/ [- $desired_area $true_area] $desired_area ] 5. ]
             set counter 1
             while { $counter < 50.  } {
             if { [* [+ $side1 [/ $counter 60. ]] [+ $side2 [/ $counter 60. ]]  ]  > $desired_area } {; break}           
             incr counter   
             }  
            set correction_fraction [/  $counter 60. ]
            set side4 $true_area
            set side5 $correction_fraction
            set side6 [* [+ $side1 $correction_fraction ] [+ $side2 $correction_fraction ]   ]
            set side7 [+ $side1 $correction_fraction ]
            set side8 [+ $side2 $correction_fraction ]  
                    }
        proc fillup {aa bb cc dd ee ff gg hh} {
            .frame.entry1 insert 0 "$aa"
            .frame.entry2 insert 0 "$bb"
            .frame.entry3 insert 0 "$cc"
            .frame.entry4 insert 0 "$dd"
            .frame.entry5 insert 0 "$ee"
            .frame.entry6 insert 0 "$ff" 
            .frame.entry7 insert 0 "$gg"
            .frame.entry8 insert 0 "$hh" 
             }
        proc clearx {} {
            foreach i {1 2 3 4 5 6 7 8 } {
                .frame.entry$i delete 0 end } }
        proc reportx {} {
            global side1 side2 side3 side4 side5
            global side6 side7 side8
            global testcase_number reference_factor flag
            console show;
            puts "%|table $testcase_number|printed in| tcl wiki format|% "
            puts "&| quantity| value| comment, if any|& "
            puts "&| $testcase_number:|testcase_number | |& "
            puts "&| $side1 :|long side meters |   |&"
            puts "&| $side2 :|short side meters | |& "  
            puts "&| $side3 :|desired area (usually 1 iku, 100 square units)| |& "
            puts "&| $side4 :|answers: old area meters squared| |&"
            puts "&| $side5 :|area lacking meters squared  | |&"
            puts "&| $side6 :|area from new sides  meters squared |  |&"
            puts "&| $side7 :|long side meters  |  |&"
            puts "&| $side8 :|short side meters |  |&" 
            }
        frame .buttons -bg aquamarine4
        ::ttk::button .calculator -text "Solve" -command { calculate   }
        ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 10.2  9.5  100.0 96.9  0.0166  100.2 10.2 9.51}
        ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 9.6  9.06 100. 86.9  .68  100.2 10.2 9.74 }
        ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 9.5  9.0  100.0 85.5  0.76  100.3  10.26 9.7 }
        ::ttk::button .clearallx -text clear -command {clearx }
        ::ttk::button .about -text about -command {about}
        ::ttk::button .cons -text report -command { reportx }
        ::ttk::button .exit -text exit -command {exit}
        pack .calculator  -in .buttons -side top -padx 10 -pady 5
        pack  .clearallx .cons .about .exit .test4 .test3 .test2   -side bottom -in .buttons
        grid .frame .buttons -sticky ns -pady {0 10}
               . configure -background aquamarine4 -highlightcolor brown -relief raised -border 30
        wm title . "Babylonian Field Expansion Procedure Algorithm Calculator"  

Pushbutton Operation

For the push buttons, the recommended procedure is push testcase and fill frame, change first three entries etc, push solve, and then push report. Report allows copy and paste from console.

For testcases in a computer session, the eTCL calculator increments a new testcase number internally, eg. TC(1), TC(2) , TC(3) , TC(N). The testcase number is internal to the calculator and will not be printed until the report button is pushed for the current result numbers. The current result numbers will be cleared on the next solve button. The command { calculate; reportx } or { calculate ; reportx; clearx } can be added or changed to report automatically. Another wrinkle would be to print out the current text, delimiters, and numbers in a TCL wiki style table as
  puts " %| testcase $testcase_number | value| units |comment |%"
  puts " &| volume| $volume| cubic meters |based on length $side1 and width $side2   |&"  

Console program under test.  edit

from ASK12, need help on Field Expansion subroutine

gold - 2017-01-25 On the this tcl wiki, the code in Field Expansion calculator is working when solution approachs the answer from below the desired number, but the solution needs to approach correctly from either below or above the desired number. This routine is sort of like a double barreled newton's method from Square Root, especially proc SqrtB {num} {# Newton's method}. Wrote a test console program for a field_expansion_procedure at bottom of wiki page. Can someone help or load corrected code for the console program at bottom of page. I am drawing a mental blank. Babylonian Field Expansion Procedure Algorithm and example demo eTCL calculator, numerical analysis
                  # written on Windows XP on eTCL
                  # working under TCL version 8.5.6 and eTCL 1.0.1
                  # TCL WIKI , 28jan2017
             console show
             package require math::numtheory
             namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory }
             set tcl_precision 17
             proc field_expansion_procedure_function2 { side1 side2 side3 side4 epsilon } { 
             set counter 1
             set token1 $side1
             set token2 $side2
             set saver1 .00001
             set saver2 .00001
             set epsilon [/ 1. $side4]
             while { $counter < 50.  } {
             if { [abs [- $side3 [* $token1 $token2  1. ] ] ]  < $epsilon } {break;} 
             if { [- $side3 [* $token1 $token2  1. ] ]   > 0 } {set correction_fraction [* 1. [/ 1. $side4]  ]} 
             if { [- $side3 [* $token1 $token2  1. ] ]   < 0 } {set correction_fraction [* -1. [/ 1. $side4]  ]}        
             #set correction_fraction [- $side3 [* $token1 $token2  1. ] ]
             set token1 [+ $token1 $correction_fraction ]
             set token2 [+ $token2 $correction_fraction ]  
             incr counter  
             puts "token $token1 token $token2 product [* $token1 $token2 ] correction $correction_fraction"
             }   }
             set side8 [ field_expansion_procedure_function2   9.5 9.4 100. 60. .15   ]

printout edit

token 9.9666666666666899 token 9.8666666666666902 product 98.337777777778243 correction 0.016666666666666666
token 9.9833333333333574 token 9.8833333333333577 product 98.668611111111588 correction 0.016666666666666666
token 10.000000000000025 token 9.9000000000000252 product 99.000000000000497 correction 0.016666666666666666
token 10.016666666666692 token 9.9166666666666927 product 99.331944444444957 correction 0.016666666666666666
token 10.03333333333336 token 9.9333333333333602 product 99.664444444444982 correction 0.016666666666666666
token 10.050000000000027 token 9.9500000000000277 product 99.997500000000556 correction 0.016666666666666666

crude square root of 2, to three places edit

token 1.4128777777777797 token 1.4127777777777797 product 1.9960823271604993 correction 0.00027777777777777778
token 1.4131555555555575 token 1.4130555555555575 product 1.9968673086419808 correction 0.00027777777777777778
token 1.4134333333333353 token 1.4133333333333353 product 1.9976524444444501 correction 0.00027777777777777778
token 1.4137111111111131 token 1.4136111111111131 product 1.998437734567907 correction 0.00027777777777777778
token 1.413988888888891 token 1.413888888888891 product 1.9992231790123516 correction 0.00027777777777777778
token 1.4142666666666688 token 1.4141666666666688 product 2.0000087777777837 correction 0.00027777777777777778

gold This page is copyrighted under the TCL/TK license terms, this license.

Comments Section edit

Please place any comments here, Thanks.