** Sumerian Seeding Rates and eTCL Slot Calculator Demo Example , 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 understandably without some background of the correspondent. Thanks,[gold] ---- <> [gold] Here **Push Button Operation** *** Pseudocode and Equations *** ====== #pseudocode can be developed from rules of thumb. #pseudocode: some problems can be solved by proportions (rule of three), to some order of magnitude #pseudocode: enter quantity1, quantity2, quantity3 and expected output (quantity4) for testcases. #pseudocode: enter time in years, number of remaining items #pseudocode: output fraction of (remaining items) over (items at time zero) #pseudocode: ouput remaining items as fraction or percent #pseudocode: output fraction of (quantity4 ) over ( quantity1 at time zero) #pseudocode: output fraction of (quantity2) * (quantity3 ) over (quantity1 at time zero) #pseudocode: outputs should be in compatible units. #pseudocode: rules of thumb can be 3 to 15 percent off, partly since g..in g..out. #pseudocode: need test cases > small,medium, giant #pseudocode: need testcases within range of expected operation. #pseudocode: are there any cases too small or large to be solved? ====== ---- ***Testcases Section*** **** Testcase 1 **** ---- **** Testcase 2 **** ---- **** Testcase 3 **** ---- ***References:*** * Introduction ---- ***Screenshots Section:*** ---- **Appendix Code** ****appendix TCL programs and scripts *** ====== # pretty print from autoindent and ased editor # Sumerian Seeding Rate Calculator # written on Windows XP on eTCL # working under TCL version 8.6.x and eTCL 1.0.1 # gold on TCL WIKI, 10nov 2014 package require Tk namespace path {::tcl::mathop ::tcl::mathfunc} frame .frame -relief flat -bg aquamarine4 pack .frame -side top -fill y -anchor center set names {{} {seed volume silas :} } lappend names {field surface area iku :} lappend names {seed density kilograms per liter :} lappend names {seed volume liters (optional):} lappend names {answers: surface area square kilometers :} lappend names {surface area hectares : } lappend names {seed silas per bur: } lappend names {seed kilograms per hectare :} 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 Sumerian Seeding Rate from TCL WIKI, written on eTCL " tk_messageBox -title "About" -message $msg } proc break_flag_routine { } { global side1 side2 side3 side4 side5 global side6 side7 side8 global spares global testcase_number set t9 $testcase_number set product_entries [* $side1 $side2 $side3 $side4 $side5 $side6 $side7 $side8] if { $product_entries < 0.0 } { puts " warning flag! negative numbers detected in product entries ref. tc$t9" } foreach item { 1 2 3 4 5 6 7 8 9 10 } { set error$item 0 } #{-?\d*(\.\d+)?} regsub -all -- {[^0-9.-]} $input "" number if { $side1 < 0.0 } { set side1 .000001 ; set error1 1 } if { $side2 < 0.0 } { set side2 .000001 ; set error1 1 } if { $side3 < 0.0 } { set side3 .000001 ; set error1 1 } if { $side4 < 0.0 } { set side4 .000001 ; set error1 1 } if { $side5 < 0.0 } { set side5 .000001 ; set error1 1 } if { $side6 < 0.0 } { set side6 .000001 ; set error1 1 } if { $side7 < 0.0 } { set side7 .000001 ; set error1 1 } if { $side8 < 0.0 } { set side8 .000001 ; set error1 1 } if { $error1 == 1 } { puts " warning flag! negative numbers detected, defaulted to positive entries ref. tc$t9" } foreach item { 1 2 3 4 5 6 7 8 9 10 } { set error$item 0 } return 1 } 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. ] break_flag_routine set barley_density 0.62 set wheat_density 0.78 set grain_density $side3 set side4 $side1 set side5 [/ [* $side2 3600. 1. ] 1E6 ] set side6 [/ [* $side2 3600. 1. ] 1E4 ] set side7 [* [/ $side1 $side2 ] 18.] #set side8 [/ [* [* [/ $side1 $side2 ] 18.] $grain_density] 1. ] set side8 [/ [* [* [/ $side1 $side2 ] 18.] $grain_density] 6.48 ] } 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; puts "%|table $testcase_number|printed in| tcl wiki format|% " puts "&| quantity| value| comment, if any|& " puts "&| testcase number:|$testcase_number | |&" puts "&| $side1 :|seed volume silas | |&" puts "&| $side2 :|field surface area iku | |& " puts "&| $side3 :|seed density kilograms per liter| |& " puts "&| $side4 :|seed volume liters | |&" puts "&| $side5 :|answers: surface area square kilometers | |&" puts "&| $side6 :|surface area hectares | |&" puts "&| $side7 :|seed silas per bur | |&" puts "&| $side8 :|seed kilograms per hectare | |&" } frame .buttons -bg aquamarine4 ::ttk::button .calculator -text "Solve" -command { calculate } ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 240.0 18.0 0.62 240.0 0.0648 6.48 240.0 22.9} ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 270.0 18.0 0.62 270.0 0.0648 6.48 270.0 25.8 } ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 360.0 18.0 0.78 360.0 0.0648 6.48 360.0 43.33 } ::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 . "Sumerian Seeding Rate Calculator" ====== ---- [gold] This page is copyrighted under the TCL/TK license terms, [http://tcl.tk/software/tcltk/license.html%|%this license]. **Comments Section** <> Please place any comments here, Thanks. <> Numerical Analysis | Toys | Calculator | Mathematics| Example