***Modeling Planetary Distances using Titius-Bode Law and and TCL demo example calculator, 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 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] 20Aug2020 ---- <> ***Preface*** [gold] 20aug2020 Here are some calculations ---- ***Introduction*** Here are TCL calculations on the equation converting Note. This field is rapidly changing, one needs to check in at for the latest up to date info. ---- ---- ***References:*** ---- * Wikipedia search engine < diabetes > * Wikipedia search engine < Richard K. Bernstein > * Wikipedia search engine < Programming Examples > * Google search engine < vaporware > ---- ---- ****Appendix TCL programs and scripts **** **** Pretty Print Version*** ---- ====== ;# pretty print from autoindent and ased editor occurrence ;# Planetary Distances Using Titius-Bodes Law V2 calculator ;# written on Windows 10 ;# working under TCL version 8.6 ;# gold on TCL Club, 10jul2021 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 {{} { method number, 1 = Bode :} } lappend names {reference year CE: } lappend names {answers: Mercury : } lappend names { Venus : } lappend names { Earth : } lappend names { Mars : } lappend names { Jupiter : } lappend names { Saturn : } lappend names { Uranus : } foreach i {1 2 3 4 5 6 7 8 9} { 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 Planetary Distances Using Titius-Bodes Law V2 from TCL WIKI, written on TCL 8.6 " tk_messageBox -title "About" -message $msg } proc self_help {} { set msg "Calculator for Planetary Distances Using Titius-Bodes Law V2 from TCL , ;# self help listing ;# 1 given follow. 1) method N1 2) Reference year ;# This calculator uses the Titius-Bodes Law ;# to predict Planetary Distances in AU. ;# For comparison, TCL code may include redundant paths & formulas. ;# The TCL calculator normally 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. ;# 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. ;# Use one line errorx proc to estimate percent errors. ;# errorx proc is used in the report window (console). ;# Additional significant figures are used to check ;# the TCL program, not to infer the accuracy ;# of inputs and product reports. Conventional text editor formulas or grabbed from internet screens can be pasted into green report console. Try copy and paste following into green screen console set answer \[* 1. 2. 3. 4. 5. \] returns 120 ;# gold on TCL Club, 10jul2021 " tk_messageBox -title "self_help" -message $msg } proc precisionx {precision float} { ;# tcl:wiki:Floating-point formatting, ;# select numbers only, not used on every number. set x [ expr {round( 10 ** $precision * $float) / (10.0 ** $precision)} ] ;# rounded or clipped to nearest 5ird significant figure set x [ format "%#.3g" $x ] return $x } ;# Use one line errorx proc to estimate percent errors ;# errorx proc is used in the report window (console) proc errorx {aa bb} {expr { $aa > $bb ? (($aa*1.)/$bb -1.)*100. : (($bb*1.)/$aa -1.)*100.}} proc titius_bode_law {aa } {expr { (4. + 3 * 2**$aa)*.1 } } proc calculate { } { global answer2 global side1 side2 side3 side4 side5 global side6 side7 side8 side9 k1 global side10 side11 side12 side13 global testcase_number incr testcase_number ;# scaling constant K1 set k1 55.8 set side3 [precisionx 2 [ titius_bode_law -1]] set side4 [precisionx 2 [ titius_bode_law 0]] set side5 [precisionx 2 [ titius_bode_law 1]] set side6 [precisionx 2 [ titius_bode_law 2]] set side7 [precisionx 2 [ titius_bode_law 4]] set side8 [precisionx 2 [ titius_bode_law 5]] set side9 [precisionx 2 [ titius_bode_law 6]] set side10 [precisionx 2 [ titius_bode_law 7]] ;# Neptune set side11 [precisionx 2 [ titius_bode_law 8]] ;# Pluto set side12 [precisionx 2 [ titius_bode_law 9]] ;# extra Bode slot, unk planet? set side13 [precisionx 2 [ titius_bode_law 3]] ;# Ceres set scaled_results [list 0.000001 $side1 $side3 $side4 $side5 $side6 $side7 $side8 $side9 $side10] puts " scaled_results $scaled_results " } proc fillup {aa bb cc dd ee ff gg hh ii} { .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" .frame.entry9 insert 0 "$ii" } proc clearx {} { foreach i {1 2 3 4 5 6 7 8 9 } { .frame.entry$i delete 0 end } } proc reportx {} { global side1 side2 side3 side4 side5 global side6 side7 side8 side9 k1 global side10 side11 side12 side13 global testcase_number console show; puts "%|table $testcase_number| || printed in tcl wiki format|% " puts "&| $testcase_number:|testcase_number || |&" puts "&| $side1 :|method number, 1 = Bode | | |&" puts "&| $side2 :|reference year CE : | | |& " puts "&| value AU |quantity |distance E6 km | comment, if any|& " puts "&| $side3 :| Mercury : |[* $side3 $k1 ] | |& " puts "&| $side4 :| Venus : |[* $side4 $k1 ] | |& " puts "&| $side5 :| Earth : |[* $side5 $k1 ] | |&" puts "&| $side6 :| Mars : |[* $side6 $k1 ] | |&" puts "&| $side7 :| Jupiter : : |[* $side7 $k1 ] | |&" puts "&| $side8 :| Saturn : | [* $side8 $k1 ]| |&" puts "&| $side9 :| Uranus : | [* $side9 $k1 ] | |&" puts "&| $side10 :| Neptune : | [* $side10 $k1 ] | |&" puts "&| $side11 :| PLuto : | [* $side11 $k1 ] | |&" puts "&| $side12 :| extra slot, unk planet? : | [* $side12 $k1 ] | |&" puts "&| $side13 :| Ceres : | [* $side13 $k1 ] | |&" } frame .buttons -bg aquamarine4 ::ttk::button .calculator -text "Solve" -command { calculate } ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 1. 1772. 0.40 0.70 1.0 1.6 5.2 10. 19.6} ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 1. 1772. 0.40 0.70 1.0 1.6 5.2 10. 19.6} ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 1. 1772. 0.40 0.70 1.0 1.6 5.2 10. 19.6} ::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 . " Planetary Distances Using Titius-Bodes Law V2" # end of working deck # add cosmetics below to bottom of file console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} console eval {wm title . " Report for Planetary Distances Using Titius-Bodes Law V2 "} console eval {. configure -background orange -highlightcolor brown -relief raised -border 30} puts " Console wrapper for solution proc" puts " ***************************" puts " ***************************" ====== ---- **Hidden Comments Section** <> Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Thanks, [gold] 20Jul2021 ---- <> Numerical Analysis | Toys | Calculator | Mathematics| Example| Toys and Games | Games | Application | GUI ---- <> Development | Concept| Algorithm |