This page is under development. Constructive comments are welcome, but please load any constructive comments in the comments section at the bottom of the page. Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Aside from your courtesy, your wiki MONIKER and date as a signature and minimal good faith of any internet post are the rules of this TCL-WIKI. Its very hard to reply reasonably without some background of the correspondent on his WIKI bio page. Thanks, gold 08Jul2020
gold Here are some TCL calculations for.
The
From the references, .
In the
# end of file, pseudocode:
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).
The
The following scenari
The following scenario was used for the _th testcase.
The following scenario was used for the 6th testcase. There is Astrology software available to derive some testcases from modern numbers. It turns out that the year 2020 offers an interesting retrograde of Jupiter in astrology.
0 0.2 60 0.1583 120 0.0250
Table , Math Terms Associated with Babylonian Trapezoids | printed in tcl format | modern equivalent, English | comment if any | |
---|---|---|---|---|
sag ki.gu : | side earth | trapezoid | ||
sag ki.ta : | side earth its , possessive case | upper front of the trapezoid | ||
sag an.na : | side upper | upper front of the trapezoid | ||
us gi.na : | length front | true length of the trapezoid | ||
sag gi.na : | side front | true front of trapezoid | ||
N1 kus i-ku-lu : | N1 cubit in eats it (it or man), read left to right | feed parameter of the trapezoid | noun derived from Sumerian SOV phrase | |
sag du : | side | triangle | ||
N1 arakarum : | N1 multiply | transformation coefficient, usually scale up |
Note. These Math Terms cover 4 or 5 cuneiform languages, and 5000 years of history. Math Terms are best understanding of context and math connotation here,not blessed by linguists and cuneiform dictionaries.
# pretty print from autoindent and ased editor # Babylonian Astronomy Trapezoid Area V2 # written on Windows 10 on TCL # working under TCL version 8.6 # gold on TCL Club, 4Jul2020 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 {{} {side height1 , degrees per day:} } lappend names {side height2 , degrees per day:} lappend names {base line length1, days: } lappend names {base line length2, days: } lappend names { answers, bisection velocity_c degrees per day:} lappend names { bisection, half area displacement degrees:} lappend names { bisection_time_c days:} lappend names { area displacement degrees:} 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 Astronomy Trapezoid Area V2 from TCL , # gold on TCL Club, 10Jul2020 " tk_messageBox -title "About" -message $msg } proc self_help {} { set msg "Calculator for Babylonian Astronomy Trapezoid Area V2 from TCL , # self help listing # 4 givens follow. 1) side height1 , degrees per day 2) side height2 , degrees per day 3) base line length1, days 4) base line length2, days The solution from the clay tablets is genuine antique method from 1600 BCE and different looking from modern math methods. # The Babylonians did not use modern algebraic notation, # so the reader will have to bear some anachronisms in the TCL code. # Comparing conventional formula(s) for trapezoid area # to Babylonian square rule for trapezoid area. # For comparison, code will include redundant paths & formulas # to compute trapezoid area. The calculator uses modern # units for convenience to modern users and textbooks. # Any convenient and consistent in/output units might be used # like inches, feet, nindas, cubits, or dollars to donuts. # Equations 1) median = .5*(l+s) conventional 2) trapezoid area = .5*(l+s)*h conventional 3) feed = (l-s)/h trapezoid_area_sq_law 4) h = (l-s)/f trapezoid_area_sq_law 5) trapezoid area = (l**2-s**2)/(2.*feed) trapezoid_area_sq_law # Also, the B. square rule for trapezoid area # was extended to volumes by *width. 6) trapezoidal volume = .5*(l+s)*h*w conventional 7) trapezoidal volume = w*(l**2-s**2)/(2.*feed) trapezoid_area_sq_law # 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 # testcase number is internal to the calculator and # will not be printed until the report button is pushed # for the current result numbers. # This posting, screenshots, and TCL source code is # copyrighted under the TCL/TK 8.6 license terms. # Editorial rights retained under the TCL/TK license terms # and will be defended as necessary in court. 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. ] returns 120 # gold on TCL Club, 10jul2020 " tk_messageBox -title "About" -message $msg } # following proc is not used now proc trapezoid_solution { long_side short_side feed width} { global trapezoid_area height_calc feed_calc median trapezoidal_vol set median [* .5 [+ $long_side $short_side ]] set height_calc [/ [- $long_side $short_side] $feed ] set trapezoid_area [/ [- [* $long_side $long_side] [* $short_side $short_side] ] [* 2. $feed ] ] set trapezoidal_vol [* $width [/ [- [* $long_side $long_side] [* $short_side $short_side] ] [* 2. $feed ] ]] set feed_calc [ expr { ($long_side-$short_side)/ $height_calc } ] puts " check $long_side $short_side $feed height_calc= $height_calc area= $trapezoid_area feed= $feed_calc " return $trapezoid_area } 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 side5 1. set side6 1. set side7 1. set side8 1. set velocity_0 $side1 set velocity_1 $side2 set base_line [ expr { abs ( $side4 - $side3 )} ] set calculation_1 [ expr { .5 * ( $side1 + $side2 ) * 60. } ] set bisection_1 [ expr { .5 * $calculation_1 } ] set bisection_velocity_c [ expr { ((($velocity_0)**2 +($velocity_1)**2)/2.)**.5 }] set bisection_time_c [ expr { $base_line * ( $velocity_0 - $bisection_velocity_c ) / ( $velocity_0 - $velocity_1 ) }] set side5 $bisection_velocity_c set side6 $bisection_1 set side7 $bisection_time_c set side8 $calculation_1 } 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 console show; console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} console eval {wm title . " Babylonian Astronomy Trapezoid V2 Report , screen grab and paste from console 2 to texteditor"} console eval {. configure -background orange -highlightcolor brown -relief raised -border 30} puts "%|table $testcase_number|printed in| tcl format|% " puts "&| quantity| value| comment, if any|& " puts "&| $testcase_number:|testcase_number | |&" puts "&| $side1 :|side height1 , degrees per day: | |&" puts "&| $side2 :|side height2 , degrees per day: | |& " puts "&| $side3 :|base line length1, days: | |& " puts "&| $side4 :|base line length2, days: | |&" puts "&| $side5 :|answers, bisection velocity_c degrees per day:| | |&" puts "&| $side6 :|bisection, half area displacement degrees:| | |&" puts "&| $side7 :|bisection_time_c days:| | |&" puts "&| $side8 :|area displacement degrees:| | |&" } frame .buttons -bg aquamarine4 ::ttk::button .calculator -text "Solve" -command { calculate } ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 0.2 0.1583 0. 60. 0.1803 5.3745 28.2601 10.75 } ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 0.1583 0.0250 60. 120. 5.5 2.74949 20.2450 5.5 } ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 0.2 0.0250 0. 120. 0.1425 3.375 39.4135 6.75 } ::ttk::button .clearallx -text clear -command {clearx } ::ttk::button .about -text about -command {about} ::ttk::button .self_help -text self_help -command {self_help} ::ttk::button .console2 -text report -command { reportx } ::ttk::button .exit -text exit -command {exit} pack .calculator -in .buttons -side top -padx 10 -pady 5 pack .clearallx .console2 .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 Astronomy Trapezoid Area V2" # gold on TCL Club, 8Jul2020 # This posting, screenshots, and TCL source code is # copyrighted under the TCL/TK 8.6 license terms. # Editorial rights retained under the TCL/TK license terms # and will be defended as necessary in court. # end of file
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 |&"
gold - 2020-07-5
# console program written on Windows 10 # working under TCL version 8.6 # gold moniker on TCL WIKI , 7jul2020 console show package require math::numtheory namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory } set tcl_precision 17 proc expansion_procedure_2 { side1 side2 side3 side4 side5 epsilon } { set counter 1 set token1 $side1 set token2 $side2 set token3 $side3 set epsilon [/ 1. $side5] puts " %| Table of Natural Log and Round_off |% " puts " %| counter | value | rounded value | ln | round off | round off |% " while { $counter < 30. } { #if { [abs [- $side4 [* $token1 $token2 $token3 1. ] ] ] < $epsilon } {break;} #if { [- $side4 [* $token1 $token2 $token3 1. ] ] > 0 } {set correction_fraction [* 1. [/ 1. $side5] ]} #if { [- $side4 [* $token1 $token2 $token3 1. ] ] < 0 } {set correction_fraction [* -1. [/ 1. $side5] ]} #set correction_fraction [- $side3 [* $token1 $token2 1. ] ] incr counter set token1 [ expr ($token1 + .1 ) ] set token2 [ expr (log ($token1)) ] set round_off [format %7.2f $token2 ] set value_rounded [format %7.2f $token1 ] puts " &| $counter | $token1 | $value_rounded | $token2 | $round_off | $round_off |& " } } set side8 [ expansion_procedure_2 1.0 1.0 1.0 1000. 10. 1. ] # printout
# pretty print from autoindent and ased editor # Babylonian Expansion Procedure Algorithm Calculator V2 # console program written on Windows 10 # working under TCL version 8.6 # TCL WIKI , 2jul2020 console show package require math::numtheory namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory } set tcl_precision 17 proc expansion_procedure2 { side1 side2 side3 side4 side5 epsilon } { set counter 1 set token1 $side1 set token2 $side2 set token3 $side3 set saver1 .00001 set saver2 .00001 set saver3 .00001 set epsilon [/ 1. $side5] while { $counter < 1000. } { if { [abs [- $side4 [* $token1 $token2 $token3 1. ] ] ] < $epsilon } {break;} if { [- $side4 [* $token1 $token2 $token3 1. ] ] > 0 } {set correction_fraction [* 1. [/ 1. $side5] ]} if { [- $side4 [* $token1 $token2 $token3 1. ] ] < 0 } {set correction_fraction [* -1. [/ 1. $side5] ]} #set correction_fraction [- $side3 [* $token1 $token2 1. ] ] set token1 [+ $token1 $correction_fraction ] set token2 [+ $token2 $correction_fraction ] set token3 [+ $token3 $correction_fraction ] incr counter puts " &| token1 | $token1 | token2 | $token2 | token3 | $token3 | product | [* $token1 $token2 $token3 ] | correction | $correction_fraction |& " } } set side8 [ expansion_procedure_2 9.6 9.6 9.6 1000. 60. .15 ] # printout follows
Table of Natural Log and Round_off | |||||
---|---|---|---|---|---|
table | printed in | tcl wiki format | |||
quantity | value | comment, if any | |||
quantity | value | comment, if any | |||
counter | value | rounded value | ln | round off | round off |
2 | 1.1000000000000001 | 1.10 | 0.095310179804324935 | 0.10 | 0.10 |
3 | 1.2000000000000002 | 1.20 | 0.18232155679395479 | 0.18 | 0.18 |
4 | 1.3000000000000003 | 1.30 | 0.26236426446749128 | 0.26 | 0.26 |
5 | 1.4000000000000004 | 1.40 | 0.33647223662121317 | 0.34 | 0.34 |
6 | 1.5000000000000004 | 1.50 | 0.40546510810816466 | 0.41 | 0.41 |
7 | 1.6000000000000005 | 1.60 | 0.47000362924573591 | 0.47 | 0.47 |
8 | 1.7000000000000006 | 1.70 | 0.53062825106217071 | 0.53 | 0.53 |
9 | 1.8000000000000007 | 1.80 | 0.58778666490211939 | 0.59 | 0.59 |
10 | 1.9000000000000008 | 1.90 | 0.64185388617239525 | 0.64 | 0.64 |
11 | 2.0000000000000009 | 2.00 | 0.69314718055994573 | 0.69 | 0.69 |
12 | 2.100000000000001 | 2.10 | 0.74193734472937778 | 0.74 | 0.74 |
13 | 2.2000000000000011 | 2.20 | 0.78845736036427061 | 0.79 | 0.79 |
14 | 2.3000000000000012 | 2.30 | 0.83290912293510455 | 0.83 | 0.83 |
15 | 2.4000000000000012 | 2.40 | 0.87546873735390041 | 0.88 | 0.88 |
16 | 2.5000000000000013 | 2.50 | 0.91629073187415555 | 0.92 | 0.92 |
17 | 2.6000000000000014 | 2.60 | 0.9555114450274369 | 0.96 | 0.96 |
18 | 2.7000000000000015 | 2.70 | 0.993251773010284 | 0.99 | 0.99 |
19 | 2.8000000000000016 | 2.80 | 1.0296194171811588 | 1.03 | 1.03 |
20 | 2.9000000000000017 | 2.90 | 1.0647107369924289 | 1.06 | 1.06 |
21 | 3.0000000000000018 | 3.00 | 1.0986122886681102 | 1.10 | 1.10 |
22 | 3.1000000000000019 | 3.10 | 1.1314021114911013 | 1.13 | 1.13 |
23 | 3.200000000000002 | 3.20 | 1.1631508098056815 | 1.16 | 1.16 |
24 | 3.300000000000002 | 3.30 | 1.1939224684724352 | 1.19 | 1.19 |
25 | 3.4000000000000021 | 3.40 | 1.2237754316221163 | 1.22 | 1.22 |
26 | 3.5000000000000022 | 3.50 | 1.2527629684953687 | 1.25 | 1.25 |
27 | 3.6000000000000023 | 3.60 | 1.2809338454620649 | 1.28 | 1.28 |
28 | 3.7000000000000024 | 3.70 | 1.3083328196501793 | 1.31 | 1.31 |
29 | 3.8000000000000025 | 3.80 | 1.3350010667323406 | 1.34 | 1.34 |
30 | 3.9000000000000026 | 3.90 | 1.3609765531356015 | 1.36 | 1.36 |
gold This page is copyrighted under the TCL/TK license terms, this license .
Please place any comments here, Thanks.
Category Numerical Analysis | Category Toys | Category Calculator | Category Mathematics | Category Example | Toys and Games | Category Games | Category Application | Category GUI |