Calculator and eTCL Slot Calculator Demo Example

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


gold Here is some eTCL starter code for the length of an oil molecule. The impetus for these calculations was checking some references in Sanskrit mathematics and the Roman poet Lucretius. Most of the testcases involve experiments or models, using assumptions and rules of thumb.

The gist of the calculations is finding the height of the oil slick as the length of the oil molecule. An eye dropper is used to drop one drop of oil into a bowl of water. Since the volume of oil is known, the height of the oil slick would be volume divided by the surface area of the circular oil slick. The average length of the atoms composing the oil molecule would be the height of the oil slick divided by the number of atoms in the oil molecule (12 for olive oil).

For home experiments, obtain a centimeter ruler, eye dropper from pharmacy, cereal bowl about 15 centimeters or more in diameter, and a small bottle of oil. The home experiments reported here used olive oil, but other oils are usable. Fill the bowl with about 3/4 water at room temperature. Distilled water without chlorine is advisable, but not absolutely necessary. Place oil drop in the center of the bowl. The oil should spread out into a circle or oval and then retreat somewhat due to surface tension. Measure the diameter of the oil slick, just after the oil slick contracts due to surface tension. Just after the contraction, the molecules are shoulder to shoulder and the best orientation. In a few minutes, the oval oil slick will disperse or change into an irregular shape. For the experiments, 20 drops = 1 milliliter and 1 drop = 0.05 milliliter of oil. It is very important to try to drop the same amount each time, under the same temperature conditions. After a few trys with the eye dropper and when similar or average diameters are seen, write the oil slick diameters and temperature of the room/oil. Averaging the oil slick diameters over three or more times seemed to give the best results.

Trying to find some earlier estimates of atomic theory from other cultures. The Svetasvatara Upanisad of Vedic literature indicated an atman was one ten thousandth of the diameter of a human hair, expressed as (1/00)*(1/100). or 10-4 . A human hair averages 80 microns or 8E4 nanometers. An atman would be 8E4/1E-4 or 8 nanometers. Possibly, the Sanskrit word atman (soul particle?) was derived from atman (breath). In some Sanskrit texts, the root word ama (mother or source) was associated or used as meaning soul. Since an insulin molecule is 5 nanometers and a hemogoblin molecule is 6 nanometers, an atman of 8 nanometers compares to human molecules within an order of magnitude.

The Sumerians used oil films in bowls for divination purposes under tutoring of gods Enhil, Enki, and Ea, ref WG. Lambert (Enmeduranki,pg115) circa 2500BCE. Sumerian mathematics was quite capable enough to figure the volume of oil and the diameter of an oil slick, but there is no known text on this issue. The nearest Old Babylonian texts are coefficient lists to figure the thickness of bitumen waterproofing of floors and the thickness of orpiment paint on walls.

Early references to atomic theory in English."It is as easy to count atomies as to resolve the propositions of a lover" from Shakespeare, As You Like It, 1590 CE. This Shakespeare quote is believed to be derived from the Roman Lucretius, 20 CE. Benjamin Franklin was performing oil and oil slick experiments in 1780's France under influence of French scientists.

Pseudocode Section

    pseudocode can be developed from rules of thumb.
    pseudocode: enter rectangle length , width , penny or coin diameter
    pseudocode: output rows of N and N-1 coins, total number of coins 
    pseudocode: rules of thumb can be 3 to 15 percent off, partly since g..in g..out.
    pseudocode: need test cases > small,medium, giant
    testcases within range of expected operation.
    pseudocode: are there any cases too small or large to be solved? 

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

Testcase 1 table printed in tcl wiki format
quantity value comment, if any
testcase number 2
initial drop volume, cubic millimeters: .005
diameter oil slick centimeters: 60.
number of atoms in molecule : 12.0
answers: oil molecule height : 1.768
oil atom (average) nanometers: 0.147
oil atom (average) nanometers: 0.147
oil atom (average) nanometers : 0.147

Testcase 2

Testcase 2 table printed in tcl wiki format
quantity value comment, if any
testcase number 3
initial drop volume, cubic millimeters: .065
diameter oil slick centimeters: 220.
number of atoms in molecule : 12.0
answers: oil molecule height : 1.709
oil atom (average) nanometers: 0.142
oil atom (average) nanometers: 0.142
oil atom (average) nanometers : 0.142

Testcase 3

Testcase 3 table printed in tcl wiki format
quantity value comment, if any
testcase number 4
initial drop volume, cubic millimeters: .125
diameter oil slick centimeters: 280.
number of atoms in molecule : 12.0
answers: oil molecule height : 2.030
oil atom (average) nanometers: 0.169
oil atom (average) nanometers: 0.169
oil atom (average) nanometers : 0.169

Testcase 4

Lord Rayliegh Paper, RS.47. 1889 - 1890 table printed in tcl wiki format
quantity value comment, if any
testcase number 4
initial drop volume millimeters: .09
diameter oil slick centimeters: 83.
number of atoms in molecule : 12.0
answers: oil molecule height : 16.633
oil atom (average) nanometers: 1.386
oil atom (average) nanometers: 1.386
oil atom (average) nanometers : 1.386

Screenshots Section

figure 1.

http://s26.postimg.org/z474aewt5/oil_drop_calculator_TCL_WIKI.gif


References:

  • molecule using an oil film [L1 ]
  • Diameter of oil molecule, Worsley School
  • Atom and Atma, Sanskrit definitions and article.
  • Concepts of atom, Kanada and Pakudha Katyayana,
  • Vaisheshika was an Indian Philosophy around 600 BCE (era of Buddha)
  • Science, Medicine, Technology in Ancient India

Appendix Code

appendix TCL programs and scripts

        # pretty print from autoindent and ased editor  
        # oil molecule calculator
        # written on Windows XP on eTCL
        # working under TCL version 8.5.6 and eTCL 1.0.1
        # gold on TCL WIKI , 2may2014
        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 {{} { initial drop volume, cubic  millimeters:} }
        lappend names { diameter oil slick (average dimension) centimeters::}
        lappend names { number of atoms in molecule: }
        lappend names { answers:  oil molecule nanometers:}
        lappend names { oil atom (average) nanometers:}
        lappend names { oil atom (average) nanometers:}
        lappend names { oil atom (average) nanometers:}
        foreach i {1 2 3 4 5 6 7} {
    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 pi {} {expr acos(-1)}
        proc about {} {
            set msg "Calculator for Oil Molecules
            from TCL WIKI,
            written on eTCL "
            tk_messageBox -title "About" -message $msg }
         proc calculate { } {
            global answer2
            global side1 side2 side3 side4 side5
            global side6 side7 testcase_number 
            incr testcase_number           
            set dropvol $side1  
            set diameter_oil_slick  $side2
            set numberatoms $side3
            set height [ expr {  (4.*$side1*1E6)/([pi]*$side2*$side2)} ]
            set side4 $height
            set side5 [ expr { ($side4/$side3)} ]
            set side6 [ expr { ($side4/$side3)} ]
            set side7 [ expr { ($side4/$side3)} ] 
            return $side5
             }
        proc fillup {aa bb cc dd ee ff gg} {
            .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"}
        proc clearx {} {
            foreach i {1 2 3 4 5 6 7} {
                .frame.entry$i delete 0 end } }
        proc reportx {} {
            global side1 side2 side3 side4 side5
            global side6 side7 testcase_number
            global nonopttotal mergedx
            console show;
            puts "%| table |printed in| tcl wiki format|% "
            puts "&| quantity| value| comment, if any|& "
            puts "&| testcase number| $testcase_number||& "
            puts "&| initial drop volume millimaeters:| $side1 ||&"
            puts "&| diameter oil slick centimeters:| $side2||& "
            puts "&| number of atoms in molecule :| $side3||& "
            puts "&| answers:  oil molecule height :| $side4 ||&"
            puts "&| oil atom (average) nanometers:| $side5||& "
            puts "&| oil atom (average) nanometers:| $side6 ||&"
            puts "&| oil atom (average) nanometers :| $side7 ||&"
           }
         frame .buttons -bg aquamarine4
        ::ttk::button .calculator -text "Solve" -command { calculate   }
        ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup .005 60. 12.0  1.76  .15 .15  .15 }
        ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup .065 220. 12.0  2.0 .15 .15 .15 }
        ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup .125 280. 12.0 2. .15 .15  .15 }     
        ::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 . "Oil Molecule 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, but takes away from computer "efficiency".

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 (which 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, but is not recommended as computer efficiency is impaired. 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   |&"  


Comments Section

Please place any comments here, Thanks.