## Old Babylonian Interest Rates 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,goldPage contents

gold Here is some eTCL starter code for Old Babylonian interest rates. Most of the testcases involve replicas or models, using assumptions and rules of thumb.In the cuneiform coefficient lists and literature on clay tablets, there are coefficients which were used in determining the amount of materials, the daily work rates of the workers, and some interest rates problems. In most cases, the math problem is how the coefficient was used in estimating materials and work rates. One difficulty is determining the effective power of the coefficient in base 60. 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 Sumerian accounts on clay tablets, but the calculations and some units were left off the tablet. At least one approach for the modern reader and using modern terminology is to develop the implied algebraic equations from the cuneiform numbers. Then the eTCL calculator can be run over a number of testcases to validate the algebraic equations.From the cuneiform tablets, the common interest rate for temple or institutional silver was 1/5 or 12/60 per year (360 days), and converted to decimal 0.2 or 20 percent for the calculator . The rule of thumb was for silver to double in 5 years. The common interest rate including default debt obligations for barley or grain was 1/3 or 20/60 per year (360 days), and converted to decimal 0.333 or 33 percent for the calculator. The rule of thumb was for grain at 33.3 percent interest rate to double in 2 years. In some reigns, the harvest tax was 1/2 or 50 percent per annum and possibly listed as default debt interest on the books. In modern terms, the interest rates ranged from 20 to 50 percent. The Babylonian method or "algorithm" was find the total years to double the annual sum of principal and interest, raising the exponent for years of the annual sum to approximate for double or other multiple of the annual product, and interpolate the result for the years less months to double.The Babylonians did not use interest rate in percent for their math problems, but it is worthwhile to compile some parallel results using either the rule of 70 or modern interest formulas. The rule of 70 for percent was doubling time was 70 / (interest_rate_percent). Some modern texts refereed to the rule of 72 for easier fractions. Another modern formula using natural logs was doubling_time equals ln 2 / rate_fraction or mutiples_time equals ln N1/ rate_fraction.The rule of seventy was used to check the Console Program below for Sumerian interest concepts. The Sumerian rate of 4/3 (P&I) or 33 percent per year should double in 70/20 as 3.5 years. The Sumerian rate of 6/5 (P&I) or 20 percent per year should double in 70/33 as 2.12 years.# following statements can be pasted into eTCL console set rule_70_problem [/ 70. [* 100. .20 ]] # 3.5 years for doubling amount set rule_70_problem [/ 70. [* 100. .333 ]] # 2.102 years for doubling amount set rule_70_problem [/ 70. [* 100. .50 ]] # 1.4 years for doubling amount set rule_70_problem [/ 70. [* 100. .05 ]] # 14.0 years for doubling amount set ln_rule_problem [/ [log 2. ] [* 1. .2 ] ] # 3.4657 years for doubling amount set ln_rule_problem [/ [log 4. ] [* 1. .2 ] ] # 6.931 years for 4X amount set ln_rule_problem [/ [log 2. ] [* 1. .333 ] ] # 2.0815 years for doubling amount set ln_rule_problem [/ [log 4. ] [* 1. .333 ] ] # 4.1630 years for 4X amount set sum [+ 1. 0.2 ] # answer decimal 1.2 set months [* 12. [/ [- [** 1.2 4. ] 2. ] [- [** 1.2 4. ] [** 1.2 3. ] ] ]] # 2.555 less months of 30 days set babylon_problem [** 1.2 3. ] # answer decimal 1.7279 set babylon_problem2 [** 1.20 4. ] # answer decimal 2.0736 set sumer_problem [** [/ 4. 3. ] 7. ] # answer decimal 7.49154The answer for the first testcase was between 3 years for 1.7279 factor and 4 years for 2.0736 factor, see above eTCL statements. The Babylonian solution interpolated between 3 and 4 years for the factor of 2, giving the answer in months short of 4 years.For comparison, the modern lump sum formula for 20 percent at 3.8 years gives factor 1.99. The second testcase was finding the doubling time at 33 percent interest rate. The answer for the second testcase was between 2 years for 1.7689 factor and 3 years for 2.3526 factor. The Babylonian method would interpolate between 2 and 3 years for the factor of 2, giving the answer in months short of 3 years. For comparison, the modern lump sum formula for 33 percent at 2.488 years gives factor 1.908 .The third testcase was finding the doubling time 50 percent interest rate. The answer for the third testcase was between 1 year for 1.5 factor and 2 years for 2.25 factor. The Babylonian method would interpolate between 1 and 2 years for the factor of 2, giving the answer in months short of 2 years. For comparison, the modern lump sum formula for 50 percent interest at 1.7 years gives factor 1.992 .Its clear that the Babylonian interpolation is pretty sophisticated, several rule of three trials with a single post did not give reliable estimates. eval 4.*(2./2.0736) gives 3.8580. eval 4*1.7279/2. gives 3.4558. Ref. paper of Donald Knuth.Some testcases were developed to check the lump sum formula in the eTCL calculator. For fifth testcase, the modern lump sum formula for principal of 1 and 12 percent interest at 7 years gives amount of 7.5 .For sixth testcase, the modern lump sum formula for principal of 1000 and 15 percent interest at 3 years gives amount of 1520. For seventh testcase, the modern lump sum formula for principal of 1000 and 33 percent interest at 5 years gives amount of 4208.

## Sumerian interest rate problem edit

Leaving aside the Old Babylonian era, Muroi proposed a solution to a Sumerian interest rate problem or reference to a grain loan. This discussion uses modern terms like principal, percent, and function for tutorial convenience. For the solution using normalized numbers, the principal was factored out or assigned as 1. For the first year, the total return would be $principal * (1+1/3), where 1 represents the principal and the term 1/3 represents 33 percent interest per year. The function or curve of total return would be (4/3)**N, where N is number of years. The solution for 7 years was (4/3)**N, substituting (4/3)**7 or rounded 7.5 decimal years, written as 7+30/60 years in base60 notation. Through not found in the texts, a list of (4/3)**N powers would effectively be an interest rate table.## Unusual interest rate problems, solution of the silver loan curve (6/5)**N, related? (N*1.2) multiplication table edit

Friberg and Muroi discussed tablet VAT8521 with unusual interest rate problems. The 4 problems and the solution numbers were given on the tablet VAT8521 without the Bablylonian method. The silver interest rate of (1+1/5) or (6/5) is being used to find the capital from interest amounts given as squares, cubes, and quasi-cubes. Using modern notation, these solutions can be located on the silver loan function, as (6/5)**N. These problems were probably solved as simple_interest. Possibly the (N*1.2) multiplication table is a related tablet to the silver loan curve.The formula for simple interest is simple_interest = principal *interest_rate* time_in_years, where years or intervals of time must agree. Interest rate by month or quarter year is also possible in Babylonian records. Rearranging terms, principal = simple_interest / (interest_rate* time_in_years). Also from rearrangement, (interest_rate* time_in_years) = simple_interest/ principal. In Babylonian mathematics division was handled with reciprocals, so reciprocals could either used as a look up table or taken reciprocals might appear in the tablet calculations. Switching to the reciprocation method , the formula for principal might be revised as principal = simple_interest *(1/ (interest_rate* time_in_years)). The formula for (interest_rate* time_in_years) might be revised as , (interest_rate* time_in_years) = simple_interest *(1/ principal). Also it follows that time_in_years = simple_interest *(1/ principal)*(1/interest_rate).Using modern formula notation for simple_interest and base10 conversion to solve O.B. problems on tablet VAT8521. ref Friberg for exact translation.1) interest = decimal 100, initial capital= decimal 500. principal = simple_interest *(1/ (interest_rate* time_in_years)), substituting principal = expr (100. * (1./(.2*1.))), 500. 2) interest = cube of 30, decimal 27000, principal = decimal 135000. principal = simple_interest *(1/ (interest_rate* time_in_years)) substituting principal = expr (27000. * (1./(.2*1.))), reduction principal = expr (27000. * 5. ), decimal 135000. 3) interest = square of 6, decimal 36, principal = decimal 180. principal = simple_interest *(1/ (interest_rate* time_in_years)) substituting, principal = expr (36. * (1./(.2*1.))), reduction, principal = expr (36. * 5. ), decimal 180. 4) interest = quasicube of 3, decimal 18, principal = decimal 90. principal = simple_interest *(1/ (interest_rate* time_in_years)) substituting, principal = expr (18. * (1./(.2*1.))) reduction, principal = expr (36. * 5. ), decimal 180.

## Interest rate problems developed from laws edit

5) Laws of Ur-nanna were for a loan of 1 gur =300 liters grain for one year, had interest of 1 barig 4 ban= 1*60+4*10=100 liters. Problem 2 of tablet YBC4698 had the exact same numbers. Interest treated apparently as lump sum, not exactly an interest rate as interest per time interval. interest_rate = simple_interest *(1/ principal)*(1/time_in_years) interest_rate = expr (100.*(1./300.)*(1./1.)) interest_rate = 0.33 or 100*0.33, 33 percent 6) Laws of Ur-nanna had for a loan of 10 shekels of silver, the interest for 1 year shall be 2 shekels. interest_rate = simple_interest *(1/ principal)*(1/time_in_years) interest_rate = expr (2.*(1./10.)*(1./1.)) interest_rate = 0.20 or 100*0.20, 20 percent 7) Problem 1 of tablet YBC4698l had loan of 1 gur =300 liters grain for one year, had interest of 1 barig = 1*60 =60 liters. Ref. Middeke-Conlin and Proust interest_rate = simple_interest *(1/ principal)*(1/time_in_years) interest_rate = expr (60.*(1./300.)*(1./1.)) interest_rate = 0.20 or 100*0.20, 20 percent

## Multiplication tablets possibly related? to O.B. interest rates, esp. reciprocal pairs (1_12 and 50) edit

The multiplication tablet MS3866 contains a multiplication of 1_12 (base60) for numbers 1 through 23 and has the multiplication (square) of 1_12*1_12, ending at midtablet on the obverse. Since the number sequence ends at midtablet and not with the tablet broken off, the analysis can be sure the sequence is complete and ends with a square at the end. The term ara (trans. area, multiply area, or multiply step) is used for each of the 23 multiplication operations and also for the square expression. Reading a lot into bare numbers, but 1 to 23 could be interpreted as the factor for either 23 years or 24 months. The square 1_12*1_12 could be interpreted as the factor for a silver loan of two years or 24 months, (1+1/5)**2. Referencing the early Sumerian period, the tribute of military clans was on a lunar calendar or 18 month basis, so possibly an interest table of return by month would make more sense than yearly interest. Also for the common man or overseer in Sumerian times, laws and court decisions rarely reference more than one year loans ... inferring a loan ( of seed grain or other ) was repaid in kind or on the books from the coming or next harvest. The number is 1_12 in base sixty, but is equivalent to (1+12/60), (1+1/5), or decimal 1.2. The reciprocal is 1/1.2 or decimal 0.8333 which had alternate expressions in base60 notation as 50/60, special fraction 5/6, or 5. The numbers 1_12 and "50" are reciprocal pairs. Multiplication tables for "5" and "50" have been found, ref CMT. This tablet might be associate to the factor (interest_rate* time_in_years). Maybe numerical coincidence, but the expression year(N)*(6/5)*(1/2) was a partial linear piece fit to the curve (6/5)**N. A table of the reciprocals for (1/ (interest_rate* time_in_years)) would be useful to a Babylonian scribe. However, one can have the evidence of this tablet MS3866, but the use of this tablet as an interest table or interest rate calculations is not proved. Additional Ref Ni2739, possible 1_12? in multiplication table from Nippur (Neugebauer, MKT 1 (1935).In some scribal traditions and not very consistent, the last calculation on a math table or math problem tablet was an error check and contained the known solution to the problem. If one argues that the solution on tablet MS3866 is decimal 1.2**2, 1.44, or 2 years of compound interest, then the "multiplication step table" of 1_12 multiplication should lead to that conclusion. Given the best documentation from the other tablet ( involving interpolation of powers of 2), then the bare numeric solution to the problem (1.44) lies between line 1 of 1.2 and line 2 of 2.4. In other terms, the numeric solution is (1.44-1.2/(2.4-1.2), reduction (.24/1.2), decimal 0.2 or 12/60 past line one. Kind of a circular argument, but possibly narrowing down the purpose of the tablet MS3866. A fudge formula was found that the formula Year*(6/5)*(1/2), Year*(6/10), or Year*(36/60) is a linear fit to the exponential (6/5)**N over about the first ten years. The Babylonian reciprocal would be 60/36 or 1+40/60.# using pseudocode # possible problem instances # alternate solution seek doubling time in years for 20 percent per year, meaning 1.2 for P&I 360 days in year might be an issue??? 4.*(2./2.0736) = 3.858 years rule of 70 approx. 70/20 or 3.5 years log solution, y = [/ [log 2. ] [log 1.2]] 3.8017840169239308 years [* 2. [/ [ * 1.2 1.2 1.2 1.2 ] [* 1.2 1.2 1.2 ] ]] = 2.4 [** 1.2 1.] = 1.2 [** 1.2 2.] = 1.44 [** 1.2 3.] = 1.7279 [** 1.2 4.] = 2.0736 scribe answer interpolate between expr 1. + 43./60.+ 40./3600. decimal 1.727777777777777 expr 2. + 4./60.+ 25./3600. decimal 2.073611111111111 to find 3+47/60+ 13/3600+ 20/216000 decimal 3.787 [+ 3. [/ [- 2. [ ** 1.2 3. ] ] [- [** 1.2 4. ] [ ** 1.2 3. ]]]] decimal 3.787037037037037 years ---- seek doubling time in years for 33 percent per year, meaning 1.33 for P&I 3.*(2./2.37037)= 2.531 years log solution, y = [/ [log 2. ] [log [+ 1 [/ 1. 3.]]]] 2.4094208396532095 years rule of 70 approx. 70/33 or 2.12 years [** [+ 1. [/ 1. 3.]] 1.] =1.3333333333333333 [** [+ 1. [/ 1. 3.]] 2.] =1.7777777777777777 [** [+ 1. [/ 1. 3.]] 3.] =2.37037037037037 [** [+ 1. [/ 1. 3.]] 4.] =3.160493827160493 [** [+ 1. [/ 1. 3.]] 5.] =4.213991769547324 [** [+ 1. [/ 1. 3.]] 6.] =5.618655692729765 [** [+ 1. [/ 1. 3.]] 7.] =7.491540923639686 [** [+ 1. [/ 1. 3.]] 8.] =9.98872123151958 seek Muroi solution of P&I*N of 7.5 with solution of 7 years 8*(7.5/8)=7.5 ???? 8*(7.5/9.98)= 6.012 ???? 7*(6/5.6)= 7.5 7.5*(5.6/6)= 7 years 7 years over 7.5 P&I result is 5.6 result over 6 years xxx years over 7.5 P&I result is 5.6 result over 6 years log solution, y = [/ [log 7.5 ] [log [+ 1 [/ 1. 3.]]]] 7.003922779651095 years inverse proportions here # testing powers of 16 [** 16. [/ 1. 1.] ] = 16.0 [** 16. [/ 1. 2.] ] = 4.0 [** 16. [/ 1. 4.] ] = 2.0 [** 16. [/ 1. 8.] ] = 1.4142135623730951 [** 16. [/ 1. 16.] ] = 1.189207115002721 possibly 16**N used in quad., weight riddles, or interest problems but not sure how ??? There is B. table of this. how many years for x rate to double , log solution, y = [/ [log 2. ] [log [+ 1 [/ 1. 3.]]]] how many years for x rate to 4x, log solution, y = [/ [log 4. ] [log [+ 1 [/ 1. 3.]]]] how many years for x rate to 8x, log solution, y = [/ [log 8. ] [log [+ 1 [/ 1. 3.]]]] how many years for x rate to 16x, log solution, y = [/ [log 16. ] [log [+ 1 [/ 1. 3.]]]]In modern terms, loans of silver at 16.666 percent and 25 percent have been reported in Late Babylon. 16.666 percent was equivalent to factors in base60 as (1+10/60) and (1+1/6) and reciprocal 6. 25 percent was equivalent to factors in base60 as (1+15/60) and (1+1/4) and reciprocal 4. The factor (1+15/60) and 48 is the reciprocal pair related to the 48 multiplication table. The factor 1_20 (1+20/60) and 45 is the reciprocal pair related to the 45 multiplication table. Silver loans were reported at 6.25 percent. 0.0625= (1+ 3/60+45/3600) or rounded 4/60. Reciprocal pairs are 1_4 or (1+4/60), and 56+15/60.The cuneiform records used several forms for the multiplication operation in the interest rate problems. Not sure about the connotation of these multiplication terms, but the math texts use at least 4 different terms for multiplication, aside from the various languages. The terms ana (multiply addition) and ara (multiply area or multiply step) were used in interest rate problems. Multiplication by reciprocal is called "raising" and raise was used in the interest rate problems. The term ib_si was used to raise number to a power, but was also used in tables of squares and cubes. Although the use of ib_si for exponents was rare in the extant problems and tables, the cuneiform term ib_si is a math operation like a two way street, either raising a number to a power or effectively taking the logarithm. For example, 4 2 ib_si 16 or 16 (30/60) ib_si 4. The term sutakiilum (Lkti/l.kti.kti) (multiply holding or multiply slant) was also present. The hand tablets used in the schools were Sumerian IM.SU (literally mud in hand) or Akkadian imsukkum, ref Fowler and Robson. Imsukkum also means chamber pot in Akkadian. The term an has been handed down as Anna , Ann, or Dana, personal name and goddess of plenty. The term area (eng.) is derived from the term "ara", Sumerian for multiplication.The term ara was used on the multiplication tables, so maybe ara has connotation of table lookup? The term sutakkile means literally hold in hand. The connotation of sutakkile was saving a number either as counting token, memory or scrap tablet, as moderns might say, carry over a number or remember for next calculation.

### 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 1 | printed in | tcl wiki format |
---|---|---|

quantity | value | comment, if any |

testcase number: | 1 | |

1.0 : | principal | |

0.20 : | interest rate decimal fraction | |

2.0 : | doubling coefficient | |

4.0 : | optional putative number of years | |

1.2 : | annual principal times interest rate | |

2.0 : | doubling coefficient | |

4 : | years of 360 days | |

2.55 : | less months of 30 days | |

3.787: | years from 4-(2.555/12.) |

#### Testcase 2

table 2 | printed in | tcl wiki format |
---|---|---|

quantity | value | comment, if any |

testcase number: | 2 | |

1.0 : | principal | |

0.333 : | interest rate decimal fraction | |

2.0 : | doubling coefficient | |

3.0 : | optional putative number of years | |

1.333 : | answers: annual principal plus interest amount | |

2.0 : | doubling coefficient | |

3 : | years of 360 days | |

7.47 : | less months of 30 days | |

2.3775 : | years from 3-(7.47/12.) |

#### Testcase 33

table 3 | printed in | tcl wiki format |
---|---|---|

quantity | value | comment, if any |

testcase number: | 3 | |

1.0 : | principal | |

0.5 : | interest rate decimal fraction | |

2.0 : | doubling coefficient | |

2.0 : | optional putative number of years | |

1.5 : | answers: annual principal plus interest amount | |

2.0 : | doubling coefficient | |

2 : | years of 360 days | |

4. : | less months of 30 days | |

1.66: | years from 2-(4./12.) |

### Screenshots Section

#### figure 1.

#### figure 2.

#### figure 3.

#### figure 4.Solution for small fry, silver loans from 1 to 10 years

#### figure 5.Silver loans detail

#### figure 6.Linear piece fit of year(N)*(6/5)*(1/2) to Silver loan curve (6/5)**N

#### figure 7. Silver loans high scale

### References:

- 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 Proﬁt: 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
- Robert Middeke-Conlin & Christine Proust,Cuneiform Digital Library Journal 2014:3
- Interest, Price, and Proﬁt: An Overview of Mathematical Economics in YBC 46981,
- The old Babylonian loan contract: its history and geography, Aaron Jacob Skaist,
- Bar-Ilan University Press, 1994
- Why the "Miracle of Compound Interest" leads to Financial Crises, by Michael Hudson
- Have we caught your interest?, by John H. Webb
- Exponential growth, doubling time, and the Rule of 70
- Colorado Alliance for Immigration Reform
- Montelle C. (2009) MLC 2078 and the History of the Mathematical Table.
- Adelaide, Australia: Australian Mathematical Society, 1 Sep 2009 (Conference)
- The powers of 9 and related mathematical tables from Babylon,
- Mathieu Ossendrijver (Humboldt University, Berlin)
- Mesopotamia, interest rate problem, Rosa Jiménez Iraundegui , Spanish Ministry of Education. Year 2001

## Appendix Code edit

### appendix TCL programs and scripts

# pretty print from autoindent and ased editor # Old Babylonian Interest Rates calculator # written on Windows XP on eTCL # working under TCL version 8.5.6 and eTCL 1.0.1 # gold on TCL WIKI, 15dec2016 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 {{} {principal :} } lappend names {interest rate per annum, decimal fraction :} lappend names {doubling coeff. : } lappend names {optional, years :} lappend names {answers: principal plus interest :} lappend names {doubling coeff: } lappend names {years total: } lappend names {less months:} 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 Old Babylonian Interest Rates from TCL WIKI, written on eTCL " tk_messageBox -title "About" -message $msg } proc double_function { principle doubling_coeff } { set term_years 0 set counter 0 while { $counter < 50. } { set term_years $counter if { [** $principle $term_years ] > $doubling_coeff } {break} incr counter } return $term_years } proc calculate { } { global answer2 global side1 side2 side3 side4 side5 global side6 side7 side8 global modern_formula_lump 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 principal $side1 set interest $side2 set optional_years $side4 set doubling_coeff $side3 set n [+ $principal [* $principal $interest ] ] set rate .2 set solve_years [double_function $n $doubling_coeff ] set solve_years_minus1 [- $solve_years 1 ] #set months [expr 12*((1+$rate)**($n-2))/((1+$rate)**$n-(1+$rate)**($n-1))] #set months [* 12. [/ [- [** $n 4. ] 2. ] [- [** $n 4. ] [** $n 3. ] ] ]] set months [* 12. [/ [- [** $n $solve_years ] 2. ] [- [** $n $solve_years ] [** $n $solve_years_minus1 ] ] ]] set modern_formula_lump [* $principal [** [+ 1. $interest] $optional_years ] ] set side5 $n set side6 $doubling_coeff set side7 $solve_years set side8 $months } 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 switch_factor global modern_formula_lump 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 :|principal| |&" puts "&| $side2 :|interest rate decimal fraction | |& " puts "&| $side3 :|doubling coefficient | |& " puts "&| $side4 :|optional number of years for lump sum| |&" puts "&| $modern_formula_lump :|modern formula lump sum| |&" puts "&| $side5 :|answers: annual principal plus interest amount | |&" puts "&| $side6 :|doubling coefficient | |&" puts "&| $side7 :|years of 360 days | |&" puts "&| $side8 :|less months of 30 days | |&" } frame .buttons -bg aquamarine4 ::ttk::button .calculator -text "Solve" -command { calculate } ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 1.0 0.2 2.0 4.0 1.22 2.0 2.50 2.5} ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 1.0 0.333 2.0 3.0 1.33 2.0 3.00 7.5 } ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 1.0 0.5 2.0 2.0 1.33 2.0 2.00 4.0 } ::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 . "Old Babylonian Interest Rates 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 asputs " %| testcase $testcase_number | value| units |comment |%" puts " &| volume| $volume| cubic meters |based on length $side1 and width $side2 |&"

### Console Program for Sumerian interest concept, modern notation

# pretty print from autoindent and ased editor # trial Sumerian interest concept, modern notation # working under TCL version 8.5.6 and eTCL 1.0.1 # console program written on Windows XP on eTCL # gold on TCL WIKI, 2Mar2017 package require Tk console show package require math::numtheory namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory } set tcl_precision 17 console show proc ::tcl::mathfunc::precision {precision float} { # tcl:wiki:Floating-point formatting, [AM] set x [ expr {round( 10 ** $precision * $float) / (10.0 ** $precision)} ] # rounded or clipped to nearest 5ird significant figure set x [ format "%#.5g" $x ] return $x } puts "%|table for trial Sumerian interest concept, modern notation |||printed in| tcl wiki format|% " puts "&| nth year | mixed p&i w/ base60 fraction |decimal p&i rounded 5th significant |decimal carried significant figures | comment, if any|& " set counter 1 set i 2000 set ticker 1 while {$i>0} { if { $ticker > 20 } { break } set trial [ expr { rand() } ] set yearly_amount [expr { (4./3.)**$counter } ] set yearly_rnd_amount [::tcl::mathfunc::precision 5 $yearly_amount ] set sixty_fraction [round [* 60. [- $yearly_rnd_amount [int $yearly_rnd_amount ]]]] set sixty_fractionx [int $yearly_rnd_amount ] puts "&| $ticker year :|$sixty_fractionx ; $sixty_fraction| $yearly_rnd_amount| $yearly_amount | |& " incr counter incr ticker incr i -1 } #end of file

## Table for Sumerian interest concept (4/3), modern notation of 33 percent per year edit

table for trial Sumerian interest concept, modern notation | p&i = (4/3)**N | p&i = (4/3)**N | printed in tcl wiki format | |
---|---|---|---|---|

nth year | mixed p&i w/ base60 fraction | decimal p&i rounded 5th significant | decimal p&i carried significant figures | comment, if any |

1 year : | 1 ; 20 | 1.3333 | 1.3333333333333333 | principal=1, return = 1+ (1/3) |

2 year : | 1 ; 47 | 1.7778 | 1.7777777777777777 | |

3 year : | 2 ; 22 | 2.3704 | 2.3703703703703698 | return doubles between year 2 and year 3 |

4 year : | 3 ; 10 | 3.1605 | 3.1604938271604932 | |

5 year : | 4 ; 13 | 4.2140 | 4.2139917695473237 | |

6 year : | 5 ; 37 | 5.6187 | 5.6186556927297646 | |

7 year : | 7 ; 30 | 7.4915 | 7.4915409236396862 | Muroi solution at 7 years |

8 year : | 9 ; 59 | 9.9887 | 9.9887212315195804 | |

9 year : | 13 ; 19 | 13.318 | 13.318294975359441 | |

10 year : | 17 ; 45 | 17.758 | 17.757726633812588 | |

11 year : | 23 ; 41 | 23.677 | 23.676968845083447 | |

12 year : | 31 ; 34 | 31.569 | 31.569291793444595 | |

13 year : | 42 ; 6 | 42.092 | 42.092389057926127 | |

14 year : | 56 ; 7 | 56.123 | 56.123185410568162 | |

15 year : | 74 ; 50 | 74.831 | 74.830913880757549 | |

16 year : | 99 ; 47 | 99.775 | 99.774551841010052 | |

17 year : | 133 ; 2 | 133.03 | 133.03273578801341 | |

18 year : | 177 ; 23 | 177.38 | 177.37698105068452 | |

19 year : | 236 ; 30 | 236.50 | 236.50264140091269 | |

20 year : | 315 ; 20 | 315.34 | 315.33685520121691 |

## Table for Sumerian interest concept (6/5), modern notation of 20 percent per year edit

table for trial Sumerian interest concept (6/5), modern notation | p&i = (6/5)**N | p&i = (6/5)**N | printed in tcl wiki format | |
---|---|---|---|---|

nth year | mixed p&i w/ base60 fraction | decimal p&i rounded 5th significant | decimal carried significant figures | comment, if any |

1 year : | 1 ; 12 | 1.2000 | 1.2 | principal=1, return = 1+(1/5) |

2 year : | 1 ; 26 | 1.4400 | 1.4399999999999999 | |

3 year : | 1 ; 44 | 1.7280 | 1.7279999999999998 | |

4 year : | 2 ; 4 | 2.0736 | 2.0735999999999999 | return doubles between year 3 and year 4 |

5 year : | 2 ; 29 | 2.4883 | 2.4883199999999994 | |

6 year : | 2 ; 59 | 2.9860 | 2.9859839999999993 | |

7 year : | 3 ; 35 | 3.5832 | 3.5831807999999992 | |

8 year : | 4 ; 18 | 4.2998 | 4.2998169599999985 | |

9 year : | 5 ; 10 | 5.1598 | 5.1597803519999985 | |

10 year : | 6 ; 12 | 6.1917 | 6.1917364223999973 | |

11 year : | 7 ; 26 | 7.4301 | 7.430083706879997 | |

12 year : | 8 ; 55 | 8.9161 | 8.916100448255996 | |

13 year : | 10 ; 42 | 10.699 | 10.699320537907195 | |

14 year : | 12 ; 50 | 12.839 | 12.839184645488633 | |

15 year : | 15 ; 24 | 15.407 | 15.407021574586359 | |

16 year : | 18 ; 29 | 18.488 | 18.488425889503631 | |

17 year : | 22 ; 11 | 22.186 | 22.186111067404354 | |

18 year : | 26 ; 37 | 26.623 | 26.623333280885227 | |

19 year : | 31 ; 57 | 31.948 | 31.947999937062271 | |

20 year : | 38 ; 20 | 38.338 | 38.337599924474723 |

test. 70/20 as 3.5 years , 70/(1/5)= 70(100/5)=3.5

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

## Comments Section edit

Please place any comments here, Thanks.