## Version 141 of Stonehenge Circle Accuracy Slot Calculator Example

Updated 2018-12-17 21:17:43 by gold

## Introduction

gold Here is an eTCL script on to estimate 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.

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)

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 doubtfull 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.

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

2900 and 2600 bc

## Testcase 2

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

quantitynumberunits
diameter75meters
pole divergence1meters

## 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.

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, http://wiki.tcl.tk/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
}```

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.

### 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: }
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
proc pi {} {expr acos(-1)}
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.
# This posting, screenshots, and TCL source code is
# 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 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 .self_help -text self_help -command { self_help }
::ttk::button .cons -text report -command { reportx }
::ttk::button .exit -text exit -command {exit}
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"```