Stonehenge Circle Accuracy Slot Calculator Example

Stonehenge Circle Accuracy Slot Calculator 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 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 12DEC2018


Preface

gold Here are TCL calculations to estimate the Stonehenge Circle Accuracy. For the push buttons, the recommended procedure is push testcase and fill frame, change entries , push solve, and then push report. Report allows copy and paste from console.


Introduction

The accuracy of Stonehenge is essentially the delta or divergence between the poles over the line of sight distance. For a simple circle of aligned poles, the line of sight distance is treated as the diameter. Later circles or more complex monuments had added causeways to the original line of sight. So the calculator has a causeway length added, if not zero. While the testcases below are in meters, the units cancel out in the accuracy equation. So the units could entered as inches, feet, cubits, or chinese inches. This is an advantage since the units in the ancient Sumerian, Indian, and Chinese texts are open to question. Two or three angular points are needed at a minimum for the divergence, so doorways, doorposts, postholes, columns, and windows measures are usable. Note that the solar and lunar disks have an apparent diameter of 0.5 degrees, so the Stonehenge resolution or accuracy of 0.5 degrees might be expected.

 pseudocode: accuracy  =  delta (divergence)    over the line of sight distance
 pseudocode: accuracy in radians  =  atan (  delta   over the line of sight distance )
 pseudocode: accuracy in degrees = (180. degrees / pi radians)  * atan(ratio)
 pseudocode: load results into answer fields

The Stonehenge Audrey holes seem to measure 0.5 degrees. At least some stone circles have a diameter of 32 meters and appear to measure 6/360 part of the sky. Some of medicine wheels in North America have divisions of 28.


At Tiwanaku, the viewing of solar travel across the top of a wall appears to show 1/20 part of a year from station to station. In this case, the calculator shows an average travel of 5.6 degrees from station to station. While the sunsets from equinox to equinox have a nonlinear speed over a years time, it is a fascinating concept of a day to day calendar clock.


In the Kutch district of Gujarat ( India ) there are unusual earthworks which could be astronomy related. There are three ditches leading up a hillock in the shape of the Roman numeral "IV". Each ditch is roughly 100 meters long, 2 meters wide, and 2 meters deep. The ditches appear to be pointing to low areas of the sky. The surrounding area is hilly, not a plain, and it is doubtful that the local horizon would be very satisfactory. The eTCL calculator returns accuracy of 1.1 degrees, an accuracy comparable with the Chankillo Solar observatory, Peru and the Xiangfen observatory,Shanxii,China. It is known that a ruined temple and fort stood atop the hill, but further assertion of astronomy related would need more details.


Use of Global Variables in TCL GUIS


gold 12Dec2018. Global variables, regular expressions, and namespaces are considered advanced features of the Tool Control Language (TCL), according to Brent Welch in Practical Programming in TCL and TK. If global variables are an advanced feature of TCL, as indexed and taught after the beginner TCL topics in most TCL textbooks, then reasonably the use of global variables should be explored and discussed on the wiki. After a number of searches on the wiki and reference books, the topics of regular expressions and namespaces are adequately explored on the wiki and available textbooks. In opinion, the use of global variables in TCL programs should not be restricted to a narrow viewpoint, and the use of global variables could be a very rich vein of interest for the advanced student of programming. As an engineer with 35 years experience in Fortran, Basic, Javascript, and other computer languages, the author is familiar with self-appointed gatekeepers and the other anonymous ad hominem methods of NDH. NDH means “not done here”, “not done here in our shop”, or “not done here in my programming style”. Global variables in TCL are equivalent to the common variable statements in Fortran and Basic. The use of global variables might be called “sideloading" for data subroutines. Ref Fortran77, the large number crunching programs with 2E5+ statements in Fortran used global variables or common variable declarations as an alternate way or “programming style” to transfer or sideload information between subroutines. The other data transfer method for subroutines was discussed by Brent Welch etc in the proc command arguments or top loading in the introductory or beginner TCL material.


gold 12Dec2018. Of course, each alternate way of data information transfer in toploading and sideloading data subroutines has its own advantages and disadvantages. As most TCL users know, TCL tends to be a more compact language than Fortran77. However, the global declarations in the small TCL graphical user interface guis written for numerical analysis on this wiki have exactly the same common variable structure and same program organization as the giant Fortran number crunchers.


gold 12Dec2018. There are two alternate methods of loading TCL subroutines, known as proc arguments (top loading) and global variables (side loading). In engineering terms, the TCL global variable methods and the Fortran common variables are an economy of scale for large programs. In other words, top loading a data subroutine for a small program with a limited number of variables and a limited number of subroutines is about as efficient as global variables (side loading). When a large program has the number of variables approaching 25 variables and the total number of subroutines approach 20 subroutines, then global variables or common variables become an more attractive alternative data transfer between subroutines and a more efficient use of the programmer's time. This principle is independent of language type, and equally true for the TCL, Fortran, and other computer languages. For example, many Fortran programs had a specialized subroutine for constants, including the gravity constant, speed of light, etc. If the gravity constant was used in 15 subroutines, it was easier to declare the gravity constant as a common variable and make a one time change in the value of gravity constant in one subroutine of constants than making the same change in the gravity constant in 15 subroutines. If one knows than the sequence of slot variables {$side1,$side2,$side3...$side8...$side_N} and other constants are TCL global variables throughout the subroutines, one can easily refer to these global values in a specialized printout report subroutine. One can also load these global values in formulas for printout and separate calculations on the fly. For a side loading example in a new subroutine, proc newby {} {global side1 side2 side3; puts <* $side1 $side2 $side3>;return <+ $side1 $side2 $side3>}. The alternative top loading would be proc newby {side1 side2 side3} { puts <* $side1 $side2 $side3>;return <+ $side1 $side2 $side3>}. Both subroutine methods work for small TCL programs with the roughly same amount of typing. Remember in top loading, one would have to make other changes in the invoking statement or proc argument statement for the subroutine. One might point out that loading more than 25 variables in either an invoking statement or proc statement is not a trivial exercise to kept correct and cued properly. For another example, a specialized subroutine for printing out variables might use s set of global variables as proc printout {} { global side1 side2 side3; puts $side1; puts $side2; pouts <* side1 side2 side3>; puts "conversion to centimeters"; puts <* $side1_inches 2.54 >; }. A specialized printout subroutine with globals previously declared is faster in development and checking numeric formulas in experience, especially where conversion of units like inches and centimeters is useful for checking the results of the program in older textbook problems. In opinion, a set of the same global statements in numerous routines are easier to keep organized. The condition of using global variables in method is that the user understands that not all variables are invoked over all the numerous subroutines. Therefore, in the case of multiple variables > 25 and multiple subroutines >20 in a large program, changing a constant variable in a large number of subroutines, little to do in the proc argument statements and invoking the subroutines, and the availability of the global variables throughout the program means less time spent on changes for the programmer. For terms of TCL presentation on the wiki, the slot variables could be changed inside the subroutine to recognizable names in variables for the calculations and quicker comprehension of the reader. In opinion, global variables are a more efficient use of the programmers time for a quick assembly of a working gui or installing a new working subroutine in a large TCL program.


gold 12Dec2018. The author is still learning TCL. These small TCL graphical user interface guis presented in the wiki have gone through an evolution of about twenty years, including numerous unpublished Javascript and TCL guis behind a firewall before joining the wiki. The suggestions from the wiki members have been of great help and these TCL guis have continued to improve. The guis are experimental numerical analysis in nature, and not every early TCL gui or program written over the twenty year period has the same global variable features, structured programming, or beauty spots of the gui genre. The author keeps hearing that TCL is not a number crunching language or an outdated language from non-users. But in the instance of the TCL global variables, the TCL globals have the equivalence of the common statements and common variables in the data subroutines of giant Fortran number crunchers.

---

Testcases


For most numerical programs, an important work is assembling the testcases, using hand calculators and results of other computer programs. With the TCL console, it is easy enough to write little test programs or demos of the equations or algorithms used.

Testcase 1

Stonehenge phase1, Audrey holes.

quantitynumberunits
diameter114meters
pole divergence1meters
answer.009radians
answer.5degrees

2900 and 2600 bc

Testcase 2

buried Wooden circle , adjacent and possibly contemporary to Stonehenge 2.

quantitynumberunits
diameter75meters
pole divergence1meters
answer.01radians
answer.76degrees

Testcase 3

Conjectures on world wide, not many as well preserved or documented as Stonehenge.

quantity
stone circle/structurediameterunitspole separationunitsaccuracyunitswebsite
Stonehenge phase1, Audrey holes,UK114meters1meters.5degreeshttp://en.wikipedia.org/wiki/Stone_Henge
Wooden circle,Stonehengephase2,UK75meters1.meters.76degreeshttp://en.wikipedia.org/wiki/Stone_Henge
Bluehenge,UK18.2meters4.?meters12.3?degreeshttp://en.wikipedia.org/wiki/Bluestonehenge
Thornborough,UK240meters4.?meters1.?degreeshttp://en.wikipedia.org/wiki/Thornborough_Henges
Goodaver,Bodmin Moor,Cornwall32.3meters3.7meters6.53degreeshttp://en.wikipedia.org/wiki/Goodaver_stone_circle
Grey Wethers,Dartmoor32meters4.5meters8.0degreeshttp://en.wikipedia.org/wiki/Grey_Wethers
Castilerigg30meters2.35?meters4.5degreeshttp://en.wikipedia.org/wiki/Castlerigg_stone_circlehttp://
Ring of Brogar,Orkney,scotland103.7meters0.8297meters0.458degreeshttp://en.wikipedia.org/wiki/Ring_of_Brodgar
Chankillo Solar obs.,Peru235meters4.9meters1.19degreeshttp://en.wikipedia.org/wiki/Chankillo
Xiangfen,Shanxii,China60meters1.4meters1.33degreeshttp://en.wikipedia.org/wiki/Taosi
Newark Great Circle,Ohio,USA360meters4.?meters.63?degreeshttp://en.wikipedia.org/wiki/Newark_Earthworks
Hopeton Earthwork Circle,Ohio,USA320meters4.?meters.72?degreeshttp://en.wikipedia.org/wiki/Hopeton_Earthworks
Fort Center, Florida,USA362meters4.?meters.63?degreeshttp://en.wikipedia.org/wiki/Fort_Center
Rujm_el-Hiri,Israel160meters26meters9.2degreeshttp://en.wikipedia.org/wiki/Rujm_el-Hiri
Tiwanaku Calendar Stones,Bolivia, South America49.3?meters4.845meters5.6degreeshttp://en.wikipedia.org/wiki/Tiwanaku

Screenshots Section

figure 1.

Stonehenge Circle Accuracy Slot Calculator Example screen.png


Comments Section

Please place any comments here, Thanks.

Note, compare the visual style of this new page you have created to other wiki pages on this wiki. Notice how your pages are not in keeping with the high standards of formatting and presentation on the remainder of this wiki. To be a good community member, you should also strive to maintain the existing high quality standards for formatting and presentation as presented on the remainder of this wiki. To do otherwise makes yourself, and the whole wiki community, look bad.

You can read the Formatting Rules page for details on how to format your submissions, and you can look at existing page formatting for clues as to how something was done. You can even look at some of your own pages that have been reformatted to see how to make the necessary changes.

gold With respect, I have pretty printed my TCL code from the ased editor, what is free and available on the PC for a recognized TCL format. If you have got a mechanized css format like google and most editors, I'll be happy to print from that. eg. http://google-code-prettify.googlecode.com/svn/trunk/README.html http://code.google.com/chrome/devtools/docs/elements-styles.html The Ased output is at least referenced on the wiki style page, if not blessed. Ref the discussion on Tcl Style Guide.

Thank you. Your code at the bottom of this page is neatly formatted, as is your wiki page itself now, both of which are very welcome changes. A few tips:

  1. If you surround your code blocks with a pair of line containing only six equals signs ("======") with the first equals sign beginning in the very first column, the wiki will also automatically apply syntax highlighting to your code block for you.
  2. It is conventional on the Tcl'ers wiki to refer to internal wiki pages by title alone, which can be automatically made into a link by single square bracketing the title of the page, and not by placing the explicit URL into the wiki page. I.e., do this: "[Tcl Style Guide]" instead of this "Tcl Style Guide, https://wiki.tcl-lang.org/708 ".
  3. Beginning a set of lines with three spaces, an asterisk, and a space with the first space beginning in the very first column, will cause the wiki to automatically generate a bulleted list for you. In your references section such can be used to good effect to list external urls.
  4. Much of the wiki formatting commands operate by being placed at the start of a line. Take for example your "****Appendix Code****" title just below. If you edit that line to remove all of the leading spaces, then the four asterisks will function properly and produce a proper title line, rather than a fixed width font block.

One tip, when using the "======" syntax highlighting format operator, you need to put a line at both the start and at the end of the code block, i.e.:

 ======
   proc something { x } {
     set y [ process $x ]
   }
 ======

Leaving out the ending "======" causes everything to not work correctly. I added the missing "======" at the bottom of your code block below so the categories operator would format properly.

What is your purpose in binding the motion event on your main window to execute the wm title command. I.e., this line:

 bind . <Motion> {wm title . "Stonehenge Circle Accuracy Calculator "}

The result of that binding is that every time you move the mouse, the "wm title" subcommand is called repeatedly. To set the window title, you just need to call "wm title . title" once, not on every event update upon mouse pointer motion.


Some further tips:

In your initialization loop foreach i {1 2 3 4 5 6 7 8} { ... } you link your entries to variables (the "-textvariable side$i" parameter). Because of this, you could simplify both of your fillup and clearx procs into the following (assuming Tcl 8.5):

proc fillup { args } {
  lassign $args ::side1 ::side2 ::side3 ::side4 ::side5 ::side6 ::side7 ::side8
}

proc clearx { } {
  lassign [ lrepeat 8 {} ] ::side1 ::side2 ::side3 ::side4 ::side5 ::side6 ::side7 ::side8
}

Now, while this does not change the fact that side1 ... side8 are meaningless names, it does reduce the amount of duplicate code, esp. in the fillup proc. If you wanted a quick error check on fillup, you could also do this:

proc fillup { args } {
  if { [ llength $args ] != 8 } {
    error "fillup must be called with exactly eight arguments"
  }
  lassign $args ::side1 ::side2 ::side3 ::side4 ::side5 ::side6 ::side7 ::side8
}

In "calculate" you link to global variables colorwarning, colorback, answer3, side1, side2, side3, side4, side5, side6 and side7 but never make use of those variables for either reading or writing. This creates some confusion as to your intent on the part of someone else reading the proc. Did you mean to make use of them for reading/writing, and failing to read/write is an error? Or did you simply link to them unnecessarially, and so they are added noise to read past while analyzing the proc? Generally, it is best to only link to just those variables that are read/written by the procedure, as that makes your intent as author clear.

Further in "calculate", you "set answer2 5" to set the answer2 variable to 5, then immediately set answer2 to the return from circle5, which does not make use of "answer2" to calculate a result. This is at best superflourous, as setting answer2 to 5 to immediately set it to a new value makes the first set nonsense. At worse, given your use of globals for passing around data between procs, it is highly confusing because one has to go and read circle5 carefully to see if it makes use of the value of answer2 before determining that the set answer2 5 command is simply excess noise. So, if "set answer2 5" is simply noise as it seems, you should consider omitting that command, to make more clear what is happening within the proc.

Lastly in "calculate", you set answer2 to the result of circle5 then set side8 to $answer2. The set command is defined as returning the value which is placed into the variable. By making use of this definition, you could simplify those last two lines into:

  set side8 [ set answer2 [ circle5 $side8 ] ]

In your "circle5" proc, it appears that you only make use of side variables 1, 2, 3, 7 and 8. If you do not use 4, 5 and 6, you should not link to them in a "global" command because again, this creates confusion as to your intent, is the omission of use an error, or is excessive linking an error?

And lastly, your use of global variables for passing around data between your procs adds confusion, as it is not clear at the site of a call to a proc just what data it will make use of during its run. Additionally, use of globals to pass around most of your proc inputs and outputs creates many possibilities for extremely subtle bugs that are very intermittent because the results of any particular proc call will depend upon more than just its inputs. For a small program like this, the chances of this happening are very low, but if you ever start to create substantially larger programs, this habit will be an extreme detriment to keeping things working properly, and to finding the source of bugs so you can eliminate them.

While not all uses of global variables can be eliminated in all cases in Tcl (i.e., you do need "globals" for some instances of linkage to GUI element -textvariable parameters), attempting to minimize your use and reliance upon globals will be a useful habit to develop now, while you are still learning. This will mean that later, when you start to create larger projects, you will not have to unlearn bad habits, which will be much harder to accomplish at that point.

gold I'm aware that fillup and the hard-wired number of variables is not the most flexible program structure, since I'm trying to reorganize the calculator in Generic Calculator Namespace Package Example. As to some of the coding artifacts, its not unusual for me to code a constant in the early stage of the program, where some procedures are undefined, not written, or working erractically. As to globals and side$i, some of this is meant to be a convenience in programming, but I'll think about some work around. From my study of the clay tablets, the word "side" or sag in sumerian has been used in geometry problems since 1800BCE. I could put in a pop loop to assign "reality names" to the variables. #Changed: Colorwarning, colorback, answer3 are not being used and can be removed. Moved all the calculations in proc circle5 to proc calculate. Removed three empty entries and associated variables.


References:

Appendix Code

appendix TCL programs and scripts

Pretty Print VERSION


                # TCL source code follows
        # pretty print from autoindent and ased editor
        # Stonehenge Circle Accuracy equation V2
        # written on Windows XP on TCL
        # working under TCL version 8.6
        # gold on TCL Club, 12Dec2018
        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 {{} {diameter meters:} }
        lappend names {pole separation:}
        lappend names {optional: causeway length: }
        lappend names {optional: }
        lappend names {optional:}
        lappend names {optional: }
        lappend names {answer radians: }
        lappend names {answer 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 pi {} {expr acos(-1)}
        proc about {} {
            set msg "Calculator for Stonehenge Circle Accuracy
            from TCL
            # gold on TCL Club, 12Dec2018 "
            tk_messageBox -title "About" -message $msg }
        proc self_help {} {
            set msg " Stonehenge Circle Accuracy V2
            from TCL ,
            # self help listing
            # problem, Stonehenge Circle Accuracy V2
            # 3 givens follow.
            1) diameter meters:
            2) pole separation:
            3) optional causeway length:
            # Some stone circles do not have causeways
            # or any causeway for the stone circle
            # has not been defined.
            # Causeway is optional, formula will work
            # for zero causeway.
            # Solar and lunar disks have an apparent diameter
            # of 0.5 degrees, so the Stonehenge resolution
            # or accuracy  of 0.5 degrees might be expected.
            # Some ancient structures or features
            # appear to be pointed at lunar nodes,
            # so lunar astronomy is possible use also.
            # 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.
            # >>> copyright notice <<<
            # This posting, screenshots, and TCL source code is
            # copyrighted under the TCL/TK license terms.
            # Editorial rights and disclaimers
            # retained under the TCL/TK license terms
            # and will be defended as necessary in court.
            Conventional text editor formulas
            or  formulas grabbed from internet
            screens can be pasted into green console.
            # gold on  TCL Club, 12Dec2018 "
            tk_messageBox -title "Self_Help" -message $msg }
        proc calculate {     } {
            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 tanratio [expr { $side2/($side1+$side3) }]
            set acc  [ expr {   atan($tanratio) +.00000000001 } ]
            set side7 $acc
            set acc  [ expr { (180./[pi])*$acc} ]
            set side8 $acc
            return $side5
        }
        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 answer2
            global side1 side2 side3 side4 side5
            global side6 side7 side8
            global testcase_number
            global wavelength wavelength2
            global wavelength6 wavelength10
            global wavelengthsq surfacearea
            global megafrequency
            console eval {.console config -bg palegreen}
            console eval {.console config -font {fixed 20 bold}}
            console eval {wm geometry . 40x20}
            console eval {wm title . " Stonehenge Circle Accuracy V2, 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 :|diameter meters:  |   |&"
            puts "&| $side2 :|pole separation:   | |& "
            puts "&| $side3 :|optional causeway length: | |& "
            puts "&| $side4 :|optional: | |&"
            puts "&| $side5 :|optional:  | |&"
            puts "&| $side6 :|optional: |  |&"
            puts "&| $side7 :|radians: |  |&"
            puts "&| $side8 :|degrees:: |  |&"
        }
        frame .buttons -bg aquamarine4
        ::ttk::button .calculator -text "Solve" -command { set side8 0 ; calculate   }
        ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 114. 1. 0. 0. 0.  0. .008 .5 }
        ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 75.  1. 0. 0. 0.  0. .01 0.7 }
        ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 114. 1. 0. 0. 0.  0. .008 .5}
        ::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 .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  .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 . "Stonehenge Circle Accuracy V2"

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


Comments Section

Please place any comments here with your wiki MONIKER and date. Thanks, gold 12DEC2018