Babylonian Cubic Equation Problem and eTCL demo example calculator, numerical analysis

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


Babylonian Cubic Equation Problem and eTCL demo example calculator, numerical analysis

gold Here is some eTCL starter code for Babylonian Cubic Equation Problem.

Based on the Friberg discussion of tablet, the Babylonian algorithm for a cubic equation 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 psuedocode. The tablet has a set of line by line calculations which effectively have functions for the length, front, and depth of a room constrained and rescaled to equal the volume of a room. Taking the length, front, and depth of a room as three constrained functions in the variable a, the product of three functions scale_constant* length(a)* front(a)* depth(a) equals 1 volume unit. For restating the problem in a computer algorithm, the room dimensions will be each in cubits and the volume unit will be in volume sars, 1 volume sar = 144 cubic cubits. In the original problem, the room dimensions were given as 3 different length units and seems unnecessarily complicated. Once the problem is set up, the Babylonians had a lookup table for n*n*(n-1) to solve for the variable a. The eTCL calculator will have to use an iterative solution for the n*n*(n-1) series. The solution from the tablet was length 6, front 4, depth 6, and volume 144 cubits.

Some fragmented Babylonian tables known as n*n*(n+1) tables were used in solving some cubic equations, ref Joran Friberg. The equations were of the form n*n*(b*n+1) = c. Not sure how the algorithm could be implemented in eTCL calculator, but the eTCL calculator could generate the expected tables of n*n*(n+1).

Other Babylonian tables known as n*(n + 1)*(n + 2) and n*n*(n – 1) tables have been identified, but no abundant use has been cited from the known Babylonian math problems. Although not clear, tables of the n*(n + 1) might have existed. From modern theory, n · (n + 1)/2 = sum of integers (1,2,3,4...) and n*(n + 1)*(n + 2) /6 = sum of squares (1,4,9....). Possibly, the Seleucid math problem used an n*(n + 1)*(n + 2) table. Possibly, the tables for n*(n + 1)*(n + 2) and n*n*(n – 1) could have been used for cubic equations.


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

table 1printed in tcl wiki format
quantity value comment, if any
1:testcase_number
1.0 :length cubits
0.66600000000000004 :front cubits
0.83299999999999996 :depth cubits
1.0 :depth 2nd term cubits
144.0 :volume cubic cubits:
180 :volume limit table look up:
6 :table look up solution:
143.80804800000001 :check; product length*front*depth =? vol :
6.0 :length cubits
3.9960000000000004 :front cubits
5.9979999999999993 :depth cubits

Testcase 2

table 2printed in tcl wiki format
quantity value comment, if any
2:testcase_number
1.0 :length cubits
0.666 :front cubits
0.8329 :depth cubits
1.0 :depth 2nd term cubits
200.0 :volume cubic cubits:
294 :volume limit table look up:
7 :table look up solution:
222.922 :check; product length*front*depth =? vol :
7.0 :length cubits
4.6619 :front cubits
6.8309 :depth cubits

Testcase 3

table 3printed in tcl wiki format
quantity value comment, if any
3:testcase_number
1.0 :length cubits
0.666 :front cubits
0.8329 :depth cubits
1.0 :depth 2nd term cubits
300.0 :volume cubic cubits:
448 :volume limit table look up:
8 :table look up solution:
326.670 :check; product length*front*depth =? vol :
8.0 :length cubits
5.328 :front cubits
7.6639 :depth cubits

Screenshots Section

figure 1.

Babylonian Cubic Equation Problem and eTCL demo example calculator screenshot ---- * Oneliner's Pie in the Sky

  • One Liners
  • Category Algorithm
  • Brahmagupta Area of Cyclic Quadrilateral and eTCL demo example calculator
  • Gauss Approximate Number of Primes and eTCL demo example calculator
  • goggle "Babylonian Number cuneiform Series"
  • Oneliner's Pie in the Sky
  • One Liners
  • google < Babylonian Interest Rates Wikipedia >
  • Ancient Babylonian Algorithms, Donald E. Knuth, Stanford University
  • The oldest example of compound interest in Sumer, seventh power of four thirds (4/3)**7 , Kazuo MUROI
  • Interest, Price, and Profit: An Overview of Mathematical Economics in YBC 46981,
  • Robert Middeke-Conlin Christine Proust, CNRS and Université Paris Diderot
  • Compound Interest Doubling Time Rule: Extensions and Examples from Antiquities,
  • Saad Taha Bakir, ISSN: 2241 - 1968 (print), 2241 – 195X (online)
  • Two Sumerian Words of Fractions in Babylonian Mathematics: igi-n-gál and igi-te-en , Kazuo MUROI
  • O. Neugebauer and A. Sachs, Mathematical Cuneiform Texts, American Oriental Society, Series 29. New Haven, 1945.
  • K. Muroi, Interest Calculation in Babylonian Mathematics:
  • New Interpretations of VAT 8521 and VAT 8528, Historia Scientiarum, 39, (1990), 29-34
  • O. Nuegebauer, The Exact Sciences in Antiquity, Second edition, Dover Publication Inc., New York, 1969

References:

  • 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.
  • Square Root , Keith Vetter
  • A little slide-rule
  • What if you do not have exp()?
  • Category Algorithm
  • A Remarkable Collection of Babylonian Mathematical Texts, Joran Friberg, 2007
  • Chalmers University of Technology Gothenburg, Sweden
  • Babylonian Mathematics, cubic equations, Don Allen, Texas A&M University

Appendix Code

appendix TCL programs and scripts

        # pretty print from autoindent and ased editor
        # Babylonian Cubic Equation 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 {{} { length f(a) cubits : a*1 } }
        lappend names { front f(a) cubits :  a*(2/3)}
        lappend names { depth f(a) cubits :  a*12+1 : }
        lappend names { depth f(a), 2nd term cubits :  a*12+1 : }
        lappend names { volume cubic cubits:}
        lappend names {answers: length : }
        lappend names {front : }
        lappend names {depth :} 
        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 Cubic Equation Algorithm 
            from TCL WIKI,
            written on eTCL "
            tk_messageBox -title "About" -message $msg } 
        proc table_look_up {limit } {
             global look_up_function counter
             set counter 1
             while { $counter < 50.  } {
             set look_up_function [* $counter $counter [- $counter 1] ]
             if { [* $counter $counter [- $counter 1] ]   > [* $limit] } {return $counter ; break}            
             incr counter   
             }  
             }
       proc calculate {     } {
            global answer2
            global side1 side2 side3 side4 side5
            global side6 side7 side8
            global look_up_function counter check_product_lfd 
            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. ]
            # a*1* a*(2/3)*(a*(5/6)+1)= vol
            set a 6.
            set room_volume $side5
            set a [ table_look_up $room_volume ]
            set room_volume [expr  ($a*$side1)*($a*$side2)*($a*$side3+$side4) ]
            set length [expr  $a*$side1 ]
            set front [expr   $a*$side2 ]
            set depth [expr   $a*$side3+$side4 ]
            set check_product_lfd [* $length $front $depth 1. ]
            set side6 $length
            set side7 $front
            set side8 $depth
             }
        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 look_up_function counter check_product_lfd
            global testcase_number
            console show;
            puts "%|table $testcase_number|printed in| tcl wiki format|% "
            puts "&| quantity| value| comment, if any|& "
            puts "&| $testcase_number:|testcase_number | |&"
            puts "&| $side1 :|length cubits|   |&"
            puts "&| $side2 :|front cubits   | |& "  
            puts "&| $side3 :|depth cubits | |& "
            puts "&| $side4 :|depth 2nd term  cubits | |&"
            puts "&| $side5 :|volume cubic cubits:  | |&"
            puts "&| $look_up_function :|volume limit table look up:  | |&"
            puts "&| $counter :|table look up solution:  | |&"
            puts "&| $check_product_lfd :|check; product length*front*depth =? vol :  | |&"
            puts "&| $side6 :|length cubits |  |&"
            puts "&| $side7 :|front cubits |  |&"
            puts "&| $side8 :|depth cubits |  |&" 
            }
        frame .buttons -bg aquamarine4
        ::ttk::button .calculator -text "Solve" -command { calculate   }
        ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 1.0 0.666  0.833 1.   144.0  6. 4. 6.}
        ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 1.0 0.666  0.833 1.0  200.0  7. 4.6 6.8 }
        ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 1.0 0.666  0.833 1.0  300.0  8. 5.3 7.6 }
        ::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 Cubic Equation 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 for Square Root, based on Newton's method from Square Root

                  # autoindent from ased editor
                  # console program for babylonian algorithm for roots.
                  # combined tablet formulas and Newton's method
                  # written on Windows XP on eTCL
                  # working under TCL version 8.5.6 and eTCL 1.0.1
                  # TCL WIKI , 12dec2016             
             console show
             package require math::numtheory
             namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory }
             set tcl_precision 17
         proc square_root_function { number_for_root  } {   
             set counter 0
             set epsilon .0001
             while { $counter < 50.  } {
             if { [* $counter $counter 1. ]   > [* $number_for_root 1.] } {break}            
             incr counter 
             }   
             set  square_root_estimate $counter
             while {1} {
             set keeper $square_root_estimate        
             set starter $square_root_estimate
             set remainder   [* $starter $starter  1. ]  
             set remainder [- $number_for_root [* $starter $starter  1. ] ]
             set  square_root_estimate  [+ $starter [/ $remainder [* 2. $starter ]]]
             if {abs($keeper - $square_root_estimate) < $epsilon} break
                   }
             return $square_root_estimate
                }
             puts " square root of 2 is >>  [square_root_function 2 ] "

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

Comments Section

Please place any comments here, Thanks.