## Babylonian_Brothers_Inheritance_Problems_Algorithm and TCL 8.6 demo example calculator, numerical analysis

### Preface

gold Here are some calculations for Babylonian Brothers Inheritance problems using TCL expressions.

### Introduction

In the cuneiform math problems and coefficient lists on clay tablets, there are coefficient numbers which were used in determining the amount of materials and the daily work rates of the workers. In most cases, the math problem is how the coefficient was used in estimating materials, work rates, and math problems. One difficulty is determining the effective magnitude or power of the number coefficient in the base 60 notation. In cuneiform, numbers in base 60 are written using a relative notation. For example, 20 could represent either 20*3600,20,20/60, 20/3600, or even 1/20. The basic dimensions and final tallies were presented in the cuneiform accounts on clay tablets, but some calculations, some units, and some problem answers (aw shucks!) were left off the tablet. Successive or iterated math solutions are called algorithms and the Babylonian methods are some of the earliest algorithms documented circa 1600 BCE. The TCL procedures are descendants of this idea. The Babylonians did not use algebra notation, decimal notation, or modern units, so the reader will have to bear some anachronisms in the TCL code. At least one approach for the modern reader and using modern terminology is to develop the implied algebraic equations and decimal equivalents from the cuneiform numbers. Then the TCL calculator can be run over a number of testcases to validate the algebraic equations.

### Testcases are very important in development of TCL programs.

There are differences between the TCL calculator and the Babylonian solutions. The TCL calculator has room for only 5 slots of brothers on the existing displays. Solutions for beyond 5 brothers will have to loaded on a printout as overflow. The TCL calculator seeks base_10 solutions with modern decimal fractions. It is supposed that th calculator could force an integer solution in base_10, but that might be another constraint on the solution, if solvable. The Babylonians were seeking integer solutions or integer & fraction solutions that were most compatible with base_60 fractions. The Neugebauer solution for dividing 60 among 5 brothers is the sequence of integers 4,8,12,16,20 with constant delta of integer 4. As an original translator, Neugebauer probably had the best sense of the typical solution in base_60, that the Babylonians were shooting for. However, the Neugebauer solution is believed an arithmetic sequence, rather than a geometric solution found in most of the other problems, that we know of. The relevant TCL expressions are expr {4+8+12+16+20} = 60 and expr {4./60+8./60+12./60+16./60+20./60} = 60/60 or 1.

### Alternate Solution using Modern Terms

Lets try an alternate solution to the brothers inheritance problem with modern algebra with modern decimal and percent notation. The Babylonian judge has three brothers in an estate of 60 shekels. This alternate solution starts with the elder brother. In setting up the problem, the share of the first brother is called X1 and the share of the second brother would be (1-1/N) or (1-1/3). The share of the second brother would be (1-1/3), expr { 2./3} , or factor 0.666*X1. The share of the third brother would be (1-1/N)*(1-1/N), (1-1/3)*(1-1/3), expr { (2./3)*(2./3)} , or factor 0.4444*X1. Adding the shares in X1, the equation is X1+0.6666*X1+0.4444*X1 = 60 shekels. Reduction is expr { 1+.6666+.4444} = 2.11099 , 2.11099*X = 60. So X1 = expr { 60/2.11099 } and X1 = 28.4226 for first brother share. Second brother share would be expr { 28.4226*0.6666 } or 18.9461. The third brother share would be expr { 28.4226*0.4444} or 12.6307. The percents of brothers 1,2,&3 was 47, 32, & 21 percent. The check answer was expr { 28.4226+18.9461+12.6307 } or 59.9994, rounding to 60. The average share for three brothers was expr { 60./3 } or 20, somewhat close to second brother share. The TCL calculator solution for brothers 1,2,&3 sharing 60 was entered as +60/+5/+5. Starting with the elder brother, the resulting shares were returned {list 28.4211 18.9474 12.6316}, reasonably close to the hand calculation.

An alternate solution starting with the younger brother is possible. Once again, the Babylonian judge has three brothers in an estate of 60 shekels. The younger brother share is called X3. The second brothers factor is expr { (1+1./3)}. The second brothers share is factor 1.3333*X3. The elder brothers factor is expr { (1+1./3)*(1+1./3)}. The second brothers share is factor 1.7777*X3. Adding the shares in X3, the equation is (1.+1.3333+1.7777)*X3 = 60 shekels. From expr { 1+1.3333+1.7777 } equals 4.11099, the youngest brother share is X3 = expr { 60/4.1109} or 14.5953. The second brother share is expr { 14.5953*1.3333 } equals 19.4595. The elder brother share is expr { 14.5953*1.7777 } equals 25.9465. The check answer is expr { 14.5953+19.4595+ 25.9465 } equals 60.0013. The TCL calculator solution for brothers 1,2,&3 sharing 60 was entered as +60/+5/-5. The TCL shares were returned {list 14.5945 19.4594 25.9459 }, reasonably close to the hand calculations.

### Double Portion Inheritance from the Bible

For an alternate inheritance solution, lets try the double portion inheritance method for the elder brother, mentioned in the Bible. The patriarch wishes to portion out 60 shekels to 3 brothers with the elder brother receiving a double portion. The generic formula for a portion or single share would be 1/(N+1), where N is the number of brothers. As understood here, the elder brother would receive 2/(N+1) and the younger brothers would receive 1/(N+1). Also, the formula works for one brother as the only and eldest brother would receive 2/(1+1). (2/2) reduces to one and the whole inheritance. For the three brothers, one would divide 60 by N+1, expr { 60./4 } = 15 shekels for a single share. Elder brother gets a portion of 2X or expr { 2*15 } or 30. So brothers 1,2,&3 get shares of 30,15,&15. The check answer is expr { 30+15+15} = 60. The shares of the brothers 1,2&3 are 50,25,&25 percent. In opinion, while elder brother still gets the lion's share, the Hebrew solution is more fair to the younger brothers. In the Babylonian inheritance rules, the youngest brother of a large family would get next to nothing  even if the youngest brother could figure out the math!

### Trial Solution for Real Estate

As a trial solution, looking at using the TCL calculator for developing an estate or field division solution could be expected in a sequence of brother inheritance shares in real estate. In rounded numbers, the sequence for seven brothers was { list W = 235, 210,175,140,105,70,35} as field widths dividing a triangular field using a set of constant lengths { L = kay} and dividing the front of an inheritance, ref Friberg. In other words, the seven brothers would each receive a trapezoidal or other triangular surface area bounded by W(N),W(N-1), and L. The elder and middle brothers would receive trapezoidal fields bounded by W(N),W(N-1), and L. The youngest brother would receive a triangular field bounded by W(N-6) and L. The sum of widths approximates expr { 235+210+175+140+105+70+35} = 970 units. But the total field area was not a hard number given in the original tablet, but probably 900-1200 units and compatible with common area unit of one bur.

Getting into the weeds of Babylonian units, a bur was 1800 square nindas or 64800 square cubits. A ninda was 12 cubits or 6 meters. In Babylonian math problems, the classic rectangle was 4:3 side ratio and would hold two classic triangles, which used the 3:4:5 rule for sides. For the conceptual study, a rectangular field of 2 burs could be divided into 2 triangular fields of 1 bur or 64800 square cubits. A triangular field of one bur using the classic triangle rule of 3:4:5 would be approximated by width of 312 cubits and length of 416 cubits. The initial or total estate would be triangular area equals expr { .5*312*416 } square cubits.

Continuing with the problem set up, the length or front portion of each brother would be expr { 416./7}, 59.4, or rounding to 60 cubits. Maybe a mismatch, but the calculator solution for 900 units is { list Width = 208.06 173.38, 144.49, 120.409, 100.341, 83.61, 69.68 }. Another computer run for expr {64800./60 } or 1080 units was { list Width = 233.7, 200.3, 171.7, 147.19, 126.1, 108.1, 92.69} . Remember the last width is for a right triangle (Area= 0.5*L*W) and not quite figured out how to treat a triangle in the false shares algorithm. But the Babylonian solution on the tablet is maybe 0.5*L?

### Formula Similarity to Interest Problems

The formulas in the brothers inheritance problems have some similarity to the formulas in Babylonian interest rate problems. In other words, the Babylonian formulas and TCL code could be set or morphed to generate an increase crease curve or interest rate table. Usually, the Nth share in decreasing shares is { elder brother share } * (1-1/b)**(N-1). With a different constant c, the Nth share is { elder brother share } * (1-1/c)**(N-1). For example, starting with the youngest brothers share and calculating the increase for the successive brothers in a stairstep, the Nth share in increasing shares is { youngest brother share } * (1+1/c)**(N-1). Resetting the variables for an interest rate problem, the Principal and Interest (P&I) would increase every year in the formula P&I =(1+1/c)**(N+1), where 1/c is interest factor and N is the year. For example, the Babylonian rule that silver would double in 5 years works out as P&I = expr { (1+1./5)**4 } or 2.0735, as P&I past the fourth year.

### Calculator Accuracy

The TCL calculator solution in base_10 is about +- 3 percent absolute error. That is, 3 percent difference could be expected from the available Babylonian solutions in base_60 on the clay tablets. On one Babylonian inheritance problem with a method and answers in clear cuneiform, the TCL calculator showed about 0.03 percent error from the textbook solution. So far, the majority of the problems do not show the worked methods or Babylonian answers. But the internal algorithm in the TCL calculator is on the right track. In both base_10 and base_60, there is going to be some calculation slop and rounding on multiple brothers. Remember the student is generally working either from eldest brother down or youngest brother up, so any error propagation should be in a consistent directions. From the problem setups and available problem method, the Babylonian mathematicians and students are working out solutions to four base_60 relative places. The TCL calculator solution is kept in { TCL precision 17 } to study the Babylonian algorithms, not to imply accuracy beyond 3 decimal places or accuracy beyond the numbers on the clay tablets.

### Conclusions

Modern mathematicians recognize three types of sequences as 1) arithmetic sequences of terms with a common and constant difference (a+N, b+N,c+N,d+N...), 2) geometric progression with any two terms in a constant ratio (a,a*r,a*r**2,a*r**3,a*r**4...), and 3) other sequences defined in simple or complex formulas (t(N)=(N**2)+1 or s(N)=(N**3)-1). Some math sequences are neither arithmetic sequences nor geometric progression in strict definition, but the available cuneiform tablets suggest the Late Babylonian mathematicians were familiar with all three sequence types. The brother inheritance problems are believed to represent geometric progression to solve for silver pieces or land parcels. Some terminology in the early brother inheritance problems suggest that geometric progression methods was first and early applied to land inheritances and graphical survey of triangular fields and geometric figures. Also, there are some geometry problems where brothers or soldiers were given equal portions or ladders of land from triangles, trapezoids, or other geometric figures. Possibly, the later arithmetic problems were developed or demonstrate solutions for silver pieces and unitless numbers. The exact relationship of the brother inheritance problems to Babylonian law is uncertain, but the available brother inheritance problems are recognized as more a tour de force in sequence mathematics than the law courts.

### Screenshots Section

#### figure 1. Calculator Screenshot #### figure 2. Console Screenshot ### References:

• google < Babylonian algorithm >
• Wikipedia search engine < Babylonian mathematics >
• Wikipedia search engine < multiplication algorithm >
• Wikipedia search engine < Mesopotamian units of measurements >
• Wikipedia search engine < geometric sequence >
• Wikipedia search engine < arithmatic series >
• Wolfram Alpha search engine < geometric series >

### Pseudocode & Equations Section

```        more than one formula for 1) tables and 2) calculator shell
```

## Appendix Code

### Trial GUI Shell

```        # pretty print from autoindent and ased editor
# Babylonian Brothers Inheritance Problems V2 Algorithm calculator
# written on Windows XP on TCL
# working under TCL version 8.6
# gold on TCL Club, 25Nov2018
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 {{} { initial and total estate (usually 60 shekels or 1 unit) :} }
lappend names { number of brothers (b, usually 3-11) :}
lappend names { next share fraction (usually 1-1/b, or else 1-1/c, or else 1+1/c)  : }
lappend names { answers: elder brother : }
lappend names { 2nd brother :}
lappend names { 3ird brother : }
lappend names { 4th brother : }
lappend names { 5th brother   :}
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
set msg "Babylonian Brothers Inheritance Problems Algorithm V2
from TCL
# This posting, screenshots, and TCL source code is
# Editorial rights retained under the TCL/TK license terms
# and will be defended as necessary in court."
tk_messageBox -title "About" -message \$msg }
proc self_help {} {
set msg "Babylonian Brothers Inheritance Problems V2
from TCL ,
# self help listing
# B. Inheritance  problem is using geometric progression
# or possibly arithmetic/other progression
# to calculate decreasing or increasing shares for
# brothers, using Babylonian false position algorithm.
# 3 givens follow.
1) initial and total estate or principal, usually 60 silver pieces,
1 unit, or field area.
Usually field areas were <round numbers> in Babylonian units and usage.
2) number of brothers or shares, b
3) Entry N, usually for factor {1-1/brothers} for N brothers
or else {1-1/constant} or else {1+1/constant} for alternate constant.
Usually, Nth share is { elder brother share } * (1-1/b)**(N-1).
# Some problems use alternate constant c rather than number of brothers.
Most problems go down the staircase {1-1/b} from elder,
but some problems go up the staircase using factor {1+1/b}
or {1+1/c} starting with the youngest.
# The Babylonians did not use modern algebraic notation,
percent notation, modern units, or modern terminolgy.
The interest solution from the clay tablets
is a genuine antique method from 1600 BCE
and different looking from modern math methods.
The TCL solution is adapted from the
clay tablets translated and explained by MCT,Friberg,Robson, etc.
For the modern reader and comparisons with modern formulas,
report may include percent notation, interest rate per annum,
relative error in percent, meters, square meters, and other modern terms.
The  TCL calculator solution is kept in { TCL precision 17 } to study
the  Babylonian algorithms, not to imply accuracy beyond 3 decimal places
or accuracy beyond the numbers on the clay tablets.
Similarity to Babylonian interest rate formula,
P&I =  expr (1+1/5.)**year
# down the staircase
first brother   X1
second brother factor  (1-1/N),  (1-1/3), or  factor 0.666*X1.
third brother  factor (1-1/N)*(1-1/N), (1-1/3)*(1-1/3) or factor 0.444*X1
# up the staircase
third brother X3
second brother factor  (1+1/N),  (1+1/3) or  factor 1.333*X3.
first brother  factor (1+1/N)*(1+1/N), (1+1/3)*(1+1/3) or factor 1.7777*X3
# More than 5 brothers are overflow to the display slots
# and shuffled to the report printout and list of brothers shares.
# note: positive sign for (1+1/c) has to be switched or fudged in internal code.
Answer check is sum of brother shares equals initial and total estate.
The  TCL calculator solution is kept in { TCL precision 17 } to study
the  Babylonian algorithms, not to imply accuracy beyond 3 decimal places
or accuracy beyond the numbers on the clay tablets.
Similarity to Babylonian interest rate formula,
P&I =  expr (1+1/5.)**year
However with base60 rounding and calculation slop,
differences in results between the Babylonian year
of 360 days and the modern year of 365 days are
not usually discernable.
# >>>>   Push Button Operation <<<<
# 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 to conventional texteditor. For testcases,
# the testcase number is internal to the calculator and
# will not be printed until the report button is pushed
# for the current result numbers.
# Where the program defaults are recalled,
# canvas colors/features/variables/globals/calculations/clear displays
# are reset prior to calculation  ( in push button list) .
# Buttons on the calculator are not limited to a single action procedure
# or single shot. A button command may call multiple statements and procs,
# effectively a separate program or subprogram installed as
# a list of procedures in a button. Alternately, the list of procedures
# need not be installed in a button, but in a separate procedure.
Conventional text editor formulas or  grabbed from internet
screens can be pasted into green console.
Try copy and paste following into green screen console
set answer [* 1. 2. 3. 4. 5. ] # answer returns 120
set factor2 [ expr {(1-1./3)* (1-1./3)} ] # answer 0.4444
set factor1 [ expr {(1+1./3)* (1+1./3)} ] # answer 1.7777
set factor3 [ expr {(1-1./5)**5} ]  # answer 0.32768
set factor4 [ expr {(1+1./5)**5} ]  # answer 4.21399
# gold on  TCL Club, 25nov2018 "
tk_messageBox -title "Self_Help" -message \$msg }
proc calculate {     } {
global side1 side2 side3 side4 side5
global side6 side7 side8
global testcase_number
global real_scaled_results number_of_brothers check_if_constant_steps
global average_all_brothers upper_bound lower_bound bound_constant_step
global total_false_position scale_factor
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 real_estate \$side1
set number_of_brothers \$side2
set integer_denominator2 \$side3
set result 1.
set side4 0.
set side5 0.
set side6 0.
set side7 0.
set side8 0.
#set brothers \$number_of_brothers
set decrement [/ 1. \$integer_denominator2 ]
set inheritance [** \$number_of_brothers \$number_of_brothers]
set keeper [int [- \$number_of_brothers 1] ]
set keeperlist {}
set i [int  \$number_of_brothers ]
set total_false_position 0.
while {\$i>0} {
set inheritance [- \$inheritance [* \$inheritance \$decrement]]
if { \$inheritance < 0 } { break }
#set side\$keeper \$inheritance
set keeperlist [ lappend keeperlist \$inheritance ]
set total_false_position [+ \$total_false_position \$inheritance  ]
incr i -1
}
set scale_factor [/ \$real_estate \$total_false_position ]
set counter 4
set real_scaled_results {}
foreach item \$keeperlist {
lappend real_scaled_results [* \$item \$scale_factor ]
set side\$counter [* \$item \$scale_factor ]
incr counter
if { [- \$counter 4 ] > \$number_of_brothers } {break}
}
# begin bounds and error checks
set average_all_brothers [expr \$real_estate/ \$number_of_brothers  ]
set upper_bound [+ \$average_all_brothers [* 0.5 \$average_all_brothers]]
set lower_bound [- \$average_all_brothers [* 0.5 \$average_all_brothers]]
set bound_constant_step [expr (\$real_estate/ \$number_of_brothers)/ (\$number_of_brothers-1.) ]
set check_if_constant_steps {}
set counter5 0
foreach item \$keeperlist {lappend check_if_constant_steps [- \$upper_bound [* \$counter5 \$bound_constant_step ]]
incr counter5 }
}
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
global real_scaled_results number_of_brothers check_if_constant_steps
global average_all_brothers upper_bound lower_bound bound_constant_step
global total_false_position scale_factor
console eval {.console config -bg palegreen}
console eval {.console config -font {fixed 20 bold}}
console eval {wm geometry . 40x20}
console eval {wm title . " Babylonian Brothers Inheritance Report , screen grab and paste from console 2 to texteditor"}
console eval {. configure -background orange -highlightcolor brown -relief raised -border 30}
console show;
puts "%|table \$testcase_number|printed in| tcl format|% "
puts "&| quantity| value| comment, if any|& "
puts "&| \$testcase_number:|testcase_number | |& "
puts "&| \$side1 :|initial and total estate (usually 60 shekels or 1 unit)   |   |&"
puts "&| \$side2 :|number of brothers | |& "
puts "&| \$side3 :|next share factor (usually 1-1/b, or else 1-1/c, or else 1+1/c) | |& "
puts "&| \$side4 :|answers: elder brother   | |&"
puts "&| \$side5 :|2nd brother | |&"
puts "&| \$side6 :|3ird brother |  |&"
puts "&| \$side7 :|4th brother  |  |&"
puts "&| \$side8 :|5th brother  |  |&"
puts "&| \$average_all_brothers :|for check, average_all_brothers |  |&"
puts "&| \$upper_bound  :|for check, upper_bound  |  |&"
puts "&| \$lower_bound :|for check, lower_bound  |  |&"
puts "&| \$bound_constant_step :|for check, bound_constant_step, if no 1/n less  |  |&"
puts "&| \$check_if_constant_steps :|for check, list bound_if_constant_steps, if no 1/n less  |  |&"
puts "&| \$total_false_position :|total false position |  |&"
puts "&| [* \$total_false_position \$scale_factor]:|for check, total_false_position * sf =? initial real_estate | |&"
puts "&| \$real_scaled_results :|list of scaled brother shares  |  |&"
# begin following for overflow brothers,  esp for brothers N > 5
set counter 1
if {\$number_of_brothers > 5 } {puts "&| overflow table entries |overflow brothers, esp for N > 5  |  |&"}
foreach item \$real_scaled_results {
if {\$number_of_brothers < 6 } {break}
puts "&| \$item :|\$counter nth brother  |  |&"
incr counter 1
if { \$counter > \$number_of_brothers } {break}}
# end overflow section
}
frame .buttons -bg aquamarine4
::ttk::button .calculator -text "Solve" -command { calculate   }
::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 60.   5.   5.0  17.  14.  11. 9. 7.0}
::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 120.  5.0  5.0  35.  28.  22. 18. 14.0 }
::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 3600. 5.0  5.0  1070. 856.  685. 548. 438.0 }
::ttk::button .clearallx -text clear -command {clearx }
::ttk::button .self_help -text self_help -command {self_help}
::ttk::button .cons -text report -command { reportx }
::ttk::button .exit -text exit -command {exit}
pack  .clearallx .cons .self_help .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 Brothers Inheritance Problems Algorithm V2"```