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 12AUG2020

- User Page for Gold
- Introduction and Greetings
- Revamped Projects under Nikit, actions post 1Dec2018
- Projects under old wiki
- Projects to be updated
- Philosophy On One Liners Programs from One Liners Programs Compendium
- Reposted Tips from AMG & GWM & Wiki for One Liners Programs
- Flexible Push Button Operation in TCL calculator
- 2021 Newsflash, TCLLIB has twin primes and cousin primes routines in TCLLIB:math ticket pipeline
- Use of Global Variables in TCL GUIS
- Maybe partially solved, trouble accessing the TCL WIKI from USA on some restaurant WIFI's?
- Possible Bias of base 2 and 3 in near field?
- Subroutine Template
- sqrt_sum_of_squares
- output for sqrt_sum_of_squares
- Modify discrete events on tugboats_tester3
- Equivalent One Liners V2
- Timing Equivalent One Liners V2
- Table of Timing 4 Procs
- bits and pieces, Testing One Liner Programs
- One Liners from www.codecodex.com/wiki
- Testing One Liner Program for list_twin_primes V2
- Table Results on Twin Primes for 2,4,6,10 Separators
- Older TCL4 reserve
- Sample of TCL One Liner Procedures V2
- Draft Wikipedia article on One Liners Programs , TCL Tool Control Language
- CREDITS ON ONE LINERS
- Appendix: One Liner Procs for Modeling Planetary Distances using Titius-Bode Law and other power laws
- Under Titius_Bode , Wikipedia page.
- Modeling Planetary Distances using Titius-Bode Law and and TCL demo example calculator, numerical analysis
- Preface
- Introduction
- Many Distance formulas with different assignment numbers
- Revolution Periods and Distance of Planets from the Sun
- Horse Race for Least Squares Fits and Online Curve Fitter
- Original Armellini power law
- The Wave-Particle theory of the Solar System
- Considerations for Code and Titius-Bode formulas into TCL code
- Pushbutton Operation
- Conclusions
- Testcases Section
- Screenshots Section
- figure 1. screenshot
- figure 2. Calculator_report
- figure 3. Modeling_Planetary_Distances_log_plot
- figure 3b. Modeling_Planetary_Distances_log_plot_titius_bode
- figure 3c. Modeling_Planetary_Distances_plot_titius_bode_vs_gaussin
- figure 3d. Modeling_Planetary_Distances_gaussin
- figure 3e. Modeling_Planetary_Distances_armenelli
- figure 3f. Modeling_Planetary_Distances_wurm
- figure 4a. Modeling_Planetary_Distances_log_plot_measured_data
- figure 4d. log_plot_Fibonnaci_sequence
- figure 4a.power_law
- figure 4c. power_ln_law
- figure 5.gas_giants
- figure 6. Power law curve fit in red line, e-function curve fit in green line
- figure 7. first_6_points,Power law curve fit in red line, e-function curve fit in green line
- figure 8. power_law

- *figure 9a.Modeling_Planetary_Distances reference to the normalized_bohr_atom_1913
- *figure 9b.Modeling_Planetary_Distances_Solar standing_wave
- References:
- References: Planets, Titius–Bode law
- * Pretty Print Version
- Scrap code, Pertains to other formulas *
- formula from Sven-Ingmar Ragnarsson, 1994
- Appendix: One Liner Procs for Modeling Planetary Distances using Titius-Bode Law and other power laws
- Points for curve fitting

- Hidden Comments Section
- Hidden Comments Section

gold Hi, I'm an old Fortran programmer trying to retread. I actually served time on the IBM punch card machines. I collect old Fortran77 books as a hobby. A lot of guys leaving work would give me their old Fortran77 books. On active, i had a large Fortran collection, almost a library. I would loan and check out Fortran77 books to other employees. Also I programmed a lot in Javascript. Mostly I work on TCL now because i am visually oriented and think that a gui can save a lot of time in engineering calculations.

gold6/2/2021. How did you discover TCL/TK **????** >>

gold About 1996, the Personal Computer PC on my desk, was replaced by a Sun Sparc 20 workstation. I was an engineer and mainly programming in Fortran 77. I had learned QuickBasic, Html, Perl (Unix), and also Javascript. Since the Sparc 20 interface was command line Unix, I looked around for a gui or gui language as an interface to the Sparc 20 workstation. I found Tool Control Language TCL fairly easy to mouse click and invoke executable icons on the Xwindows screen. I even had a gimpy trashcan icon on the screen. I showed my beginner TCL program to a co_worker and he said I had fairly imitated the the PC Windows icon system on a Sparc20 workstation. But this was only about 200 lines of beginner TCL code and fast as greased lightning on a Sparc20! How's that for a sales job on TCL? Then, I wrote small slot calculators in TCL and Javascript on the Sparc20 behind a firewall, which were similar to my later pages on this wiki. Never forget the human brain evolved to hunt rabbits, not Unix critters and command lines. Your eyes and brain modeling/mapping of the outside stims are closer to a gui screen than one might think.

gold 3Dec2018, pages i thought were gone are showing up, largely under Category Numerical Analysis. as s_ noted, i did not use underscores much in early titles. I must learn on to use the goose search engine better. thanks. i have some updates anyway. I will add self_help button. Revamped TCL programs will be listed as V2. The bulk of these files are being stored locally as OpenOffice file.odt files or rich field text files file.rtf, mainly for spellcheck and larger stored fonts for bad eyes. My understanding is that backup on older files are available through the Internet Archive. Like the example of the Wikipedia, i think that an automated PDF dump of the individual TCL/WIKI pages would be a useful storage item, especially if the PDF included a rack of end attachment of the original unix/ascii text data for the unique WIKI table format and the TCL programs. I am scared i will lose formatted tables copy and I have a bunch.

gold 20Mar2020, Message to Middle Eastern Linguist(s) and museum curators on clay tablets. Have made replica clay tokens and published computer programs using the Sumerian math algorithms on clay tablets. Can contribute some to your museum, if interested???? Some ancient and historic algorithms were loaded into the TCLLIB library for the Tool Control Language (TCL).

- Modeling Planetary Distances using Titius-Bode Law and and TCL demo example calculator, numerical analysis V2
- Time Fractals in Golden Ratio Proportions and TCL demo example calculator, numerical analysis
- Text Adventure Game and TCL Demo Example [L1 ]
- Parametric Equation Model Vaporware TCL calculator [L2 ]
- One Liners Programs Compendium and TCL demo examples calculations, numerical analysis [L3 ]
- Basic_RS V2 in TCL as partial Basic language interpreter ed
- HgA1c Approximates Average Blood Glucose in Console Example Demo for TCL table format V2 [L4 ]
- Babylonian Expansion Procedure Algorithm and demo example calculator, numerical analysis [L5 ]
- Biology >> Dinosaur Mass from Trackway and TCL demo example calculator, numerical analysis
- Biological Mutation Rate and TCL demo example calculator, numerical analysis
- Babylonian_Brothers_Inheritance_Problems_Algorithm and TCL 8.6 demo example calculator, numerical analysis
- Texas Hold Dem Poker Cards, Game, and Probability, numerical analyis
- Ideal Rocket Performance and TCL demo example calculator, numerical analysis
- Old Babylonian Interest Rates and eTCL demo example calculator [L6 ]
- Simple Pulley Forces Tension and eTCL demo example calculator, numerical analysis [L7 ]
- Human Language Root Words & Lexicostatistics Calculator and eTCL Slot Calculator Demo Example, numerical analysis [L8 ]
- Random Walk Equation Slot Calculator Example
- Electronic Failure Rate FITS and eTCL Slot Calculator Demo Example [L9 ]
- Brahmagupta Area of Cyclic Quadrilateral and eTCL demo example calculator
- Babylonian Quarter Square Multiplication procedure algorithm and TCL 8.6 demo example calculator, numerical analysis
- General Tianji' Horse Race Strategy from China and eTCL demo example calculator, numerical analysis
- Sumerian Seeding Rates and eTCL Slot Calculator Demo Example , numerical analysis [L10 ]
- Stonehenge Circle Accuracy Slot Calculator Example [L11 ]
- Rectangular Radio Antenna and etcl Slot Calculator Demo Example

>>>>>> if can't find or link, look older files under category numerical analysis <<<<<<<< >>>>>> for some unk reason, wiki search engine does not push these files to top <<<<<<<<

- Sumerian Pottery Vessel Mass Calculator
- Babylonian Quarter Square Multiplication procedure algorithm and TCL 8.6 demo example calculator, numerical analysis
- Babylonian Cubic Equation Problem and eTCL demo example calculator, numerical analysis
- Babylonian Square rule for Trapezoid Area and eTCL demo example calculator, numerical analysis
- Characteristic lengths and between Biophoton sensors in the Ultraviolet Spectrum and TCL Slot Calculator, numerical analysis
- Stratographic Years Slot Calculator Example, Age of Earth
- Trig Procedures for degree measures as sind, cosd, tand,etc
- Indian Math Bhaskara (1) Sine formula and extensions, history of math
- Kahan compensated summation algorithm and Neumaier variant summation algorithm, numerical analysis
- Game kingdom of strategy
- Babylonian trailing edge algorithm and reverse sequence algorithm for reciprocals, eTCL demo example calculator, numerical analysis
- Sumerian Counting Boards, multiplication operation placement strategy, and eTCL demo example, numerical analysis
- Babylonian Combined Work Norm Algorithm and eTCL Slot Calculator Demo Example, numerical analysis
- Weighted Decision and example eTCL demo calculator, numerical analysis
- Division into Parts by Multiple Ratios and eTCL demo example calculator, numerical analysis
- Combined Availability and example eTCL demo calculator, numerical analysis
- Chinese Horse Race Problems from Suanshu, DFP, and example eTCL demo calculator, numerical analysis
- Ancient Egyptian Double False Position Algorithm, and example eTCL demo calculator, numerical analysis
- Babylonian Multiplicatiion Algorithm and example demo eTCL calculator, numerical analysis
- Babylonian Weight Riddle Problems and eTCL demo example calculator, numerical analysis
- Babylonian Babylonian Irregular Reciprocal Algorithm and eTCL demo example calculator, numerical analysis
- Babylonian Field Expansion Procedure Algorithm and example demo eTCL calculator, numerical analysis
- Babylonian Trapezoid Bisection Algorithm and eTCL demo example calculator, numerical analysis
- Babylonian False Position Algorithm and eTCL demo example calculator, numerical analysis
- Babylonian Combined Market Rates and eTCL demo example calculator, numerical analysis
- Babylonian Cubic Equation Problem and eTCL demo example calculator, numerical analysis
- Sumerian Base 60 conversion and eTCL demo example calculator, numerical analysis
- Aryabhat Sum of Squares and Cubes and eTCL demo example calculator, numerical analysis
- Sumerian Approximate Area Quadrilateral and eTCL Slot Calculator Demo Example , numerical analysis
- Capsule Surface Area & Volume and eTCL demo example calculator
- Babylonian Number Series and eTCL demo example calculator
- Brahmagupta Area of Cyclic Quadrilateral and eTCL demo example calculator
- Gauss Approximate Number of Primes and eTCL demo example calculator
- Old Babylonian Interest Rates and eTCL demo example calculator
- Twin Lead Folded Dipole Antenna and example demo eTCL calculator
- Refrigerator_Pinyin_Poetry
- Random Poetry Chalkboard
- Oneliner's Pie in the Sky
- Mahjong_Style_Deletion
- Example Linear Interpolation Calculator
- Fuel Cost Estimate Log Slot Calculator Example
- 2010-08-17 19:03:29 Seaching for Babylonian Triplets Slot Calculator Example
- 2010-08-17 15:24:36 Biruni Estimate of Earth Diameter Slot Calculator eample
- 2010-08-16 15:20:57 Fuel Cost Estimate Log Slot Calculator Example
- 2010-08-11 23:43:40 Stratographic Years Slot Calculator Example, Age of Earth
- 2010-08-01 21:11:58 Binomial Probability Slot Calculator Example
- 2010-06-27 21:33:56 Slot_Calculator_Demo
- Chinese Fortune Casting Example Demo
- 2010-08-16 20:04:34 Chinese Sun Stick Accuracy for Console Example
- 2010-08-01 01:15:15 Chinese Iching Hexagrams on Chou Bronzes : TCL Example
- 2010-07-29 01:12:32 Chinese Iching Random Weather Predictions
- 2010-07-18 01:53:25 Chinese Xiangqi Chessboard
- Iching_Fortunes
- application_runner_&_wrapper
- Testing Normality of Pi, Console Example
- horoscope pie plotter
- Stonehenge Circle Accuracy Slot Calculator Example
- Call Procedure Like Fortran Example
- Stonehenge Circle Accuracy Slot Calculator Example
- Drake Intelligent Life Equation Slot Calculator Example
- Sumerian Equivalency Values, Ratios, and the Law of Proportions with Demo Example Calculator
- Piece wise Profits and eTCL Slot Calculator Demo Example
- Drake Intelligent Life Equation Slot Calculator Example
- Stonehenge Circle Accuracy Slot Calculator Example
- Stonehenge Circle Accuracy Slot Calculator Example
- Babylonian Sexagesimal Notation for Math on Clay Tablets in Console Example
- Call Procedure Like Fortran Example
- Canvas Object Movement Example https://wiki.tcl-lang.org/26626
- Drake Intelligent Life Equation Slot Calculator Example
- Ellipse Properties Slot Calculator Example
- Sea Island Height Slot Calculator Example
- Captioning Photo Image under Pixane Example
- Timing Photo Image Loading under Pixane
- Poker Probability and Calculator Demo Example
- Canvas Object Movement Example
- Generic Calculator Namespace Package Example
- Sumerian Circular Segment Coefficients and Calculator Demo Example
- Tonnage of Ancient Sumerian Ships and Slot Calculator Demo Example
- Heat Engine Combustion and Calculator Demo Example
- Rectangular Radio Antenna and etcl Slot Calculator Demo Example
- Sumerian Equivalency Values, Ratios, and the Law of Proportions with Demo Example Calculator
- Sumerian Construction Rates and eTCL Slot Calculator Demo Example
- Piece wise Profits and eTCL Slot Calculator Demo Example
- Sumerian Coefficients in the Pottery Factory and Calculator Demo Example
- Sumerian Equivalency Values, Ratios, and the Law of Proportions with Demo Example Calculator
- Sumerian Coefficients at the Weavers Factory and eTCL Slot Calculator Demo Example
- Sumerian Coefficients at the Bitumen Works and eTCL Slot Calculator Demo Example edit
- Sumerian Beveled Bowl Volume and eTCL Slot Calculator Demo Example
- Sumerian Population Density and eTCL Slot Calculator Demo Example
- Babylonian Sexagesimal Notation for Math on Clay Tablets in Console Example
- Easy Eye Calculator and eTCL Slot Calculator Demo Example, Numerical Analysis
- Piece wise Profits and eTCL Slot Calculator Demo Example
- Paper & Felt Rolls and eTCL Slot Calculator Demo Example
- Human Language Root Words & Lexicostatistics Calculator and eTCL Slot Calculator Demo Example, numerical analysis
- Sumerian Workday Time & Account Calculator and eTCL Slot Calculator Demo Example, numerical analysis
- contribution to Counting Elements in a List
- contribution to A Program That Learns
- contribution to Simple Canvas Demo
- contribution to lremove
- added many pictures to other pages
- added pix to A fancier little calculator
- added pix to 3 Triangles
- Sumerian Sheep and Herd Animal Calculator and eTCL Slot Calculator Demo Example, numerical analysis
- Probability Exponential Density Calculator and eTCL Slot Calculator Demo Example, numerical analysis
- Electronic Failure Rate FITS and eTCL Slot Calculator Demo Example
- Sumerian Seeding Rates and eTCL Slot Calculator Demo Example , numerical analysis
- Sumerian Porters Pay Formula and eTCL Slot Calculator Demo Example, numerical analysis
- One Dimension Heat Flow Model and eTCL Slot Calculator Demo Example, numerical analysis
- Sumerian Surveyor Area Formula and eTCL Slot Calculator Demo Example, numerical analysis

- Babylonian Sexagesimal Notation for Math on Clay Tablets in Console Example
- Binomial Probability Slot Calculator Example
- Call Procedure Like Fortran Example
- canvas Object Movement Example
- Captioning Photo Image under Pixane Example
- Chinese Fortune Casting Example Demo
- Chinese Iching Hexagrams on Chou Bronzes : TCL Example
- Chinese Sun Stick Accuracy for Console Example
- Command Line Calculator in Namespace Package Example
- Crater Production Power Law Slot Calculator Example
- Drake Intelligent Life Equation Slot Calculator Example
- Ellipse Properties Slot Calculator Example
- Estimating Mountain Height Using Look Angles, Etcl Console Example
- Example Linear Interpolation Calculator
- Finding Seked Angles of Ancient Egypt, Console Example
- Fuel Cost Estimate Log Slot Calculator Example
- Generic Calculator Namespace Package Example
- Heat Engine Combustion and Calculator Demo Example
- Piece wise Profits and eTCL Slot Calculator Demo Example
- Poker Probability and Calculator Demo Example
- Random Walk Equation Slot Calculator Example
- Rectangular Radio Antenna and etcl Slot Calculator Demo Example
- Sanskrit Number Words Handling in Formulas and Demo Calculator Example
- Sea Island Height Slot Calculator Example
- Seaching for Babylonian Triplets Slot Calculator Example
- Simple Reliability Slot Calculator Example
- Stonehenge Circle Accuracy Slot Calculator Example
- Stratographic Years Slot Calculator Example, Age of Earth
- Sumerian Equivalency Values, Ratios, and the Law of Proportions with Demo Example Calculator
- Sumerian Beveled Bowl Volume and eTCL Slot Calculator Demo Example
- Sumerian Circular Segment Coefficients and Calculator Demo Example
- Sumerian Coefficients at the Bitumen Works and eTCL Slot Calculator Demo Example edit
- Sumerian Coefficients at the Weavers Factory and eTCL Slot Calculator Demo Example
- Sumerian Coefficients in the Pottery Factory and Calculator Demo Example
- Sumerian Construction Rates and eTCL Slot Calculator Demo Example
- Sumerian Population Density and eTCL Slot Calculator Demo Example
- Testing Normality of Pi, Console Example
- Tonnage of Ancient Sumerian Ships and Slot Calculator Demo Example
- Sumerian Bronze & Alloy Calculator with demo examples eTCL numerical analysis
- Population Density Rectangular City Calculator and eTCL Slot Calculator Demo Example
- Over-21 Game Shell and eTCL Slot Calculator Demo Example , numerical analysis
- Sales Optimal Lot Order Size and eTCL Slot Calculator Demo Example
- Over-21 Game Shell and eTCL Slot Calculator Demo Example , numerical analysis
- Sales Optimal Lot Order Size and eTCL Slot Calculator Demo Example
- Spare Parts from Normal Distribution and eTCL Slot Calculator Demo Example , numerical analysis
- Sumerian Beer Ingredients and eTCL Slot Calculator Demo Example , numerical analysis
- Sumerian Coefficients at the Dog Keepers and eTCL Slot Calculator Demo Example , numerical analysis
- Timing Photo Image Loading under Pixane
- Babylonian Shadow Length & Angles and eTCL Slot Calculator Demo Example, numerical analysis
- Sumerian Surveyor Area Formula and eTCL Slot Calculator Demo Example, numerical analysis

test below

Babylonian Sexagesimal Notation for Math on Clay Tablets in Console Example Binomial Probability Slot Calculator Example Biruni Estimate of Earth Diameter Slot Calculator eample Chinese Fortune Casting Example Demo Chinese Sun Stick Accuracy for Console Example Command Line Calculator in Namespace Package Example Crater Production Power Law Slot Calculator Example Drake Intelligent Life Equation Slot Calculator Example Easy Eye Calculator and eTCL Slot Calculator Demo Example, Numerical Analysis Ellipse Properties Slot Calculator Example Fuel Cost Estimate Log Slot Calculator Example Generic Calculator Namespace Package Example Heat Engine Combustion and Calculator Demo Example Human Language Root Words & Lexicostatistics Calculator and eTCL Slot Calculator Demo Example, numerical analysis Mahjong_Style_Deletion Oil Molecule Length Calculator and eTCL Slot Calculator Demo Example, numerical analysis Oneliner's Pie in the Sky Paper & Felt Rolls and eTCL Slot Calculator Demo Example Penny Packing Calculator and eTCL Slot Calculator Demo Example, numerical analysis Piece wise Profits and eTCL Slot Calculator Demo Example Planet Mass Calculator and eTCL Slot Calculator Demo Example, numerical analysis Poker Probability and Calculator Demo Example Random Walk Equation Slot Calculator Example Rectangular Radio Antenna and etcl Slot Calculator Demo Example Sanskrit Number Words Handling in Formulas and Demo Calculator Example Sea Island Height Slot Calculator Example Seaching for Babylonian Triplets Slot Calculator Example Simple Reliability Slot Calculator Example Slot_Calculator_Demo Stonehenge Circle Accuracy Slot Calculator Example Stratographic Years Slot Calculator Example, Age of Earth Sumerian Equivalency Values, Ratios, and the Law of Proportions with Demo Example Calculator Sumerian Beveled Bowl Volume and eTCL Slot Calculator Demo Example Sumerian Circular Segment Coefficients and Calculator Demo Example Sumerian Coefficients at the Bitumen Works and eTCL Slot Calculator Demo Example edit Sumerian Coefficients at the Weavers Factory and eTCL Slot Calculator Demo Example Sumerian Coefficients in the Pottery Factory and Calculator Demo Example Sumerian Construction Rates and eTCL Slot Calculator Demo Example Sumerian Paint & Bitumen Coating and eTCL Slot Calculator Demo Example Sumerian Population Density and eTCL Slot Calculator Demo Example Tonnage of Ancient Sumerian Ships and Slot Calculator Demo Example

Sumerian Pottery Vessel Mass Calculator, can not find in new wiki system Babylonian Square rule for Trapezoid Area and eTCL demo example calculator, numerical analysis Indian Math Bhaskara (1) Sine formula and extensions, history of math Kahan compensated summation algorithm and Neumaier variant summation algorithm, numerical analysis Sumerian Counting Boards, multiplication operation placement strategy, and eTCL demo example, numerical analysis Babylonian Combined Work Norm Algorithm and eTCL Slot Calculator Demo Example, numerical analysis Stonehenge Circle Accuracy Slot Calculator Example Drake Intelligent Life Equation Slot Calculator Example Sumerian Equivalency Values, Ratios, and the Law of Proportions with Demo Example Calculator Piece wise Profits and eTCL Slot Calculator Demo Example Sumerian Sheep and Herd Animal Calculator and eTCL Slot Calculator Demo Example, numerical analysis Electronic Failure Rate FITS and eTCL Slot Calculator Demo Example Sumerian Seeding Rates and eTCL Slot Calculator Demo Example , numerical analysis Command Line Calculator in Namespace Package Example Example Linear Interpolation Calculator Sumerian Equivalency Values, Ratios, and the Law of Proportions with Demo Example Calculator Sumerian Beveled Bowl Volume and eTCL Slot Calculator Demo Example Population Density Rectangular City Calculator and eTCL Slot Calculator Demo Example Sales Optimal Lot Order Size and eTCL Slot Calculator Demo Example Over-21 Game Shell and eTCL Slot Calculator Demo Example , numerical analysis Sumerian Beer Ingredients and eTCL Slot Calculator Demo Example , numerical analysis Easy Eye Calculator and eTCL Slot Calculator Demo Example, Numerical Analysis Paper & Felt Rolls and eTCL Slot Calculator Demo Example Human Language Root Words & Lexicostatistics Calculator and eTCL Slot Calculator Demo Example, numerical analysis Sumerian Workday Time & Account Calculator and eTCL Slot Calculator Demo Example, numerical analysis Old Babylonian Interest Rates and eTCL demo example calculator Capsule Surface Area & Volume and eTCL demo example calculator Babylonian Square rule for Trapezoid Area and eTCL demo example calculator, numerical analysis Sumerian Coefficients at the Weavers Factory and eTCL Slot Calculator Demo Example Sumerian Population Density and eTCL Slot Calculator Demo Example

I remember when my teenage sister would ask about a math problem. I would lead up and carefully explain this and that algebra proposition. But my sister would say " I just want the answer!" In most engineering problems, there is an advantage in finding the answer in an approximate solution, say slide rule accuracy or 4 significant places. For example, using the old slide rule, one would make a preliminary pencil calculation and approximate answer to set the decimal point, before using the slide rule accuracy to 4 significant places. If one thinks of TCL as primarily as a graphical gui language, then the one liners programs are best used to check the preliminary math concepts. One liners programs and initial console programs are often used to check the math concepts and generate testcases before loading the calculator gui shell.

In planning any software, it is advisable to gather a number of testcases to check the results of the graphical user interface gui program. The results of the testcases are estimated using the hand calculations and then checked in the TCL gui calculator. Pseudocode and equations are developed from the hand calculations and theory. One liners procedures and small console programs are written to check or proof the alternate subroutines or procedures, rather than keeping the unblessed code and comment lines in the main gui calculator. Finally the improved or alternate subroutines are loaded into the gui calculator. The TCL gui or slot calculator is effectively a shell program to input entries, host calculation routines, maintain housekeeping procedures, and display results. Additional significant figures are used to check the TCL calculator, not to infer the accuracy of inputs and product reports.

The beginner TCL procedure on the pi circle constant was corrected to proc pi {} {expr acos(-1)} ;# AMG. One Liners Programs should avoid using temporary variables like {set temp 3.14:if {$temp=3.14} {return 1};return $temp}. Temporary variables may cause more time delay, more complication, and possible confusion to reader. The return value of a Tcl procedure is inherited from the return value of the last command to execute within that procedure. Therefore, many uses of the return command are redundant. If one insists on temporary variables, be aware that it is perfectly legal for a proc and a variable to have the same name. You could have said "set pi [pi]". For safety and efficiency, always be sure to brace your expr-essions! Heh, I neglected to brace my expression in [pi], but that's one of the extremely rare cases where it won't matter: no spaces, no substitutions. Bracing does two things: One, when the entire expression is a single word (single argument), it can be bytecode-compiled. Two, if substitutions are performed by expr only and not Tcl itself, injection attacks are prevented. Since the expr command has an internal if conditional, ? in a?b:c sic, try using the internal if <?> in expr rather than a separate IFstatement. Avoid using separate if statements and temporary variables for brevity. The args variable is also useful tool in one liners programs for inputting multiple data or lists of words. Another strategy is to keep track of possible error checks and testcases for low, middle, and high values over the range of operation of the oneliners program. An initial check for zero division or series start at one may be installed in the expr ? conditional. A simple credit for a one liner program may use a semicolon with comment sign <;#> at statement end, which should not degrade program execution. Using the time function in TCL will give even more insights into one liners programs, also see Time. In One liners Programs Pie in the Sky, one can see the advice of GWM on the importance of timing your code and procedures. Usually, invoking math ops, TCLLIB library, and other precompiled libraries can save an average of 1/3 time over big data chores. The time savings are not always obvious on small quantities of data. Performance of one liners programs may suffer degradation due to lengthy recursion calls and limits on the number of procedure recursion calls. The shorter the script, the faster and more reliable is the script. Dependence on math operator notation, helper procedures, math check examples, degradation due to lengthy recursion calls, and special library functions should be noted in the comment lines. The examples on this wiki page include code lines that might be incompatible, inefficient, or redundant if installed in the same program. As discussed, the local math procedures in scripts and one-line procedures may not be as fast and efficient as importing mathop , mathfunc, and math, so check with the precompiled code in the TCL core and TCLLIB libraries first, then homebrew your one-line programs and scripts.

gold 10/7/2018. Technical note on TCL calculator buttons addressing the reference ASK12 of 2017-02-19 . Many complex math programs have either initialize, refresh, or reset routines to force correct behavior, using calculator buttons. Of course, a very good feature of TCL is that new variables as number types do not have to be initialized prior to use. Repeating, setting a new number variable to 0 or 1 is not necessary prior to using the variable. I confess that habits brought from prior learned languages and 40 years ago are hard to change. Most of my gui programs on this wiki have a flexible button procedure (on changing labels and resetting variables prior to calculations). Where the program defaults are recalled, canvas colors/features/variables/clear displays are reset prior to ( in push button list) calculation. The buttons on the calculator are not limited to a single action proc or single shot. A button command may call multiple statements and procs like ::ttk::button .test4 -text "Test_wild_case3" -command {clearx; refresh_canvas_x .cv; fillup 120. 12.0 15.0 1. 1. 1. 1. 104.0; set global_variable 9999.;solve_routine;printout_routine;# need semicolons here; exit}. This is effectively a separate program or subprogram installed as list of procedures in a button.

The TCL language is very flexible, and as experiments, the button may invoke a do while routine to call the listed button procs multiple times like the infinite repeater (SiFi). The button may invoke command and call procedures for a random number of times and random solutions, like nerve and muscle firings from the human brain in thought and speech (not SiFi). For cosmetics, the button may set colors, frame width, canvas objects, and variables with the random proc lpick from RS on the wiki. As long as duplicate frames, duplicate canvas, pack managers, and channels are not confused reference the original program, one can load secondary and entire procs into the button list. Returning to the conventional use of resetting variables, the button refresh and initialize tactic should work across the TCL versions, at least in the versions tested (TCL8.5, and TCL8.6).

Most of the testcases involve experiments or models, using assumptions, and rules of thumb. For the push buttons in the TCL calculator, 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 to conventional texteditor. For testcases in a computer session, the TCL 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. The current result numbers should be cleared either on the clear button or on the next solve button.

gold 5/13/2021.

closer: arjenmarkus AM

Emailed icomment from AM: I used the sample code to create two new procedures:

listPrimePairs listPrimeProgressions

The first proc **listPrimePairs** returns a list of pairs of primes that differ by a given number and the second proc **listPrimeProgressions ** returns a list of arithmetic progressions of primes that differ by the given number.

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 scientific 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 in a constants subroutine, and then make a one time change in the value of gravity constant in one subroutine of constants than making the same change for 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 TCL 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.

gold 7/16/2020, Report so far, in coordination with ActiveState Support [email protected]

gold 08Jul2020. Don't know if other members of TCL Club have this problem, but the author is having great difficulty in accessing this TCL WIKI, since the TCL WIKI and other download TCL programming sites on public WIFI are blocked in the USA. Accordingly, the USA based search engines are apparently not accessing the TCL programming sites. Frantically, the blocked TCL sites will affect the availability,promulgation, and succe$$ of the TCL language. Believe that the TCL language has much to offer mankind, if the TCL language and its amazing utility are not blocked to mankind by gatekeepers, iconoclasts, and bookburners in the USA.

many thanks for help. I am still locked out from easy access to TCL Wiki. but i will report your efforts to the TCL WIKI. Is there an address to resolve issues with ATT ? . I tried to contact ATT, but there is merry-gr on that website. thanks again,gold

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Thursday, August 13, 2020 2:50 PM, ActiveState Support <[email protected]> wrote:

Hi Gold

I'm not sure if you've been able to work around this or have it fixed yet. I can still see "Error 1000" issues on Cloudflare though with the aliased tcl.activestate.com. Maybe that domain change is being detected as a cross-site redirection attempt and blocked for that.

I'm not clear why, but there is a difference between how wiki.tcl-lang.org and tcl.tk resolve. Maybe that was intended to work like a backup site, or maybe something is out of sync:

:~$ host tcl.activestate.com tcl.activestate.com is an alias for wiki.tcl-lang.org. wiki.tcl-lang.org has address 104.18.184.65 wiki.tcl-lang.org has address 104.18.183.65 wiki.tcl-lang.org has IPv6 address 2606:4700::6812:b841 wiki.tcl-lang.org has IPv6 address 2606:4700::6812:b741 :~$ host wiki.tcl-lang.org wiki.tcl-lang.org has address 104.18.183.65 wiki.tcl-lang.org has address 104.18.184.65 wiki.tcl-lang.org has IPv6 address 2606:4700::6812:b741 wiki.tcl-lang.org has IPv6 address 2606:4700::6812:b841

:~$ host www.tcl.tk www.tcl.tk has address 104.16.56.90 www.tcl.tk has address 104.16.33.94 www.tcl.tk has IPv6 address 2606:4700::6810:385a www.tcl.tk has IPv6 address 2606:4700::6810:215e

whois 104.16.56.90 and whois 104.16.33.94host reports that's Cloudflare. whois 104.18.183.65 and whois 104.18.184.65 also reports Cloudflare

Best regards,

Technical Support Engineer ActiveState Software

APN What URL are you using to access? The **tcl.tk** domain is problematic (from the blocking perspective), the official name is now **wiki.tcl-lang.org**. Do you have problems with that domain as well?

gold 7/11/2020. Thanks for feedback. Possibly problem is default security setting on browser or virus firewall security going into a WIFI proxy server. Realize the TCL CLUB is not a 9 to 5, but this item is really cutting down my production and access to TCL references. But the browsers are changing into complexity, pretty fast for a retiree. Quotes """ If you don't believe you should be using a proxy server: Go to the Dissenter menu > Settings > Show advanced settings… > Change proxy settings… > LAN Settings and deselect the "Use a proxy server for your LAN" checkbox. UNQuote"""" The strange thing is that I can see https://wiki.tcl-lang.org/welcome and https://sourceforge.net/projects/tcllib/ at Starbucks coffee and some "bar" WIFI's, but I can not see the TCL Wiki same at Mcdonalds, Wendy's, and some other quick stop WIFI's.

7/13/2020. trouble coming from Macdonald restaurant etc ATT WIFI?? https://login-mcd-cluster.prd.....snantx.attwifi.com/g error messege found after site log. SIC http://tcl.activestate.com/software/tcllib/tcl.activestate.com’s server IP address could not be found. Try:

Checking the connection Checking the proxy, firewall, and DNS configuration Running Windows Network Diagnostics ERR_NAME_NOT_RESOLVED

http://wfr.tcl-lang.org/ https://login.attwifi.com/blocked/blocked_page.html#?......&web_rep=%3Ctrustworthy-sites%3E&web_cat=%3Cshareware-and-freeware%3E

Hi,

7/16/2020. ActiveState hasn't hosted the Tcler's Wiki for a while. From what I see in that error message though, it looks like the ATT network has DNS entries that still point to tcl.activestate.com, whereas the other providers are using the official URL instead.

We might have had a redirect sending tcl.activestate.com to the new official URL, and that redirect might have gone out of service. I have asked our IT team to investigate.

Best regards,

GS. ActiveState Software

NEW! ActiveState Platform: Build - Certify - Resolve Login to get your ActivePerl/Python/Tcl builds: https://platform.activestate.com/ .

gold 7/16/2020, end of file

# pseudocode on Babylonian triplets 2m, m**2 - 1, m**2 + 1 Babylonian triplet twin prime number. twin prime numbers separated by 2,4,6 ...? c**2= a**2 + b**2 c**2= a**2 + 1 normalized Babylonian triplet a**2 = c**2 -1 normalized Babylonian triplet some b and c are both primes. some b and c are not both primes. The reciprocal pair relationship. (X+1/X)**2 - (X+1/X)**2 = 4 , divide equation by 4 normalized triplet, < (1/4)* ((X+1/X)**2 ) , 1 ,(1/4)* ((X+1/X)**2) > 0 < X-1/X < 2 1< X-1/X < 1+sqrt(2) ~~ approximate limit of 2.4 The Babylonian regular numbers between 0 and 60 have a limited set of triplets that satisfy 1< X-1/X < 1+sqrt(2) which appears to be the role of Plimpton 322. The limit 1< X-1/X < 1+sqrt(2) may explain the 1<X<2 limit on the Late Babylonian many place reciprocal tablets. d=6 even number, l = divisor of d**2 with integer result, Babylonian triplet method a=l+b b= d+ (d**2)//(2*l) c= d+l+(d**2)/(2*l) # supposed to work for all even d

New report indicates that binary numbers and base 3 may a bit biased in the near field. But don't think the sample is large enough in this trial program.

# Pretty print version from autoindent # and ased editor # Possible Bias of base 2 and 3 in near field? # written on Windows 10 on TCL # working under TCL version 8.6 # on TCL Club , 18aug2020 # relative frequency of indiv. "throw" over all "throws". # pi mantissa used here # proc base and frombase by RS package require Tk console show # proc base by RS proc base {base number} { set negative [regexp ^-(.+) $number -> number] ;# (1) set digits {0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z} set res {} while {$number} { set digit [expr {$number % $base}] set res [lindex $digits $digit]$res set number [expr {$number / $base}] } if $negative {set res -$res} set res } # proc base by RS proc frombase {base number} { set digits {0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z} set negative [regexp ^-(.+) $number -> number] set res 0 foreach digit [split $number ""] { set decimalvalue [lsearch $digits $digit] if {$decimalvalue<0 || $decimalvalue >= $base} { error "bad digit $decimalvalue for base $base" } set res [expr {$res*$base + $decimalvalue}] } if $negative {set res -$res} set res } proc calculation { facen } { # prob. subroutines for mimic sequence of bronze # prob. is throw combos of eg. "7" over all possible throws # set lister [split {14159265358979323846} ""] # in base 3 10111100001122100002122202221020002210001 # in base 2 1100010001111111110100001101001100110010011101001101011111000110 set target [ base 3 14159265358979323846 ] set lister [split { 1100010001111111110100001101001100110010011101001101011111000110 } ""] set ee [llength $lister ] set kk [ llength [ lsearch -all $lister $facen ] ] set prob [ expr { ($kk*1.) / $ee } ] return $prob } set limit 12 puts "%|table| printed in|TCL format |% " puts "&| quantity| value| comment, if any|& " for { set i 0 } { $i <= $limit } { incr i } { lappend listxxx $i lappend listxxx [ calculation $i ] puts " &| $i | [ calculation $i ] | |&" } #end puts " [ base 2 14159265358979323846 ] "

table | printed in | TCL format |
---|---|---|

quantity | value | comment, if any |

0 | 0.4461538461538462 | |

1 | 0.5384615384615384 | |

2 | 0.0 | |

12 | 0.0 | 1100010001111111110100001101001100110010011101001101011111000110 |

binary pi in 512 places. 11. 0010010000111111011010101000100010000101101000110000100011010011 0001001100011001100010100010111000000011011100000111001101000100 1010010000001001001110000010001000101001100111110011000111010000 0000100000101110111110101001100011101100010011100110110010001001 0100010100101000001000011110011000111000110100000001001101110111 1011111001010100011001101100111100110100111010010000110001101100 1100000010101100001010011011011111001001011111000101000011011101 0011111110000100110101011011010110110101010001110000100100010111

table | printed in | TCL format |
---|---|---|

quantity | value | comment, if any |

0 | 0.5394990366088632 | binary pi in 510 digits |

1 | 0.44701348747591524 | |

2 | 0.0 |

- Unexpected biases in the distribution of consecutive primes
- Robert J. Lemke Oliver, Kannan Soundararajan ,Department of Mathematics, Stanford University
- The Last Digit of Prime Numbers - Numberphile on Youtube
- Lecture on “Rock, paper, scissors in probability, Tadashi Tokieda
- Hardy-Littlewood conjectures.
- MATHEMATICS SCIENCE, A new pattern in primes, Shubashree Desikan, Hindu Times
- en.wikipedia.org wiki search on Tadashi_Tokieda
- https://www.ncbi.nlm.nih.gov articles/PMC4978288/
- Distribution of the units digit of primes, C. M. Ko, National Central University
- www.wired.com tadashi-tokieda-finds-startling-objects-in-plain-sight/

# adapted from tcl-wiki Stats 2011-05-22, arithmetic mean [RLE] # # ::math::quantity_into_ratios -- # # Return the division of quantity by two or more given ratios # # Arguments: # val first value is quantity # args other values are two or more given ratios # # Results: parts of quantity divided by ratios # proc ::math::quantity_into_ratios {quantity args} { set sum 0. set N [ expr { [ llength $args ] + 1 } ] if { $N == 1 } { return 0 } foreach val $args { set sum [ expr { $sum + $val } ] } foreach val $args { lappend answer [ expr { $quantity * ($val/$sum) } ] } set answer } #puts " ::math::quantity_into_ratios ( 84 2 2 2 ) answer 12.0 24.0 48.0 " #puts " [ ::math::quantity_into_ratios 84 1 2 4 ] " #puts " [ ::math::quantity_into_ratios 84 ] for (::math::quantity_into_ratios 84) returns zero "

# adapted from tcl-wiki Stats 2011-05-22, arithmetic mean [RLE] # # sqrt_sum_of_squares -- # # Return the sqrt_sum_of_squares by one or more # # Arguments: # # args other values are one or more # # Results: sqrt_sum_of_squares # proc sqrt_sum_of_squares { args} { set sum 0. set N [ expr { [ llength $args ] + 1 } ] if { $N == 1 } { return 0 } foreach val $args { set sum [ expr { $sum + $val*$val } ] } set answer [ expr { sqrt($sum) } ] } #puts " ::math::sqrt_sum_of_squares ( 2 2 2 ) answer [sqrt 12 ] # 3.4641016151377544 #puts " [ ::math::sqrt_sum_of_squares 1 2 4 ] " #puts " [ ::math::sqrt_sum_of_squares 2 ] for ( ) returns zero " console show console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} puts " sqrt_sum_of_squares 2 2 2 equals [ sqrt_sum_of_squares 2 2 2 ]" puts " sqrt_sum_of_squares 1 1 1 equals [ sqrt_sum_of_squares 1 1 1 ]" puts " sqrt_sum_of_squares 1 1 equals [ sqrt_sum_of_squares 1 1 ]" puts " sqrt_sum_of_squares 1 equals [ sqrt_sum_of_squares 1 ]" puts " sqrt_sum_of_squares 0 equals [ sqrt_sum_of_squares 0 ]"

sqrt_sum_of_squares 2 2 2 equals 3.4641016151377544 sqrt_sum_of_squares 1 1 1 equals 1.7320508075688772 sqrt_sum_of_squares 1 1 equals 1.4142135623730951 sqrt_sum_of_squares 1 equals 1.0 sqrt_sum_of_squares 0 equals 0.0

From Discrete event modelling with coroutines by Author : Arjen Markus (21 april 2009). Added easy eye console for my bad eyes.

# coro_discrete_events.tcl -- # Experiment with SIMULA/DEMOS like modelling - using coroutines # from Discrete event modelling with coroutines # Author : Arjen Markus (21 april 2009) # Discrete event modelling is a way of modelling all manner of systems package require Tcl 8.6 # acquire -- # Acquire resources and wait if that does not succeed # # Arguments: # name Name of the resource # amount Amount to acquire # # Returns: # None # # start modifications package require math::numtheory package require math::constants package require math::trig package require math namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory math::trig math::constants } set tclprecision 17 console show # following dresses up console output to easy eye console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} console eval {.console config -background palegreen -highlightcolor tan -relief raised -border 30 } # changes: shifted text, removed empty lines, added easy eye console to deck. # changes: ran text through autoindent of ASED TCL editor # end modifications proc acquire {name amount} { upvar 1 objectID ID upvar #0 $name resource_name puts "Acquiring $amount of $name for $ID ..." if { $resource_name >= $amount } { set resource_name [expr {$resource_name - $amount}] } else { puts "Waiting for $name -- $ID" while {1} { set ::queue($name) [linsert $::queue($name) 0 $ID] yield [list acquire $name $ID] puts "Checking $name ..." if { $resource_name >= $amount } { set resource_name [expr {$resource_name - $amount}] break } puts "Wait again - $name - $resource_name -- $amount ..." } } puts "Acquired $amount of $name for $ID" } # release -- # Release resources # # Arguments: # name Name of the resource # amount Amount to release # # Returns: # None # proc release {name amount} { upvar 1 objectID ID upvar #0 $name resource_name set resource_name [expr {$resource_name + $amount}] puts "Releasing $amount of $name for $ID" if { [llength $::queue($name)] != 0 } { set hid [lindex $::queue($name) 0] set ::queue($name) [lrange $::queue($name) 1 end] set ::events [linsert $::events 0 [list $hid acquire 0.0]] } puts "Released $amount of $name for $ID" } # resource -- # Create a named resource # # Arguments: # name Name of the resource # amount Amount to create # # Returns: # None # proc resource {name amount} { upvar #0 $name resource_name set resource_name $amount set ::queue($name) {} } # hold -- # Advance the time for the given object in the simulation # # Arguments: # delay Time to advance # # Returns: # None # proc hold {delay} { upvar 1 objectID object lappend ::events [list $object "hold" [expr {$::time+$delay}]] puts "Holding for $delay seconds ... $object" yield puts "Done" } # object -- # Create an object and schedule it's coming alive # # Arguments: # procedure Name of the procedure holding the life cycle # time Time at which it comes alive # # Returns: # Structure representing the object # proc object {procedure time} { set obj [list $procedure $::objectno] lappend ::events [list $obj "init" $time] incr ::objectno return $obj } # handleEvents -- # Handle the events that were scheduled # # Arguments: # None # # Returns: # None # proc handleEvents {} { global time global events while { [llength $events] > 0 } { set count 0 set found 0 foreach event $events { foreach {obj type eventTime} $event {break} if { $eventTime <= $time } { set events [lreplace $events $count $count] set found 1 break } incr count } if { ! $found } { foreach {obj type eventTime} [lindex $events 0] {break} set events [lrange $events 1 end] } if { $time < $eventTime } { set time $eventTime } if { $type == "init" } { coroutine [lindex $obj 1] {*}$obj } if { $type == "hold" } { puts "Releasing hold: $obj" $obj } if { $type == "acquire" } { puts "Continue acquiring: $obj" $obj } } } # startSimulation -- # Start the simulation # # Arguments: # None # # Returns: # None # proc startSimulation {} { if { [llength $::events] == 0 } { return } else { handleEvents } } # boat -- # Simulate a boat that requires several tugs to get into the harbour # # Arguments: # objectID ID of the object (required name!) # # Returns: # None # proc boat {objectID} { acquire tugs 2 hold 10 release tugs 2 } # main -- # Simulate two objects that need the same resources # # Initialise simulation system set objectno 0 set time 0.0 set events {} # The simulation itself resource tugs 3 set b1 [object boat 1.0] set b2 [object boat 4.0] startSimulation

gold 9/10/2020. added pix.

Beginning in the sixties, the one liner program was typed input to the command line of an operating computer system terminal so that the one line command performs some useful function in a single one line of terminal input. Some of the original one liner commands were limited to a 60 character display on especially the early Basic terminals or to a 72 characters on the Fortran punched cards. Of course, the hit return to send, terminal flashing bulbs, and automatic answer back were silently understood as part or supporting the one liner program. Some of the line lengths in some computer languages were later extended to 410 lines and so on. The definition and use of the one liner program has been widened to include program source for any language that does something useful in one line. On batch programs, controlling and setting variable statements like RETURN, STOP, END, extra terminal prompts, and setting initial variables were used in Fortran systems. Of course, a very good feature of TCL is that new variables as number types do not have to be initialized prior to use and no subroutine RETURN and END statements are necessary, vis the older Fortran and Basic dogmas in moldy textbooks. Repeating, setting a new number variable to 0 or 1 is not necessary prior to using the variable. Since a partial and practical goal of computer programming is to produce human readable code, it is permissible on the published console batch programs here to retain some vestigial stages to aid human comprehension.

# pretty print from autoindent and ased editor # Timing Equivalent One Liners V2 # written on Windows 10 on eTCL # working under TCL version 8.6 # gold on TCL Club , 8/20/2020 # Ref. WIKI BOOKS, Tcl_Programming_Introduction # Book Section contrasts one liners # versus traditional procedural approach # below contains redundant procs package require Tk package require math::numtheory package require math::constants package require math::trig package require math namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory math::trig math::constants } set tcl_precision 17 proc pie {} {return [expr acos(-1)]} console show console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} # uses join, but computer time on some? proc mean_1 list {expr double([join $list +])/[llength $list]} # math operators exposed as commands, and the expand operator proc mean_2 list {expr {[tcl::mathop::+ {*}$list]/double([llength $list])}} # import the tcl::mathop operators proc mean_3 list {expr {[+ {*}$list]/double([llength $list])}} # import the tcl::mathop operators from <Summing a list> # list add ladd or summing a list proc ladd_1 {listx} {::tcl::mathop::+ {*}$listx} # using join in ladd_2 from RS proc ladd_2 {listx} {expr [join $listx +]+0} ;# RS # using expr including non integers from PYK 2016-04-13 proc ladd_3 {listx} {set total 0.0; foreach nxt $listx {set total [expr {$total + $nxt}]}; return $total} set limit 12 puts "%|table| | printed in|TCL format |% " puts "&| session| proc & mean value| elements in list | comment, if any|& " for { set i 0 } { $i <= $limit } { incr i } { set lister { 1 2 4 5 6 7 8 9 10 } lappend lister [* $i [pie]] puts "&|$i | ladd_1 [ ladd_1 $lister ] | $lister | proc timer [ time { set qq [ ladd_1 $lister ]} 5000 ] |&" puts "&|$i | ladd_2 [ ladd_2 $lister ] | $lister | proc timer [ time { set qq [ ladd_2 $lister ]} 5000 ] |&" puts "&|$i | ladd_3 [ ladd_3 $lister ] | $lister | proc timer [ time { set qq [ ladd_3 $lister ]} 5000 ] |&" puts "&|$i | mean_1 [ mean_1 $lister ] | $lister | proc timer [ time { set qq [ mean_1 $lister ]} 5000 ] |&" puts "&|$i | mean_2 [ mean_2 $lister ] | $lister | proc timer [ time { set qq [ mean_2 $lister ]} 5000 ] |&" puts "&|$i | mean_3 [ mean_3 $lister ] | $lister | proc timer [ time { set qq [ mean_3 $lister ]} 5000 ] |&" puts "&|$i | ::math::mean [::math::mean 1 2 4 5 6 7 8 9 10 [* $i [pie]]] | $lister | proc timer [ time { set qq [ ::math::mean 1 2 4 5 6 7 8 9 10 [* $i [pie]] 5000 ]} ] |&" } #end

table | printed in | TCL format | |
---|---|---|---|

session | proc & mean value | elements in list | comment, if any |

0 | ladd_1 52.0 | 1 2 4 5 6 7 8 9 10 0.0 | proc timer 2.3273999999999999 microseconds per iteration |

0 | ladd_2 52.0 | 1 2 4 5 6 7 8 9 10 0.0 | proc timer 5.6311999999999998 microseconds per iteration |

0 | ladd_3 52.0 | 1 2 4 5 6 7 8 9 10 0.0 | proc timer 4.3941999999999997 microseconds per iteration |

0 | mean_1 5.2000000000000002 | 1 2 4 5 6 7 8 9 10 0.0 | proc timer 13.053599999999999 microseconds per iteration |

0 | mean_2 5.2000000000000002 | 1 2 4 5 6 7 8 9 10 0.0 | proc timer 3.0369999999999999 microseconds per iteration |

0 | mean_3 5.2000000000000002 | 1 2 4 5 6 7 8 9 10 0.0 | proc timer 2.3805999999999998 microseconds per iteration |

0 | ::math::mean 5.2000000000000002 | 1 2 4 5 6 7 8 9 10 0.0 | proc timer 22 microseconds per iteration |

1 | ladd_1 55.141592653589797 | 1 2 4 5 6 7 8 9 10 3.1415926535897931 | proc timer 1.7847999999999999 microseconds per iteration |

1 | ladd_2 55.141592653589797 | 1 2 4 5 6 7 8 9 10 3.1415926535897931 | proc timer 7.3037999999999998 microseconds per iteration |

1 | ladd_3 55.141592653589797 | 1 2 4 5 6 7 8 9 10 3.1415926535897931 | proc timer 1.7285999999999999 microseconds per iteration |

1 | mean_1 5.5141592653589795 | 1 2 4 5 6 7 8 9 10 3.1415926535897931 | proc timer 8.3374000000000006 microseconds per iteration |

1 | mean_2 5.5141592653589795 | 1 2 4 5 6 7 8 9 10 3.1415926535897931 | proc timer 2.2898000000000001 microseconds per iteration |

1 | mean_3 5.5141592653589795 | 1 2 4 5 6 7 8 9 10 3.1415926535897931 | proc timer 2.1674000000000002 microseconds per iteration |

1 | ::math::mean 5.5141592653589795 | 1 2 4 5 6 7 8 9 10 3.1415926535897931 | proc timer 6 microseconds per iteration |

2 | ladd_1 58.283185307179586 | 1 2 4 5 6 7 8 9 10 6.2831853071795862 | proc timer 1.7618 microseconds per iteration |

2 | ladd_2 58.283185307179586 | 1 2 4 5 6 7 8 9 10 6.2831853071795862 | proc timer 6.6627999999999998 microseconds per iteration |

2 | ladd_3 58.283185307179586 | 1 2 4 5 6 7 8 9 10 6.2831853071795862 | proc timer 4.0709999999999997 microseconds per iteration |

2 | mean_1 5.8283185307179588 | 1 2 4 5 6 7 8 9 10 6.2831853071795862 | proc timer 8.5307999999999993 microseconds per iteration |

2 | mean_2 5.8283185307179588 | 1 2 4 5 6 7 8 9 10 6.2831853071795862 | proc timer 2.1261999999999999 microseconds per iteration |

2 | mean_3 5.8283185307179588 | 1 2 4 5 6 7 8 9 10 6.2831853071795862 | proc timer 2.3512 microseconds per iteration |

2 | ::math::mean 5.8283185307179588 | 1 2 4 5 6 7 8 9 10 6.2831853071795862 | proc timer 5 microseconds per iteration |

3 | ladd_1 61.424777960769376 | 1 2 4 5 6 7 8 9 10 9.4247779607693793 | proc timer 1.9702 microseconds per iteration |

3 | ladd_2 61.424777960769376 | 1 2 4 5 6 7 8 9 10 9.4247779607693793 | proc timer 7.1285999999999996 microseconds per iteration |

3 | ladd_3 61.424777960769376 | 1 2 4 5 6 7 8 9 10 9.4247779607693793 | proc timer 2.6114000000000002 microseconds per iteration |

3 | mean_1 6.1424777960769372 | 1 2 4 5 6 7 8 9 10 9.4247779607693793 | proc timer 8.5581999999999994 microseconds per iteration |

3 | mean_2 6.1424777960769372 | 1 2 4 5 6 7 8 9 10 9.4247779607693793 | proc timer 2.1989999999999998 microseconds per iteration |

3 | mean_3 6.1424777960769372 | 1 2 4 5 6 7 8 9 10 9.4247779607693793 | proc timer 2.4533999999999998 microseconds per iteration |

3 | ::math::mean 6.1424777960769372 | 1 2 4 5 6 7 8 9 10 9.4247779607693793 | proc timer 5 microseconds per iteration |

4 | ladd_1 64.566370614359172 | 1 2 4 5 6 7 8 9 10 12.566370614359172 | proc timer 1.7842 microseconds per iteration |

4 | ladd_2 64.566370614359172 | 1 2 4 5 6 7 8 9 10 12.566370614359172 | proc timer 10.103400000000001 microseconds per iteration |

4 | ladd_3 64.566370614359172 | 1 2 4 5 6 7 8 9 10 12.566370614359172 | proc timer 1.9608000000000001 microseconds per iteration |

4 | mean_1 6.4566370614359174 | 1 2 4 5 6 7 8 9 10 12.566370614359172 | proc timer 8.8523999999999994 microseconds per iteration |

4 | mean_2 6.4566370614359174 | 1 2 4 5 6 7 8 9 10 12.566370614359172 | proc timer 2.0948000000000002 microseconds per iteration |

4 | mean_3 6.4566370614359174 | 1 2 4 5 6 7 8 9 10 12.566370614359172 | proc timer 2.2736000000000001 microseconds per iteration |

4 | ::math::mean 6.4566370614359174 | 1 2 4 5 6 7 8 9 10 12.566370614359172 | proc timer 5 microseconds per iteration |

5 | ladd_1 67.707963267948969 | 1 2 4 5 6 7 8 9 10 15.707963267948966 | proc timer 3.6421999999999999 microseconds per iteration |

5 | ladd_2 67.707963267948969 | 1 2 4 5 6 7 8 9 10 15.707963267948966 | proc timer 10.6218 microseconds per iteration |

5 | ladd_3 67.707963267948969 | 1 2 4 5 6 7 8 9 10 15.707963267948966 | proc timer 2.3553999999999999 microseconds per iteration |

5 | mean_1 6.7707963267948967 | 1 2 4 5 6 7 8 9 10 15.707963267948966 | proc timer 8.4225999999999992 microseconds per iteration |

5 | mean_2 6.7707963267948967 | 1 2 4 5 6 7 8 9 10 15.707963267948966 | proc timer 2.1343999999999999 microseconds per iteration |

5 | mean_3 6.7707963267948967 | 1 2 4 5 6 7 8 9 10 15.707963267948966 | proc timer 2.1093999999999999 microseconds per iteration |

5 | ::math::mean 6.7707963267948967 | 1 2 4 5 6 7 8 9 10 15.707963267948966 | proc timer 5 microseconds per iteration |

set strinit “123456789” proc string_end strin5 { string index $strin5 end} string_end $strinit # out 9 proc sea5 bb { set i 2;if {$i < 10} { while {$i < 5} { puts [incr i]}}} sea 5 # return first character of string proc string_end5 bb { string index $bb 0 } # return last character of string proc string_end5 bb { string index $bb end } # Enter number num for next above power of 2, John K. Ousterhout, Tcl and the Tk Toolkit proc near_above_power_of_2 num {set pow 1; while {$pow<$num} {set pow [expr { $pow*2} ]}; return $pow} # Usage near_above_power_of_2 7 returns 8, # Usage near_above_power_of_2 9 returns 16, # Usage near_above_power_of_2 99999999999999 140737488355328 # Enter number num for next below power of 2, John K. Ousterhout, Tcl and the Tk Toolkit proc near_below_power_of_2 num {set pow 1; while {$pow< [expr {$num - 1}] } {set pow [expr { $pow*2} ]}; return [expr { $pow*.5} ]} # Usage near_below_power_of_2 7 returns 4.

# start advice file. AMG: The return value of a Tcl procedure is inherited from the return value of the last command to execute within that procedure. Therefore, many uses of the [return] command are redundant. For example, this procedure: proc anglecosa {a b c} {return [expr {($b*$b+$c*$c-$a*$a)/(2.*$b*$c)}]} can be written more simply: proc anglecosa {a b c} {expr {($b*$b+$c*$c-$a*$a)/(2.*$b*$c)}} Also, the conditional arguments to [if], [while], [for] are already expr-essions, so there's no need to nest a call to [expr]. For example, proc emmy2 {} {if {[expr {rand()}] <= 0.9} {return 1}} can be simplified quite a lot: proc emmy2 {} {if {rand() <= 0.9} {return 1}} #end of advice file

scratch

proc near_above_power_of_2x num {set pow 1; while {$pow<$num} {set pow [expr { $pow*2} ]}; return $pow} proc near_above_power_of_2 num {set pow 1; while {$pow<$num} {set pow [expr { $pow*2} ]}; return $pow} proc ld x "expr {log(\$x)/[expr log(2)]}" ;# RS [pow 2 [+ [int 2.8] 1]]= "8.0" proc zap x "[pow 2 [+ 1 [expr {log(\$x)/[expr log(2)]}]" proc zap x "pow 2 [+ [int 2.8] 1]"

#under test from www.codecodex.com/wiki set lister { 1 2 4 5 6 7 8 9 10 } set s {starchild} package require struct::list proc reverseWords s {return [struct::list reverse [split $s]]} proc ! n {expr {$n<2? 1: $n*[! [incr n -1]]}} # usage ! 5 returns 120 proc average list {expr ([join $list +])/[llength $list].} for {set i 1} {$i <= 1000} {incr i} {pust [expr {$i*($i+1)/2}]} namespace import ::tcl::mathop::* proc average list {expr {[+ {*}$list]/double([llength $list])}} # works here , average $lister returns 5.777777777777778 proc fib n {expr {$n<2? $n: [fib [incr n -1]] + [fib [incr n -1]]}} # not working here namespace import ::tcl::mathfunc::* ::tcl::mathfunc::isqrt 26 # ::tcl::mathfunc::isqrt 26 returns 5, working here set date [clock format [clock scan $date] -format {%Y-%m-%d %H:%M:%S}] ;#dclaar scriptEval clock format [clock scan $tDate] -format {%Y-%m-%d %H:%M:%S} ;#dclaar # clock scan is your friend; it knows all sorts of formats. In # case above, it converts: Oct 15 06:52:45 2009 to: 2009-10-15 06:52:45

# pretty print from autoindent and ased editor # list_twin_primes V2 # written on Windows 10 on TCL # working under TCL version 8.6 # gold on TCL Club , 8/20/2020 # Ref. WIKI BOOKS, Tcl_Programming_Introduction # Book Section contrasts one liners # versus traditional procedural approach # below contains redundant procs package require Tk package require math::numtheory package require math::constants package require math::trig package require math namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory math::trig math::constants } set tcl_precision 17 proc pie {} {return [expr acos(-1)]} console show console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} # invoking TCLLIB math::numtheory proc isprimex x {expr {$x>1 && ![regexp {^(oo+?)\1+$} [string repeat o $x]]}} # list_twin_primes proc under test, list_twin_primes and isprime procs are recursion limited proc list_twin_primesx { aa bb cc} { for {set i $aa} {$i<=$bb} {incr i $cc} { if {[isprime $i] && [isprime [+ $i $cc ]] } {lappend boo $i [+ $i $cc ] } } ; return $boo} proc list_twin_primes { aa bb cc} { for {set i $aa} {$i<=$bb} {incr i 1} { if {[isprime $i] && [isprime [+ $i $cc ] ] } { lappend boo $i [+ $i $cc ] } } ; return $boo} # aa is start number, bb is upper limit, cc is separator number, usually even 2 # The original Dickson conjecture has separator even numbers 2,4,6 ... ? # list_twin_primes 0 25 2 returns 3 5 5 7 11 13 17 19 # The sets <13 15> and <15 17> are separated by a even 2, # but left out of answer. # Note the 15 is not a prime number and has factors <3 5>. # The set <13 17> has two primes, but separated by an even 4. # reference On-Line Encyclopedia of Integer Sequences website # OEIS A077800 discussed that the twin prime sets <p,p+2> are # (3, 5), (5, 7), (11, 13), (17, 19), # (29, 31), (41, 43), (59, 61), (71, 73), # (101, 103), (107, 109), (137, 139)... # OEIS A275021 has samples of <p,p+4> and omits pairs of <p,p+2> # 79, 83, 127, 131, 163, 167, 379, 383, 397, 401, 439, 443,... # list_twin_primes 75 135 4 returns 79 83 103 107 127 131 # reference On-Line Encyclopedia of Integer Sequences website # OEIS A023201 has some samples of <p,p+6> # 5, 7, 11, 13, 17, 23, 31, 37, # 41, 47, 53, 61, 67, 73, 83, 97, 101 # contains redundant procs for testing puts "[list_twin_primes 3 25 2 ]" puts "[list_twin_primes 3 25 4 ]" puts "[list_twin_primes 3 25 6 ]"

table | Twin Primes for 2,4,6,10 Separators | printed in | TCL format | |
---|---|---|---|---|

result | lower limit | upper limit | separator integer | comment, if any |

elements in list | lower limit | upper limit | separator integer | comment, if any |

3 5 5 7 11 13 17 19 | 3 | 25 | 2 | |

3 7 7 11 13 17 19 23 | 3 | 25 | 4 | |

5 11 7 13 11 17 13 19 17 23 23 29 | 3 | 25 | 6 | |

3 13 7 17 13 23 19 29 | 3 | 25 | 10 |

gold Here are some one line procedures for circle area and law of cosines. See tcl::mathfunc cos pi constants Functions ::math::constants::constants and ::math::fibonacci are available in the TCLLIB.

proc pi {} {expr {acos(-1)}} #from AMG see below proc degtoradiansconst {} {return [ expr {180./[pi]} ]} proc degz {} {return [ expr {180./[pi]} ]} proc degx {aa} {return [ expr { [degz]*acos($aa) } ]} proc inrad {a b c} {return [expr {(sqrt(($a+$b+$c)*($a+$b-$c)*($a-$b+$c)*($b+$c-$a)))/(2.*($a+$b+$c)) } ] } proc circlediameter {radius} { return [ expr { 2.* $radius } ] } proc circlearea {radius} { return [ expr { [pi]*($radius**2) }]} proc circlecircumference {radius} {return [ expr {2.*[pi]*$radius }]} proc spherediameter {radius} {return [ expr { 2.* $radius }]} proc spherevolume {radius} { return [ expr { (4./3.)*[pi]*($radius**3) }]} proc spheresurface {radius} { return [ expr { 4.*[pi]*($radius**3) }]} proc cubevolume {aa} { return [ expr { 1.*$aa*$aa*$aa } ] } proc squarearea {aa} { return [ expr { 1.*$aa*$aa } ] } proc ellipsoidvolume {aa bb cc} { return [ expr { 1.*(4./3.)*[pi]*$aa*$bb*$cc } ] } proc ellipsearea1 { aa bb } {return [ expr { 1.*[pi]*$aa*$bb } ]} proc ellipseperimeterx {aa bb} { set tt [ expr { ($aa*$aa+$bb*$bb)/2.}];return [ expr { 2.*[pi]*sqrt($tt)} ] } proc spherevolumex {aa } { return [ expr { 1.*(4./3.)*[pi]*$aa*$aa*$aa } ] } proc spheroidvolumex {aa cc } { return [ expr { 1.*(4./3.)*[pi]*$aa*$aa*$cc } ] } proc torusvolumex {aa bb } { return [ expr {(1./4.) *[pi]*[pi] * ($aa + $bb) * ($aa - $bb)*2.}] } proc torussurfacex {aa bb } { return [ expr { [pi]*[pi] * ($aa*$aa - $bb*$bb) }] } proc conesurfacex {aa rr } { return [ expr { [pi]*$rr*$aa}] } proc cylindersurfacesidex {aa rr } { return [ expr {2.* [pi]*$rr*$aa}] } proc cylinderwholesurfacesidex {aa rr } { return [ expr {2.* [pi]*$rr*$aa +2.*[pi]*$rr*$rr}] } proc cylindervolumesidex {aa rr } { return [ expr { [pi]*$rr*$rr*$aa}] } proc conevolumex {aa rr } { return [ expr { (1./3.)*[pi]*$rr*$rr*$aa}] } proc pyramidvolumex {aa bb cc } { return [ expr { (1./3.)*$aa*$bb*$cc }] } proc rectangularprismvolumex {aa bb cc } { return [ expr { $aa*$bb*$cc }] } proc triangularprismvolumex {aa bb cc } { return [ expr { $aa*$bb*$cc*.5 }] } proc polygonperimeterx {aa bb } { return [ expr { $aa*$bb}] } proc rectangleperimeterx {aa bb } { return [ expr {2.*( $aa+$bb)}] } proc parallelogramperimeterx {aa bb } { return [ expr {2.*( $aa+$bb)}] } proc triangleperimeterx {aa bb cc} { return [ expr { $aa+$bb+$cc }] } proc triangletrapezoidx {aa bb cc} { return [ expr { $aa*($bb+$cc)*(1./2.) }] } #law of cosines, aa bb cc are three sides of right triangle, here ordered #as aa small side , bb middle side, cc largest side. # inrad is radius of cirle inscribed in right triangle, # use sides as inrad aa bb cc proc anglecosa { aa bb cc } {return [ expr { ($bb*$bb+$cc*$cc-$aa*$aa)/(2.*$bb*$cc) }]} proc anglecosb { aa bb cc } {return [ expr { ($cc*$cc+$aa*$aa-$bb*$bb)/(2.*$aa*$cc) }]} proc anglecosc { aa bb cc } { return [ expr { ($aa*$aa+$bb*$bb-$cc*$cc)/(2.*$aa*$bb) }]} #with examples #for radius of 1 #circlediameter 1 #circlearea 1 #circlecircumference 1 #spherediameter 1 #spherevolume 1 #spheresurface 1 #inrad 3 4 5 #anglecosa 3 4 5 #anglecosb 3 4 5 #anglecosc 3 4 5 # following include redundant TCL one liner procedures for sqrt of sum of squares # sqrt of sum of squares and diagonal using expr proc diagonal_1 {aa bb} {[expr { sqrt($aa * $aa + $bb * $bb)}] } # Usage diagonal 1 1 returns 1.4142135623730951 # diagonal using math ops proc diagonal_2 {aa bb} {[sqrt [+ [* $aa $aa] [* $bb $bb] ] ]} # Usage diagonal_2 1 1 returns 1.4142135623730951 # diagonal using math hypot function proc diagonal_3{aa bb} {[ hypot $aa $bb ]} # Usage diagonal_3 1 1 returns 1.4142135623730951 # time one liners, but sticking >> [ time { set qq [ diagonal_1 1 1 ] } ] proc diagonal_1x {aa bb} { [ time [sqrt [+ [* $aa $aa] [* $bb $bb] ] ]]}

# Sample of TCL One Liner Procedures V2 # written on Windows 10 on TCL 8.6 # working under TCL version 8.6 # gold on TCL Club , 9/20/2020 # Ref. WIKI BOOKS, Tcl_Programming_Introduction pdf # Book Section contrasts one liners procedures # versus traditional procedural approach. # Below contains redundant One Liner procedures # to contrast alternate techniques and constructs # start modifications package require Tcl 8.6 package require math::numtheory package require math::constants package require math::trig package require math namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory math::trig math::constants } set tclprecision 17 console show # following dresses up console output to easy eye console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} puts "Admiral begins operations " # changes: shifted text, removed empty lines, added easy eye console to deck. # end modifications console show console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} namespace path {::tcl::mathop ::tcl::mathfunc} # contains redundant procs for testing one liner procedures V2 proc pi {} {expr {acos(-1)}} # proc pi from AMG see below proc degtoradiansconst {} { expr {180./ [pi] }} proc degz {} { expr {180./ [pi] }} proc degx {aa} { expr { degz *acos($aa)}} proc inrad {a b c} { expr {(sqrt(($a+$b+$c)*($a+$b-$c)*($a-$b+$c)*($b+$c-$a)))/(2.*($a+$b+$c))}} proc circlediameter {radius} { expr { 2.* $radius }} proc circlearea {radius} { expr { [pi] *($radius**2)}} proc circlecircumference {radius} { expr {2.* [pi] *$radius }} proc spherediameter {radius} { expr { 2.* $radius }} proc spherevolume {radius} { expr { (4./3.)* [pi] *($radius**3)}} proc spheresurface {radius} { expr { 4.* [pi] *($radius**3)}} proc cubevolume {aa} { expr { 1.*$aa*$aa*$aa }} proc squarearea {aa} { expr { 1.*$aa*$aa }} proc ellipsoidvolume {aa bb cc} { expr { 1.*(4./3.)* [pi] *$aa*$bb*$cc }} proc ellipsearea1 { aa bb } { expr { 1.* [pi] *$aa*$bb }} proc ellipseperimeterx {aa bb} { set tt [ expr { ($aa*$aa+$bb*$bb)/2.}];return [ expr { 2.*[pi]*sqrt($tt)} ] } proc spherevolumex {aa } { expr { 1.*(4./3.)* [pi] *$aa*$aa*$aa }} proc spheroidvolumex {aa cc } { expr { 1.*(4./3.)* [pi] *$aa*$aa*$cc }} proc torusvolumex {aa bb } { expr {(1./4.) * [pi] * [pi] * ($aa + $bb) * ($aa - $bb)*2.}} proc torussurfacex {aa bb } { expr { [pi] * [pi] * ($aa*$aa - $bb*$bb)}} proc conesurfacex {aa rr } { expr { [pi] *$rr*$aa}} proc cylindersurfacesidex {aa rr } { expr {2.* [pi] *$rr*$aa}} proc cylinderwholesurfacesidex {aa rr } { expr {2.* [pi] *$rr*$aa +2.* [pi] *$rr*$rr}} proc cylindervolumesidex {aa rr } { expr { [pi] *$rr*$rr*$aa}} proc conevolumex {aa rr } { expr { (1./3.)* [pi] *$rr*$rr*$aa}} proc pyramidvolumex {aa bb cc } { expr {(1./3.)*$aa*$bb*$cc }} proc rectangularprismvolumex {aa bb cc } { expr { $aa*$bb*$cc }} proc triangularprismvolumex {aa bb cc } { expr { $aa*$bb*$cc*.5 }} proc polygonperimeterx {aa bb } { expr { $aa*$bb}} proc rectangleperimeterx {aa bb } { expr {2.*( $aa+$bb)}} proc parallelogramperimeterx {aa bb } { expr {2.*( $aa+$bb)}} proc triangleperimeterx {aa bb cc} { expr { $aa+$bb+$cc }} proc triangletrapezoidx {aa bb cc} { expr { $aa*($bb+$cc)*(1./2.)}} #law of cosines, aa bb cc are three sides of right triangle, here ordered #as aa small side , bb middle side, cc largest side. # inrad is radius of cirle inscribed in right triangle, # use sides as inrad aa bb cc proc anglecosa { aa bb cc } { expr {($bb*$bb+$cc*$cc-$aa*$aa)/(2.*$bb*$cc)}} proc anglecosb { aa bb cc } { expr {($cc*$cc+$aa*$aa-$bb*$bb)/(2.*$aa*$cc)}} proc anglecosc { aa bb cc } { expr {($aa*$aa+$bb*$bb-$cc*$cc)/(2.*$aa*$bb)}} #with examples #for radius of 1 #circlediameter 1 #circlearea 1 #circlecircumference 1 #spherediameter 1 #spherevolume 1 #spheresurface 1 #inrad 3 4 5 #anglecosa 3 4 5 #anglecosb 3 4 5 #anglecosc 3 4 5 # following include redundant TCL one liner procedures for sqrt of sum of squares # sqrt of sum of squares and diagonal using expr proc diagonal_1 {aa bb} { expr { sqrt($aa * $aa + $bb * $bb)}} # Usage diagonal 1 1 s 1.4142135623730951 # maturity value of loan using TCL 8.6 math ops, 10Sep2020 # similar formula for time in days divide years by 360. # similar formula for interest rate in percent, divide interest by 100. # should work with any currency and just use consistent units. # maintain isolating spaces in TCL math ops proc maturity_value_loan { principal interest years} { [* $principal [+ 1. [* 1. $interest $years ]]] } # Usage maturity_value_loan 100. .05 1. returns 105. proc maturity_value_loan_percent { principal percent_i years} { [* $principal [+ 1. [* 1. [/ $percent_i 100.] $years ]]] } # Usage maturity_value_loan_percent 100. 5. 1. returns 105. proc maturity_value_loan_days { principal interest days} { [* $principal [+ 1. [* 1. $interest [/ $days 360. ]]]] } # Usage maturity_value_loan_days 100. .05 360. returns 105. # following proc session invoke TCLLIB math::trig library proc pyramid_d {hh bb} { [ acotand [expr (.5*$bb/$hh) ]] } proc pyra_d {hh bb} { [ acotand [* .5 [/ $bb $hh] ]] } # Usage pyramid_degrees 57.692 106.346 answer 47.334157521261254 # hh is height of pyramid, units cancel out # bb is base length of pyramid # seked = (7 * .5 * 360 cubits) / 250 cubits = 5.04 decimal palms proc seked_d {hh bb} { [/ [* 7. .5 $bb ] $hh ] } # usage seked_d 250. 360. equals 5.04 # end TCLLIB # hbA1c_convert_to_average_blood_glucose mg/dl HbA1c proc a1c hbA1c { expr { 35.6*$hbA1c -77.3} } # convert mg/dl to mmol/L average blood glucose # some papers round off 18.016 to mgdl/18. proc mgdl_to_mmoll mgdl { expr { $mgdl/18.0 } } # convert mmol/L to mg/dl average blood glucose proc mmoll_to_mgdl mmoll { expr { $mmoll*18.0 } } # *************************************8 # mean_speed_1 is defined as apparent velocity # of Jupiter along Zodiac in degrees per day # mean_speed_1 = [ expr { .5 * (velocity_1 - velocity_0 )} ] proc mean_speed_1 {velocity_1 velocity_0} { expr { .5 * ($velocity_1 - $velocity_0 )} } # Usage mean_speed_1 1.5 .5 for 1.5 and 0.5 speeds in degrees per day returns 1. # ******************************* # adding_two_fractions aa/bb + cc/dd = # ((aa *dd*1.))+(bb*cc*1.))/(bb*dd*1.), # but must insert 1. factor to return real numbers in TCL math ops proc adding_two_fractions { aa bb cc dd } { [/ [+ [* $aa $dd 1. ] [* $bb $cc 1. ]] [* $bb $dd 1.] ] } # suggest maintain spaces in math ops # Usage adding_two_fractions 1.0 1.0 1.0 1.0 returns 2.0 # Usage adding_two_fractions 1 1 1 1 returns 2.0 # Usage adding_two_fractions 1. 2. 1. 2. returns 1.0 # subtracting_two_fractions aa/bb - cc/dd = # ((aa *dd*1.))-(bb*cc*1.))/(bb*dd*1.), # but must insert 1. factor to return real numbers in TCL math ops proc subtracting_two_fractions { aa bb cc dd } { [/ [- [* $aa $dd 1. ] [* $bb $cc 1. ]] [* $bb $dd 1.] ] } # subtracting_two_fractions 1. 2. 1. 4. returns 0.25 # subtracting_two_fractions 1. 1. 1. 1. returns 0.0 # subtracting_two_fractions 1 1 1 1 returns 0.0 # multiplying_two_fractions proc multiplying_two_fractions { aa bb cc dd } { [/ [* $aa $cc 1. ] [* $bb $dd 1. ] ] } # multiplying_two_fractions 1. 2. 1. 2. returns 0.25 # multiplying_two_fractions 1. 1. 1. 1. returns 1,0 # multiplying_two_fractions 1 1 1 1 returns 1.0 # dividing_two_fractions # but must insert 1. factor to return real numbers in TCL math ops proc dividing_two_fractions { aa bb cc dd } { [/ [* $aa $dd 1. ] [* $bb $cc 1. ] ] } # dividing_two_fractions 1. 1. 1. 2. returns 2. # dividing_two_fractions 1. 1. 1. 1. returns 1.0 # dividing_two_fractions 1 1 1 1 returns 1.0 # ******************************** proc bodes_law_1 { nn } { return [+ 0.4 [* 0.3 [pow 2 $nn]]] } # Usage bodes_law_1 1 returns 1.0 Astronomical units for planet Earth # Usage bodes_law_1 2 returns 0.7 AU for planet Venus # Usage bodes_law_1 3 returns 1.6 AU for planet Mars proc bodes_law_2 {} { foreach nn {0 1 2 3 4 5 6 7} { lappend planets [+ 0.4 [* 0.3 [pow 2 $nn]]]};return $planets} # Usage bodes_law_2 returns list 0.7 1.0 1.6 2.8 5.2 10.0 19.59 38.8 puts " out "

# pretty print from autoindent and ased editor # One Liners Procedures V2 # written on Windows 10 on TCL # working under TCL version 8.6 # gold on TCL Club , 10Sep2020 package require Tk package require math::numtheory package require math::constants package require math::trig package require math namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory math::trig math::constants } set tclprecision 17 # following dresses up console output to easy eye console show console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} console eval {wm title . " One Liners Report , screen grab and paste from console 2 to texteditor"} console eval {. configure -background orange -highlightcolor brown -relief raised -border 30} # blank table addition puts "%|table |printed in| tcl wiki format|% " puts "&| quantity| value| comment, if any|& " puts "&| testcase number:| |&" puts "&| value |quantity 1 | |&" proc pi {} {expr {acos(-1)}} # proc pi from AMG see below # ******surface and area calculations ****** proc degtoradiansconst {} { expr {180./ [pi] }} proc degz {} { expr {180./ [pi] }} proc degx {aa} { expr { degz *acos($aa)}} proc inrad {a b c} { expr {(sqrt(($a+$b+$c)*($a+$b-$c)*($a-$b+$c)*($b+$c-$a)))/(2.*($a+$b+$c))}} proc circlediameter {radius} { expr { 2.* $radius }} proc circlearea {radius} { expr { [pi] *($radius**2)}} proc circlecircumference {radius} { expr {2.* [pi] *$radius }} proc spherediameter {radius} { expr { 2.* $radius }} proc spherevolume {radius} { expr { (4./3.)* [pi] *($radius**3)}} proc spheresurface {radius} { expr { 4.* [pi] *($radius**3)}} proc cubevolume {aa} { expr { 1.*$aa*$aa*$aa }} proc squarearea {aa} { expr { 1.*$aa*$aa }} proc ellipsoidvolume {aa bb cc} { expr { 1.*(4./3.)* [pi] *$aa*$bb*$cc }} proc ellipsearea1 { aa bb } { expr { 1.* [pi] *$aa*$bb }} proc ellipseperimeterx {aa bb} { set tt [ expr { ($aa*$aa+$bb*$bb)/2.}];return [ expr { 2.*[pi]*sqrt($tt)} ] } proc spherevolumex {aa } { expr { 1.*(4./3.)* [pi] *$aa*$aa*$aa }} proc spheroidvolumex {aa cc } { expr { 1.*(4./3.)* [pi] *$aa*$aa*$cc }} proc torusvolumex {aa bb } { expr {(1./4.) * [pi] * [pi] * ($aa + $bb) * ($aa - $bb)*2.}} proc torussurfacex {aa bb } { expr { [pi] * [pi] * ($aa*$aa - $bb*$bb)}} proc conesurfacex {aa rr } { expr { [pi] *$rr*$aa}} proc cylindersurfacesidex {aa rr } { expr {2.* [pi] *$rr*$aa}} proc cylinderwholesurfacesidex {aa rr } { expr {2.* [pi] *$rr*$aa +2.* [pi] *$rr*$rr}} proc cylindervolumesidex {aa rr } { expr { [pi] *$rr*$rr*$aa}} proc conevolumex {aa rr } { expr { (1./3.)* [pi] *$rr*$rr*$aa}} proc pyramidvolumex {aa bb cc } { expr {(1./3.)*$aa*$bb*$cc }} proc rectangularprismvolumex {aa bb cc } { expr { $aa*$bb*$cc }} proc triangularprismvolumex {aa bb cc } { expr { $aa*$bb*$cc*.5 }} proc polygonperimeterx {aa bb } { expr { $aa*$bb}} proc rectangleperimeterx {aa bb } { expr {2.*( $aa+$bb)}} proc parallelogramperimeterx {aa bb } { expr {2.*( $aa+$bb)}} proc triangleperimeterx {aa bb cc} { expr { $aa+$bb+$cc }} proc triangletrapezoidx {aa bb cc} { expr { $aa*($bb+$cc)*(1./2.)}} # law of cosines, aa bb cc are three sides of right triangle, here ordered # as aa small side , bb middle side, cc largest side. # inrad is radius of cirle inscribed in right triangle, # use sides as inrad aa bb cc proc anglecosa { aa bb cc } { expr {($bb*$bb+$cc*$cc-$aa*$aa)/(2.*$bb*$cc)}} proc anglecosb { aa bb cc } { expr {($cc*$cc+$aa*$aa-$bb*$bb)/(2.*$aa*$cc)}} proc anglecosc { aa bb cc } { expr {($aa*$aa+$bb*$bb-$cc*$cc)/(2.*$aa*$bb)}} # with examples # for radius of 1 # circlediameter 1 # circlearea 1 # circlecircumference 1 # spherediameter 1 # spherevolume 1 # spheresurface 1 # inrad 3 4 5 # anglecosa 3 4 5 # anglecosb 3 4 5 # anglecosc 3 4 5 # following include redundant TCL one liner procedures for sqrt of sum of squares # sqrt of sum of squares and diagonal using expr proc diagonal_1 {aa bb} { expr { sqrt($aa * $aa + $bb * $bb)}} # Usage diagonal 1 1 s 1.4142135623730951 # ***** simple interest section ******* # maturity value of loan using TCL 8.6 math ops, 10Sep2020 # similar formula for time in days divide years by 360. # similar formula for interest rate in percent, divide interest by 100. # should work with any currency and just use consistent units. # maintain isolating spaces in TCL math ops proc maturity_value_loan { principal interest years} { [* $principal [+ 1. [* 1. $interest $years ]]] } # Usage maturity_value_loan 100. .05 1. returns 105. proc maturity_value_loan_percent { principal percent_i years} { [* $principal [+ 1. [* 1. [/ $percent_i 100.] $years ]]] } # Usage maturity_value_loan_percent 100. 5. 1. returns 105. proc maturity_value_loan_days { principal interest days} { [* $principal [+ 1. [* 1. $interest [/ $days 360. ]]]] } # Usage maturity_value_loan_days 100. .05 360. returns 105. # ****** relative error in percent ***************************************** # error in percent is < attested value> over <calculated value> times 100. percent. # for relative error without percent, # < attested value> over <calculated value> times 1.0 # for relative error without percent, swap factor 100.0 to 1.0 proc percent_errorx {aa bb} { expr { $aa > $bb ? (($aa*1.)/$bb -1.)*100. : (($bb*1.)/$aa -1.)*100.}} # Effectively percent_errorx is returning an absolute value of error in percent # Usage percent_errorx 1.2 1.0 returns 19.99 percent # Usage percent_errorx 1.0 1.2 returns 19.99 percent # Usage percent_errorx 1.5 1.0 returns 50.0 percent proc error_relative {aa bb} { expr { $aa > $bb ? (($aa*1.)/$bb -1.)*1. : (($bb*1.)/$aa -1.)*1.}} proc error_relative {aa bb} { expr { $aa > $bb ? (($aa*1.)/$bb -1.)*1. : (($bb*1.)/$aa -1.)*1.}} # Usage error_relative 1.2 1.0 returns 0.199 # Usage error_relative 1.0 1.2 returns 0.199 # Usage error_relative 1.5 1.0 returns 0.50 puts " out "

# These statements should be pastable into the easy eye console. # ***** simple interest problems in TCL one liners procedures ***** # find simple interest amount from 3 entries as < principal interest years > proc simple_interest_amount { principal interest years } { expr { ($principal*1.)*(1.+$years*$interest )}} # Usage simple_interest_amount 5000. .05 7. returns 6750.0 # find simple interest principal from 3 entries as < amount interest years > proc simple_interest_principal { amount interest years } { expr { ($amount*1.)/(1.+$years*$interest )}} # Usage simple_interest_principal 6750.0 .05 7. returns 5000.0 # find simple interest rate from 3 entries as < amount principal years > proc simple_interest_rate { amount principal years } { expr { ((($amount*1.)/$principal)-1.)/$years }} # Usage simple_interest_rate 6750.0 5000. 7. returns 0.05 # find years of simple interest from 3 entries as < amount principal interest > proc simple_interest_years { amount principal interest } { expr { ((($amount*1.)/$principal)-1.)/$interest }} # Usage simple_interest_years 6750.0 5000. .05 returns 7.0 # ****** compound interest problems in TCL one liners procedures ****** # find compound interest amount from 4 entries as < principal interest years compounding_times_per_year > # cd is compounding times per year, usually 4 quarters or 12 months proc compound_interest_amount { principal interest years cd } { expr { ($principal*1.)*((1.+( $interest /$cd))**($years*$cd))}} # Usage compound_interest_amount 5000 .05 7 12 retuRns 7090.180 # find compound interest principal from 4 entries as < amount interest years cd > # cd is compounding times per year, usually 4 quarters or 12 months proc compound_interest_principal { amount interest years cd } { expr { $amount*( 1. +(($interest*1.)/$cd ) )**(-1.*$cd*$years)}} # Usage compound_interest_principal 7090.180 0.05 7 12 returns 4999.997, rounds to 5000. # find interest in compound interest from 4 entries as < amount principal years cd > # cd is compounding times per year, usually 4 quarters or 12 months proc compound_interest_interest { amount principal years cd } { expr { $cd*((($amount*1.0)/$principal)**(1./($cd*$years))-1.)}} # Usage compound_interest_interest 7090.180 5000. 7 12 returns 0.049, rounds to 0.05 # find years of compound interest from 4 entries as < amount principal interest cd> proc compound_interest_years { amount principal interest cd } { expr { (log10 (($amount*1.0)/$principal)) / ($cd*log10(1.+(($interest*1.)/$cd) ) ) }} # Usage compound_interest_years 7090.180 5000. 0.05 12 returns 6.99, rounds to 7 years # ******** continuous_compounding ******* based on exponential formulas and natural log. proc amount_continuous_compounding { principal interest years } { expr { $principal* exp ( $interest*$years*1. ) }} # Usage amount_continuous_compounding 5000. 0.05 7 returns 7095.3377 proc principal_continuous_compounding { amount interest years } { expr { $amount * exp ( $interest*$years* -1. ) }} #Usage principal_continuous_compounding 7095.33 0.05 7. returns 4999.994, rounds to 5000. proc interest_continuous_compounding { amount principal years } { expr { (log ( ($amount*1.) /$principal )) / ($years * log (exp(1.) ) ) }} # Usage interest_continuous_compounding 7095.33 5000. 7 returns 0.04999, rounds to 0.05 proc years_continuous_compounding { amount principal interest } { expr { (log ( ($amount*1.) /$principal )) / ($interest * log (exp(1.) ) ) }} # Usage years_continuous_compounding 7095.33 5000. 0.05 returns 6.999, rounds to 7 years

There is a gold mine of One Liners Programs and content in the Tool Control language TCL 8.6 core distribution, TCL manual pages, and TCLLIB library that can be adapted or recast into brief one liners programs. These one liners programs or procedures can be pasted into the TCL 8.6 console window for quick results, reference the TCL Wiki. Some one liners programs use the return statement, return $value, or return 1 to return the results to the program line. Although many TCL programmers just rely on the last computation being returned by the one liner procedure in the TCL console window. There is some room in the Wiki publications for programming style differences. But it is usually best to put usage, credits, or TCL documentation references for the one liners procedures on separate comment lines. The random procedures make use of the random function and do not return the same answer every time. Dependence on math operator notation, helper procedures, math check examples, and special library functions should be noted in the comment lines.

There are pros and cons to one liner programs in TCL. One may contrast the approach to one liners programs in problem solving versus the traditional procedural approach. There are better routines and methods in faster language constructs in the current TCL core distribution and TCLLIB. Working with recursion, primes, text search, and timing the procedures will quickly show the warts on the one liners programs. To gain speed and shorter computation times, one will generally have to access the TCL core distribution and TCLLIB. Since the TCL interpreter collapses the carriage returns, skips, blank lines, and dead space of traditional written procedures into a single line of machine code, is not every script a one liner program to the parser? As grandfather remarked, the gourmet omelet, beef mulligan stew, and farm buttermilk all go to the same place.

WIKI BOOKS, Programming_Examples pdf WIKI BOOKS, Tcl_Programming_Introduction pdf license https://creativecommons.org/licenses/by-sa/3.0/legalcode creativecommons.org/licenses/by-sa/3.0/ en.wikibooks.org/wiki/Tcl_Programming_Introduction Sample Math Programs, item 2, RS TCLLIB math::mean is quicker by a third over some homebrew code. Additional math functions https://www.quora.com/What-are-the-most-useful-Swiss-army-knife-one-liners-on-Unix-That-is-what-is-your-favorite-one-liner-command-that-handles-a-task-usually-delegated-to-a-much-more-verbose-program-written-in-a-high-level-language http://www.codecodex.com/wiki SOURCE CODE SEARCH ENGINES, INCLUDE TCL???? Google Code Search Koders Krugle Google Code Search Koders Krugle Protecode REFERENCES http://www.codecodex.com/wiki https://www.openhub.net/p?ref=homepage&query=tcl https://en.wikipedia.org/wiki/Portal:Computer_programming https://en.wikipedia.org/wiki/Portal:Free_and_open-source_software https://en.wikipedia.org/wiki/Protecode https://en.wikipedia.org/wiki/List_of_search_engines#Source_code https://blog.robertelder.org/don-libes-expect-unix-automation-tool/

Question from member AV in Russia. So small basic interpreter... Who used small basic interpreters?

A. ## The original tiny basic was distributed in assembler code for the Altair and the 8080 circuit board. Essentially, tiny_basic is a historic legacy of mankind. The original Altair BASIC was about 150 dollars each. Some USA programmers in the 1970s gave away tiny_basic free to break the monopoly. tiny_basic was the first freeware or free software package widely given to the masses (circa 1970). In Russian terms, tiny_basic is the Battleship_Potemkin of computer geeks.

$$$$ The analogy of using tiny_basic to control the large TCL language is like sticking an Apple computer for the human operator in front of a Cray computer. The human mind probably can only understand and use a limited set of instructions, an interface in hardware or TCL? language as a limited set of instructions might be useful. After all, the human mind was designed to chase rabbits.

$$ mostly as a retiree, i am trying to freshen up tcl content on the tcl wiki, adding screenshoots and what meager code i can gin up. I have my limitations, but I am learning.

# conventional expr math operation # factor 1. forces expression to floating point proc commission { commission sales } {expr {1.* $commission * $sales}} # Usage commission .10 100. returns 10.0 # Using math operations notation for speed proc commission_2 { commission sales } {* 1. $commission $sales } # Usage commission_2 .1 100 returns 10.0 # ******************************* # commission_rate = commission over sales set commission_rate {expr {1.*$commission / $sales}} # conventional expr math operation proc commission_rate { commission sales } {expr {1.* $commission / $sales}} # using math operations notation proc commission_rate_2 { commission sales } [/ [* 1. $commission ] $sales ] proc commission_rate_2 100. 10. proc commission_sales_2 { commission sales } {expr {1.* $commission *$sales}}

# pretty print from autoindent and ased editor # Parametric Model Vaporware V2 # written on Windows 10 on TCL # working under TCL version 8.6 # gold on TCL Club, 4Oct2020 # charting based on rotated ellipse by Gerard Sookahet # gold added push buttons calculatorand housekeeping # using dummy calculations for parametric eq. calc. package require Tk package require math::numtheory # added statements for TCLLIB library package require math::numtheory package require math::constants package require math::trig package require math namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory math::trig math::constants } # Tried to keep clean GS code in upper section set tcl_precision 17 proc pie {} {expr acos(-1)} ;# AMG # Section EllipseRotate.tcl # Section proc EllipseRotate Author: Gerard Sookahet # Date: 09 March 2019 # Version: 0.1 # Description: Simple graphical example of parametric equation of rotated ellipse # # xo,yo : center of the ellipse # angle : rotation angle from 0 to 7 with the scalebar # a : major radius # b : minor radius # t : parameter bind all <Escape> {exit} # Section proc Author: Gerard Sookahet proc EllipseRotate {xo yo a b angle t} { global side1 side2 side3 side4 side5 global side6 side7 side8 set cosa [expr {cos($angle)}] set sina [expr {sin($angle)}] set cost [expr {cos($t)}] set sint [expr {sin($t)}] set x [expr {$xo + $a*$cosa*$cost - $b*$sina*$sint}] set y [expr {$yo + $a*$sina*$cost + $b*$cosa*$sint}] return [list $x $y] } proc EllipsePlot {w xo yo a b pi angle} { $w delete all lassign [EllipseRotate $xo $yo $a $b $angle 0] x2 y2 for {set p 0} {$p <= 720} {incr p} { set t [expr {$pi*$p/360}] lassign [EllipseRotate $xo $yo $a $b $angle $t] x1 y1 .c create line $x1 $y1 $x2 $y2 -fill blue -width 3 set x2 $x1 set y2 $y1 } } # fallback settings #set width 600 #set height 400 set width 800 set height 500 set pi 3.1415926 set xo [expr {$width/2}] set yo [expr {$height/2}] set a 200 set b 100 set angle [expr {$pi/6}] #pack [canvas .c -width $width -height $height -background black] #pack [scale .sc -from 0 -to 7 -length 240 -resolution .1 \ -orient horiz -bd 1 -showvalue true -variable angle \ -command {EllipsePlot .c $::xo $::yo $::a $::b $::pi}] 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 {{} {parameter 1:} } lappend names {parameter 2:} lappend names {parameter 3:} lappend names {parameter 4:} lappend names {parameter 5:} lappend names {parameter 6:} lappend names {parameter 7:} lappend names {parameter 8:} 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 Parametric Model Vaporware V2 from TCL , # gold on TCL Club, 10Jul2020 " tk_messageBox -title "About" -message $msg } proc self_help {} { set msg "Calculator for Parametric Model Vaporware V2 from TCL , # self help listing # 4 givens follow. 1) parameter 1: 2) parameter 1: 3) parameter 1: 4) parameter 1: # 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 # copyrighted under the TCL/TK 8.6 license terms. # Editorial rights retained under the TCL/TK license terms # and will be defended as necessary in court. # gold on TCL Club, 2Oct2020 " tk_messageBox -title "About" -message $msg } # uses join, but computer time on some? proc mean_1 list {expr double([join $list +])/[llength $list]} # math operators exposed as commands, and the expand operator # math operators exposed as commands, and the expand operator proc mean_2 list {expr {[tcl::mathop::+ {*}$list]/double([llength $list])}} # import the tcl::mathop operators proc mean_3 list {expr {[+ {*}$list]/double([llength $list])}} # import the tcl::mathop operators from <Summing a list> proc table_calc {value} { # computer drag time sensitive on limit variable set limit 3 # should apply to at my parametric model # a list of values (w_list) with cycle for. # In each step the code must set 3 coefficients (k1,k2,k3) # copy original format internet query set w_list [list 0.12 0.14 0.16 0.18 0.20 ]; set k1_list [list {1.080} {1.101} {1.123} {1.144} {1.166}]; set k2_list [list {1.116} {1.213} {1.260} {1.309} {1.360}]; set k3_list [list {1.915} {2.157} {2.402} {2.649} {2.898}]; # gold does not use braces around list elements, left as original # copy of original format in internet query # setting table of dummy calculations # with data supplied in internet query puts "%|table| | printed in|TCL format |% " puts "&| session| proc & mean value| elements in list | comment, if any|& " for { set i 0 } { $i <= $limit } { incr i } { # may leave redundant or fallback statements in draft program # set lister { 1 2 4 5 6 7 8 9 10 } set lister { 0.12 0.14 0.16 0.18 0.20 } lappend lister [* $i [pie]] puts "&|$i | mean_1 [ mean_1 $lister ]| $lister | $k1_list | [ mean_1 $k1_list ] |&" puts "&|$i | mean_2 [ mean_2 $lister ]| $lister | $k2_list | [ mean_2 $k2_list ] |&" puts "&|$i | mean_3 [ mean_3 $lister ]| $lister | $k2_list | [ mean_3 $k3_list ] |&" }} 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 side5 1. set side6 1. set side7 1. set side8 1. table_calc 1 set w_list [list 0.12 0.14 0.16 0.18 0.20 ] set velocity_0 $side1 set velocity_1 $side2 set base_line [ expr { abs ( $side4 - $side3 )} ] set calculation_1 [ expr { .5 * ( $side1 + $side2 ) * 60. } ] set bisection_1 [ expr { .5 * $calculation_1 } ] set bisection_velocity_c [ expr { ((($velocity_0)**2 +($velocity_1)**2)/2.)**.5 }] set bisection_time_c [ expr { $base_line * ( $velocity_0 - $bisection_velocity_c ) / ( $velocity_0 - $velocity_1 ) }] set side5 $bisection_velocity_c set side6 $bisection_1 set side7 $bisection_time_c set side8 $calculation_1 set side1 [* $side1 100. ] set side2 [* $side2 100. ] set side3 [* $side3 100. ] set side4 [* $side4 100. ] set side5 [* $side5 100. ] set side6 [* $side6 100. ] set side7 [* $side7 100. ] set side8 [* $side8 100. ] } 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; console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} console eval {wm title . " Parametric Model Vaporware V2 Report , screen grab and paste from console 2 to texteditor"} console eval {. configure -background orange -highlightcolor brown -relief raised -border 30} puts "%|table $testcase_number|printed in| tcl format|% " puts "&| quantity| value| comment, if any|& " puts "&| $testcase_number:|testcase_number | |&" puts "&| $side1 :|parameter 1: | |&" puts "&| $side2 :|parameter 2: | |& " puts "&| $side3 :|parameter 3: | |& " puts "&| $side4 :|parameter 4: | |&" puts "&| $side5 :|parameter 5:| | |&" puts "&| $side6 :|parameter 6:| | |&" puts "&| $side7 :|parameter 7:| | |&" puts "&| $side8 :|parameter 8:| | |&" } frame .buttons -bg aquamarine4 ::ttk::button .calculator -text "Solve" -command { calculate } ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 1.080 1.101 1.123 1.144 1.116 1.0 1.0 1.0 } ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 1.116 1.213 1.260 1.309 1.360 1.0 1.0 1.0 } ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 1.915 2.157 2.402 2.649 2.649 1.0 1.0 1.00 } ::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 .console2 -text report -command { reportx } ::ttk::button .exit -text exit -command {exit} canvas .c -width $width -height $height -background black scale .sc -from 0 -to 7 -length 240 -resolution .1 \ -orient horiz -bd 1 -showvalue true -variable angle \ -command {puts " display scale $side1 $side2 $side3 $side4 [pie]"; EllipsePlot .c $side1 $side2 $side3 $side4 [pie]} pack .c .sc .calculator -in .buttons -side top -padx 10 -pady 5 pack .clearallx .console2 .self_help .about .exit .test4 .test3 .test2 -side left -in .buttons grid .frame .buttons -sticky ns -pady {0 10} . configure -background aquamarine4 -highlightcolor brown -relief raised -border 30 wm title . " Parametric Model Vaporware V2" # gold on TCL Club, 8Jul2020 # This posting, screenshots, and TCL source code is # copyrighted under the TCL/TK 8.6 license terms. # Editorial rights retained under the TCL/TK license terms # and will be defended as necessary in court. # end of file

;# for starting the adventure to infinity and beyond. ;# Titius-Bode set < Earth = 1 ... > as number assignment scheme for planets ;# The Asteriod Ceres is included on most number assignment schemes ;# Ceres represents the Asteriod belt between Mars and Jupiter. ;# The dwarf planet Pluto is included on most number assignment schemes. proc titius_bode_law_1772 {aa } {expr { (4. + 3 * 2**$aa)*.1 } } ;# ;# $nn=l for Earth,2,... ;# Other planet number schemes are for power laws are available here, < Mercury = 1 ...> ;# from Gaussin (1880) and Armellini (1921) proc gaussin_formula_1880 {nn} {expr {0.2099 * (1.7226 ** $nn)} } ;# $nn=l for Mercury,2,...9 proc armellini_formula_1921 {nn} {expr {0.283 * (1.53 ** $nn)} } ;# $nn=l for Mercury,2,...11 ;# very interesting, Nicolini transformed planet number scheme in Titius_Bode ;# to < Mercury = 1 ...>, refer to Nicolini proc nicolini_formula_1957 {nn} {expr {0.4 + 0.075 * (2. ** $nn)} } ;# $nn=l for Mercury,2,... proc basano_hughes_formula_1979 {nn} {expr {0.285 * (1.523 ** $nn)} } ;# $nn=l for Mercury, 2,... ;# Sven-Ingmar Ragnarsson, 1994, modeled Jupiter and the outer planets to Uranus, separately. ;# See the Ragnarsson paper, setting these planet assignment numbers is tricky. ;# $nn=0 for Jupiter, 2 = Saturn, 3 = Uranus .... proc ragnarsson_formula_1979 {nn} {expr {5.203*(((5./2.)**(2./3.))**$nn) )} } ;# $nn=0 for Jupiter, 2 = Saturn,... proc list_integers { aa bb} { for {set i 1} {$i<=$bb} {incr i} {lappend boo [* 1. $i ] [* $i 1.]};return $boo} ;# usage, list_integers 1 10 ;# set answer_list_integers = [list 1.0 1.0 2.0 2.0 3.0 3.0 4.0 4.0 5.0 5.0 6.0 6.0 7.0 7.0 8.0 8.0 9.0 9.0 10.0 10.0 ] proc list_titius_bode { aa bb} { for {set i 1} {$i<=$bb} {incr i} {lappend boo [* 1. $i ] [expr { (4. + 3. * 2**$i)*.1}]};if {$i > $bb} {return $boo}} ;# Usage list_titius_bode 1 6 ;# set answer [ list 1.0 1.0 2.0 1.6 3.0 2.8 4.0 5.2 5.0 10.0 6.0 19.6] proc list_gaussin_formula { aa bb} { for {set ii 1} {$ii<=$bb} {incr ii} {lappend boo [* 1. $ii ] [expr {0.2099 * (1.7226 ** $ii)} ]};if {$ii > $bb} {return $boo}} ;# Usage list_gaussin_formula 1 6 ;# set answer_gaussin [ list 1.0 0.36 2.0 0.62 3.0 1.07 4.0 1.84 5.0 3.18 6.0 5.48 ] proc list_armellini_formula { aa bb} { for {set ii 1} {$ii<=$bb} {incr ii} {lappend boo [* 1. $ii ] [expr {0.283 * (1.53 ** $ii)}]};if {$ii > $bb} {return $boo}} ;# Usage list_armellini_formula 1 7 ;# set answer_armellini [ 1.0 0.43 2.0 0.66 3.0 1.013 4.0 1.55 5.0 2.37 6.0 3.63 7.0 5.55 ]

Can someone show some sample Cerda calculations on say, Mars and Jupiter. ? What is parameter or function D, not obvious from text. I have programmed the Titius_Bode equation into a Tool Control language TCL program and very interested in programming the Cerda calculations also. Quote: In Tratado de Astronomía, Cerdà obtaines (sp) the planetary distances from the orbital periods by applying Kepler's third law, with an accuracy of 10−3 . Maybe there is a contact interested in working on this item? Thank you.

Taylor series for tangent

;# puts taylor tangent series into pade tangent ;# of rational numbers ratio into horners form ;# num/denum=(1/45*$x**9 - 22*$x**7 + 3003*$x**5 - 105105*$x**3 + 765765*$x)/($x**8 - 308*$x**6 + 21021*$x**4 - 360360*$x**2 + 765765) ;# num=1/45*(((($x**2 - 990)*$x**2 + 135135)*$x**2 - 4729725)*$x**2 + 34459425)*$x ;# denum=((($x**2 - 308)*$x**2 + 21021)*$x**2 - 360360)*$x**2 + 765765 symdiff {(1/45.*$x**9 - 22*$x**7 + 3003*$x**5 - 105105*$x**3 + 765765*$x)} x ((((((9 * pow($x, 8)) * (1 / 45.)) - ((7 * pow($x, 6)) * 22)) + ((5 * pow($x, 4)) * 3003)) - ((3 * pow($x, 2)) * 105105)) + 765765.0) symdiff {($x**8 - 308*$x**6 + 21021*$x**4 - 360360*$x**2 + 765765)} x ((((8 * pow($x, 7)) - ((6 * pow($x, 5)) * 308)) + ((4 * pow($x, 3)) * 21021)) - ((2 * $x) * 360360))

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

- User Page for Gold
- Introduction and Greetings
- Revamped Projects under Nikit, actions post 1Dec2018
- Projects under old wiki
- Projects to be updated
- Philosophy On One Liners Programs from One Liners Programs Compendium
- Reposted Tips from AMG & GWM & Wiki for One Liners Programs
- Flexible Push Button Operation in TCL calculator
- 2021 Newsflash, TCLLIB has twin primes and cousin primes routines in TCLLIB:math ticket pipeline
- Use of Global Variables in TCL GUIS
- Maybe partially solved, trouble accessing the TCL WIKI from USA on some restaurant WIFI's?
- Possible Bias of base 2 and 3 in near field?
- Subroutine Template
- sqrt_sum_of_squares
- output for sqrt_sum_of_squares
- Modify discrete events on tugboats_tester3
- Equivalent One Liners V2
- Timing Equivalent One Liners V2
- Table of Timing 4 Procs
- bits and pieces, Testing One Liner Programs
- One Liners from www.codecodex.com/wiki
- Testing One Liner Program for list_twin_primes V2
- Table Results on Twin Primes for 2,4,6,10 Separators
- Older TCL4 reserve
- Sample of TCL One Liner Procedures V2
- Draft Wikipedia article on One Liners Programs , TCL Tool Control Language
- CREDITS ON ONE LINERS
- Appendix: One Liner Procs for Modeling Planetary Distances using Titius-Bode Law and other power laws
- Under Titius_Bode , Wikipedia page.
- Modeling Planetary Distances using Titius-Bode Law and and TCL demo example calculator, numerical analysis
- Preface
- Introduction
- Many Distance formulas with different assignment numbers
- Revolution Periods and Distance of Planets from the Sun
- Horse Race for Least Squares Fits and Online Curve Fitter
- Original Armellini power law
- The Wave-Particle theory of the Solar System
- Considerations for Code and Titius-Bode formulas into TCL code
- Pushbutton Operation
- Conclusions
- Testcases Section
- Screenshots Section
- figure 1. screenshot
- figure 2. Calculator_report
- figure 3. Modeling_Planetary_Distances_log_plot
- figure 3b. Modeling_Planetary_Distances_log_plot_titius_bode
- figure 3c. Modeling_Planetary_Distances_plot_titius_bode_vs_gaussin
- figure 3d. Modeling_Planetary_Distances_gaussin
- figure 3e. Modeling_Planetary_Distances_armenelli
- figure 3f. Modeling_Planetary_Distances_wurm
- figure 4a. Modeling_Planetary_Distances_log_plot_measured_data
- figure 4d. log_plot_Fibonnaci_sequence
- figure 4a.power_law
- figure 4c. power_ln_law
- figure 5.gas_giants
- figure 6. Power law curve fit in red line, e-function curve fit in green line
- figure 7. first_6_points,Power law curve fit in red line, e-function curve fit in green line
- figure 8. power_law

- *figure 9a.Modeling_Planetary_Distances reference to the normalized_bohr_atom_1913
- *figure 9b.Modeling_Planetary_Distances_Solar standing_wave
- References:
- References: Planets, Titius–Bode law
- * Pretty Print Version
- Scrap code, Pertains to other formulas *
- formula from Sven-Ingmar Ragnarsson, 1994
- Points for curve fitting

- Hidden Comments Section
- Hidden Comments Section

gold 20aug2020 Here are some calculations modeling planetary distances using the Titius-Bode Law. The Titius-Bode Law is primarily of historical interest. But the Titius-Bode is a good exercise in matching the available data.

The Titius-Bode Law makes simple assumptions and formulas to model planetary distances by scaling powers of 2. As another accuracy issue, the measured Planetary Distances are identified as non-linear function(s) in the log plots. Reported different velocity estimates in the program and the numerous references involve different assumptions and formulas. In the code, after computing the Titius-Bode output as historical numbers, subsequent formulas are scaled, changed, and different assumptions are changed from the original Titius-Bode formulas.

There are some simple formulas modeling planetary distances using the Titius-Bode Law and other power laws. The Titius-Bode Law is primarily of historical interest. The Titius-Bode law estimated rough distances in Astronomical Units (AU) of Planets from the Sun by scaling powers of 2 in a power law, Johann Elert Bode, pub 1772. There are usually different number assignments for each planet in each formula scheme. The simplest formula number scheme is used here, starting with **< Earth = 1... >** from Titius-Bode. Although much more is known about planetary distances in modern times, an examination of the original Titius-Bode results gives some fodder for the theory of numerical analysis. The On-Line Encyclopedia of Integer Sequences OEIS refers to the sequences **A209257, A003461, and A131500**. But the Titius-Bode and other power laws are a good exercise in matching the available data.

Here is a summary of Distance formulas and planet assignment numbers for starting the adventure to infinity and beyond. The Titius-Bode formula set **< Earth = 1 ... >** as number assignment scheme for planets. The Asteroid Ceres is included on most number assignment schemes. Ceres represents the Asteroid belt between Mars and Jupiter. The planet Neptune and dwarf planet Pluto are included on some number assignment schemes. Other planet number schemes are for power laws are available here. The Wurm_formula_1803 was **expr {(0.3 + (3.*2.** $nn))*0.1}** with the setting **< Mercury = -1 ...>** But the setting **< Mercury = 1 ...>** was used by Gaussin (1880) and Armellini (1921) for their power laws. Very interesting, Nicolini transformed planet number scheme in Titius_Bode to **< Mercury = 1 ...>**, refer to Nicolini. The nicolini_formula_1957 was **expr {0.4 + 0.075 * (2. ** $nn)} , $nn=l for Mercury,2,...** The Basano_Hughes_formula_1979 was **expr {0.285 * (1.523 ** $nn)}, $nn=l for Mercury, 2,...** Sven-Ingmar Ragnarsson, 1994, modeled Jupiter and the outer planets to Uranus, separately. See the Ragnarsson paper. For the TCL code, keeping track and comparing these planet assignment numbers is tricky. The Ragnarsson paper used **$nn=0 for Jupiter, 2 = Saturn, 3 = Uranus ....**. The most successful players separate the non-linear distances into two or three piecewise sections, rather than having a single formula try to cover all the planets and objects.

Many planetary distance papers cited the model of the hydrogen atom developed by Bohr in 1913. The normalized_bohr_atom_1913 formula was **expr { 1. * $nn**2 },$nn=1,2,3,4,5 ** . Here $nn=1 is the first electron orbit.

The Titius–Bode law estimated rough distances in Astronomical Units (AU) of Planets from the Sun by scaling powers of 2, **Johann Elert Bode**, pub 1772. Although much more known in modern times, an examination of the original Titius–Bode results in AU gives some fodder for the theory of the TCL calculator. For example, Titius–Bode law rated Earth as **1 AU** from the Sun and predicted Mars as **1.6 AU**. The Bode estimate for Mars was short of the true value **1.676 AU by 4.77 percent error**. Using hand calculations, a similar value can be ginned up from the golden ratio, expr { $golden_ratio_constant / 1. } returns **1.618 AU** rounded. The golden ratio method is still short of the Mars true distance by 3.6 percent error. Numerous excellent papers have used both the Fibonacci and the golden ratio constants methods to estimate planetary distances from the Sun. The Lombardi paper found the best fit to the Fibonacci constants used the scaling constant** < K1 = 55.88 > to get E6 km ** prediction. Both the Fibonacci and Bode sequences have unassigned slots or skips, due to the Asteroid belt(s) and possible undiscovered bodies. The Asteroid Ceres is representative of Asteroid belt here, but was not known to Bode. Also, both Neptune and Pluto not known to Bode in 1772.

Here is an example of how the Fibonacci method might be used with ** < K1 = 55.88 > **. Astronomer Mary Blagg in 1913 conjectured that ** if the transplutonian Planet X** existed, it might be at **~68** AU from the Sun. The nearest Fibonacci constants are 233 and 377, and unassigned at that. Perhaps, **expr { 0.349 * 233. } ;# 81.317 AU** for **Planet X**? The interest in Planet X and the region of 80 AU is not original or new by any means. Schuette suggested a family of comets in the region of 80 AU aphelia, circa 1949. The perihelion of the object Sedna is around 76 AU, reported in 2004. The perihelion of the object 2012 VP is around 80 AU, reported in 2012.

With additional scale factors loaded in the deck, the TCL calculator could use the Fibonacci sequence to output the planetary distances in kilometers and AU. The scale factor for kilometers is 55.88 (*E6). Sample calculation for Planet X was ** expr { 233. * 55.88 } ** ;# returns rounded **13000 X 1E6 km** The scale factor for AU is **expr { 19.2 / 55. } ** ;# ratio of Uranus returns **0.349 AU/Fi**.

In the horse race of fitting formulas, a least squares method was fit to the curve with some known initial points either with the first 6 planets or 9 planets, if Pluto or Ceres included. Other fits to the curve can be tried from an online curve fitter, using the least squares method. A Gaussian bell curve was not a good fit to the eyeball. The linear fit or stick fit was tried. The linear slope can be defined from simple points.

In the horse race of fitting formulas, a least squares method was fit to the curve with some known initial points either with the first 6 planets or 9 planets, if Pluto or Ceres included. Other fits to the curve can be tried from an online curve fitter, using the least squares method. Candidate models of fit include 1) Y=A*EXP(((X-B)**2)/C) exponential 2) Y = A*(B**(1/X))*X**C <--- Mod Hoerl , 2) Y = A*X+B*X**2+C*X**3 <--- 3nd order polynomial, 3) Y = A*(B**(1/X))*X**C <--- Mod Hoerl, and 4) Y = A*X**B+C <--- 1 pow + c, which appear winners of field with more than 208 entries for fitting functions. For inclusion in the horse race of fitting formulas, the classic sigmoidal functions were estimated like the Weibull growth curve, Gompetrz growth curve, and Ratkowsky Model growth curve. For the raw Planet Distances, the online fitter reported that the std of measured X values was 3.022 and avg X value was 5.555. The std of measured Y values was 13.655 and avg Y value was 11.902. The Weibull growth curve < a - b*exp(-c*x**d)> had a standard error of 4.25E-01 and a correlation coefficient of 9.99E-01. The Ratkowsky Model had a standard error of 5.29E-01 and a correlation coefficient of 9.99E-01. The Gompertz growth curve standard error of 1.96E+00 and correlation coefficient of 9.93E-01. The Logistic Power function had an standard error of 8.07E-01 and a correlation coefficient of 9.98E-01. Of most interest for comparison with the historic Titius-Bode power law, the Modified Power function <y=a*C**x> had standard error of 2.01E+00 and a correlation coefficient of 9.91E-01.

Candidate models of fit include 1) Weibull growth curve, 2) Ratkowsky Model, 3) power law and 4) exponential law, which appear in a field with more than 208 entries for fitting functions. The fitting algorithm for points was available to double precision, E-14. But obviously, such precision was not necessary with the 3 significant figures in reported JPL measured data. Some calculations appear defaulted to single precision, E-7. The tabled chi results were from 208 equations of 2 parameters (2P) or 2 terms (t2), from the non-linear curve fit algorithm (NLCF). Undoubtedly, this computer task would be hundreds of man-hours in paper calculations, but done automatically on the computer in three seconds or less. Trig functions are trivial results in this search, but leaving available in table, in case results jog memory. Also, there was a really nice piecewise cubic spline fit for 9 planets, but not sure how to wrap in code. One can see how the power laws or doubling rules like the Titius-Bode formula are breaking down beyond Jupiter and Uranus. See figures 6 and 7.

For inclusion in the horse race of fitting formulas, the classic sigmoidal functions were estimated like the Weibull growth curve, Gompetrz growth curve, and Ratkowsky Model growth curve. For the raw Planet Distances, the online fitter reported that the std of measured X values was 3.022 and avg X value was 5.555. The std of measured Y values was 13.655 and avg Y value was 11.902. The Weibull growth curve < a - b*exp(-c*x**d)> had a standard error of 4.25E-01 and a correlation coefficient of 9.99E-01. The Ratkowsky Model had a standard error of 5.29E-01 and a correlation coefficient of 9.99E-01. The Gompertz growth curve standard error of 1.96E+00 and correlation coefficient of 9.93E-01. The Logistic Power function had an standard error of 8.07E-01 and a correlation coefficient of 9.98E-01. Of most interest for comparison with the historic Titius-Bode power law, the Modified Power function <y=a*C**x> had standard error of 2.01E+00 and a correlation coefficient of 9.91E-01.

The autofitter found a = 5.14E-01 and b = 1.55E+00 for the Modified Power function <y=a*C**x>, which was close to the Armellini formula for planetary distances. In 1921, G. Armellini suggested a planetary distance formula, equivalent to <y = 0.2792 x 1.53**n> . Other authors have suggested 1.73 or, 1.842, for the C term in a planetary distance power function <y=a*b**x>. The Modified Power function error is at 5 percent of the Y axis, which is at the non-significant borderline level generally cited. The Weibull growth curve should fit the Y axis with a 1 percent error. In these growth functions, the Levenberg-Marquardt (L-M) algorithm was used with double precision C's.

Rewrite section here. The original Armellini planetary distance power function <y=C**x>, C=1.53, nn = -2 for Mercury, -1, 0=Earth, 1, 2, 3.... The Armellini average error was 0.937 percent here. Later authors modified the Armellini formula with different planet number assignments and assumed different gaps, and got some slightly different results. The calculation of average error is tricky because some authors interpreted planets and gaps differently. The original Armellini over 9 planets and objects was about half the relative error of the Titius-Bode results. C=1.53, nn = -2 for Mercury, -1, 0=Earth, 1, 2, 3.., 6=gap?...Original Armellini power law had gap? or unassigned slot at Armellini(6) The original Armellini planetary distance power function <y=C**x>, C=1.53, nn = -2 for Mercury, -1, 0=Earth, 1, 2, 3.... The Armellini average error was 0.937 percent here. Later authors modified the Armellini formula with different planet number assignments and assumed different gaps, and got some slightly different results. The calculation of average error is tricky because some authors interpreted planets and gaps differently. The original Armellini over 9 planets and objects was about half the relative error of the Titius-Bode results.

Ron Livesey reported in 2004 that the planets distance from the Kepler measured data was proportional to the to a limited set of Fibonacci numbers. The limited set of Fibonacci numbers starts **< list 1 2 3 5 8 ...>** and are scaled to distnaces in AU using a scale factor. Livesey was able to model the distances of inner planets, but the outer planets failed to reasonably match. Others have discussed that the distance or ratio from successive planets in the Kepler measured data was proportional to the Golden Ratio constant (1.618). Meaning that the ratio of distances of **Planet(n+1)/ PLanet(n)** approximates the Golden Ratio constant, but only the inner planets seem to match, but not so with the outer planets, especially the Planet Neptune and the dwarf planet Pluto are seen as outliers and very troublesome. A graph of the Kepler measured data versus Fibonacci numbers showed a scale factor of **expr { 30.06-.39)/(89 - 1. } , 0.337 AU per Fibonacci number**.

Aside from the Livesey published results on the inner planets, the analysis made some sample hand calculations in TCL expressions. A graph of the Kepler measured data versus Fibonacci numbers showed a roughly linear slope and a scale factor of **expr { 30.06-.39)/(89 - 1. } , 0.337 AU per Fibonacci number**, using the Keplar measured data for Mercury to Neptune. The distance of the planet Mercury was expr { 1.* 0.337}, 0.337 AU. The distance of the planet Venus was expr { 2.* 0.337}, 0.674 AU. The distance of the planet Earth was expr { 3.* 0.337}, 1.011 AU. The distance of the planet Mars was expr { 4.* 0.337}, 1.675 AU.

The Soltani paper presents the theory that the Titius-Bode Law is derived from the existence of a standing and cosine wave wave packet in solar system. There are successive solar wave nodes in a Schrodinger standing wave originating from the Sun in the Soltani position. Planets and objects may reside at successive solar wave nodes of a stationary or standing wave, but some nodes are not filled. The solar nodes start from the origin line, with the first solar node which is 0.1 AU. The first solar node is empty of a planet. After the first solar node, each successive solar node is a length of 0.3 AU. The planet Mercury resides on the second solar node at pi/6 ==>> 0.4 AU. The planet Venus resides on the third solar node at 5*pi/2 ==>> 0.7 AU. The Earth resides on the fourth node at 7*pi/2 ==>> 1.0 AU. The fifth solar node is empty, but the location is at 9*pi/2 ==>> 1.3 AU. The planet Mars resides on the sixth solar node at 11*pi/2 ==>> 1.6 AU. For previous mainstream use in physics, Quantum mechanics, the Schrodinger equation, and the de Broglie wavelength relation were thought only for subatomic scale and subatomic objects. Small TCL routines can be written added to the TCL gui to study the implications and graph the possible interrelations to the Titius-Bode Law .

Most advanced electromagnetic theory states that energy and electromagnetic energy waves travel as a packet or ball of combination electric waves and magnetic waves, including resonant spin or plural rotations. In opinion, the closest analog is a spinning ball of loose cotton with the cotton lint fibers representing multiple light photons or beams of light. Other analog is the collection of dust balls on the floor from a housekeeper. One is doing high science when one forgets to dust under the couch. Other similar analogs are the hair balls that are left over from ones hairbrush or the hair balls from some cats. Energy transfer , energy transform, or spin energy entrainment of the energy ball occurs when matter, recipient, or resonant plasma fields encounter recipient fields. One might as well be throwing left or right curve balls spinning on their travel in the first inning.

For fitting power law formulas to the measured data, Mercury, Neptune, and Pluto are outlier points in the Kepler measured data. Ceres and Uranus from the measured data appear on the middle portion in the log chart of the measured data. The linear appearance of the middle portion feature is suitable for using power law formulas. The TCL calculator uses planet assignment numbers from 1 to 10, including the Pluto dwarf planet and the Ceres asteroid.

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. 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. The current result numbers will be cleared either on the next clear button or on the next solve button. All results will be lost on program exit, unless the report text is saved from the report screen on console.

In the horse race of fitting formulas, a least squares method was fit to the curve with some known initial points either with the first 6 planets or 9 planets, if Pluto or Ceres included. Other fits to the curve can be tried from an online curve fitter, using the least squares method. Candidate models of fit include 1) Y=A*EXP(((X-B)**2)/C) exponential 2) Y = A*(B**(1/X))*X**C <--- Mod Hoerl , 2) Y = A*X+B*X**2+C*X**3 <--- 3nd order polynomial, 3) Y = A*(B**(1/X))*X**C <--- Mod Hoerl, and 4) Y = A*X**B+C <--- 1 pow + c, which appear winners of field with more than 208 entries for fitting functions. The tabled chi results were from 208 equations of 2 parameters (2P) or 2 terms (t2), from the non-linear curve fit algorithm (NLCF). Undoubtedly, this computer task would be hundreds of man-hours in paper calculations, but done automatically on the computer in three seconds or less.In the code, after computing the Titius-Bode output as historical numbers, subsequent formulas are scaled, changed, and different assumptions are changed from the original Titius-Bode formulas.

The set of measured planet distances is a non-linear function, which possibly should be modeled in three sections. From the log plots, there appears to be a sine wave or sigmoidal growth function component in the measured planet distances, meaning non-linear S-curve in slang. Again from the log plots, one can see how the power laws or doubling rules like the Titius-Bode formula are breaking down beyond Jupiter and Uranus. The Ragnarsson paper in 1994 showed fair results in modeling Jupiter and the outer planets as a separate section.

Table : Est. Distance of Planets from Fibonacci and Bode Rules | printed in tcl wiki format | |||||||
---|---|---|---|---|---|---|---|---|

sources >> | JPL | JPL | Fibonacci constants | Lombardi Paper | Lombardi Paper | Wikipedia | Wikipedia | comments |

quantity | real measured AU, semi_major axis | real measured 10E6 km, semi_major axis | Fibonacci constants | Fibonacci * 55.88, 10E6 km Prediction | Titius-Bode number | Titius-Bode AU Prediction | Real Measured AU , semi_major axis | comments, if any |

Sun | 0 | 0 | Sun not assigned value in Fibonacci and Bode Rules | |||||

Mercury | 0.39 | 57.9 | 1 | 55.8 | 4 | 0.4 | 0.39 | |

Venus | 0.723 | 108.2 | 2 | 111.6 | 7 | 0.7 | 0.72 | |

Earth | 1 | 149.6 | 3 | 167.4 | 10 | 1 | 1 | Earth assigned unit 1 AU in Bode Rules |

Mars | 1.524 | 227.9 | 5 | 279 | 16 | 1.6 | 1.52 | |

Ceres | 2.767 | 265.3 | 8 | 446.4 | 28 | 2.8 | 2.77 | Asteroid belt |

Jupiter | 5.203 | 778.3 | 13 | 725.4 | 52 | 5.2 | 5.2 | |

Jupiter clearance belt | 21 | 1171.8 | Jupiter clearance belt | |||||

Saturn | 9.539 | 1427 | 34 | 1897.2 | 100 | 10 | 9.55 | |

Uranus | 19.18 | 2871 | 55 | 3069 | 196 | 19.6 | 19.22 | |

Neptune | 30.07 | 4497.1 | 89? | 4966.2 | 388? | 38.8? | 30.11 | Bodes Law breaks down for Neptune and Pluto. Confusing references. |

Pluto (avg) | 39.482 | 5906.38 | 144? | 8035.2? | 772? | 77.20? | 39.54 | Pluto is not considered a planet, currently. Bodes Law breaks down for Neptune and Pluto. Confusing references. |

Note | several sources | Wikipedia | Jpl | Lombardi Paper | ||||

Note | Neptune, Pluto, & Ceres were not known to Bode | |||||||

Note | Ceres representative of Asteroid belt here | |||||||

Note | Bodes Law breaks down for Neptune and Pluto, confusing references | Opinion: Bode Number assignment for N&P uncertain here. |

In planning any software, it is advisable to gather a number of testcases to check the results of the program.

Testcase 1 | printed in tcl wiki format | ||
---|---|---|---|

1: | testcase_number | ||

1. : | method number, 1 = Bode | ||

1772. : | reference year CE : | ||

value AU | quantity | distance E6 km | comment, if any |

0.400 : | Mercury : | 22.32 | Bodes Law breaks down for Mercury |

0.700 : | Venus : | 39.059 | |

1.00 : | Earth : | 55.79 | Earth set to one in Bodes Law |

1.60 : | Mars : | 89.280 | |

5.20 : | Jupiter : : | 290.159 | |

10.0 : | Saturn : | 558.0 | |

19.6 : | Uranus : | 1093.68 | |

38.8 : | Neptune : | 2165.039 | Bodes Law breaks down for Neptune and Pluto. |

77.2 : | Pluto : | 4307.76 | Pluto is not considered a planet, currently. Bodes Law breaks down for Neptune and Pluto. |

154. : | extra slot, unk planet? : | 8593.19 | |

2.80 : | Ceres : | 156.23 | represents Asteroid belt here |

Console wrapper for solution proc *************************** *************************** scaled_results 0.000001 1. 0.400 0.700 1.00 1.60 5.20 10.0 19.6 38.8

The average percent error of the Titius-Bode law compared to the Kepler measured data is expr {ABS (( 0. - 2.5 + 2.8 + 0.00 - 4.77 - 1.16 + 0.00 - 4.45 - 1.95 +1.05)/9.)}, 1.219 percent error.

Table Armellini formula | I | printed in TCL format | |||
---|---|---|---|---|---|

formula d= 1.53**$n, $n=-2,-1,0,1,2,3... | avg error 0.937 percent | ||||

Planet Name | assigned number | Armellini formula | Kepler measured data | percent error | comments, if any |

Mercury | -2 | 0.427 | 0.39 | 9.5349038448 | |

Venus | -1 | 0.654 | 0.723 | -9.5996167024 | |

Earth | 0 | 1.000 | 1 | 0 | Earth is set to 1 AU |

Mars | 1 | 1.530 | 1.524 | 0.3937007874 | |

Vesta Asteroid | 2 | 2.341 | 2.36 | -0.8093220339 | Asteroid, Armellini mentioned |

Cammila Asteroid | 3 | 3.582 | 3.48 | 2.9188793103 | Asteroid, Armellini mentioned, but Italian spelling used |

Jupiter | 4 | 5.480 | 5.203 | 5.320253892 | |

Saturn | 5 | 8.384 | 10 | -16.158864007 | |

gap? | 6 | 12.828 | Armellini mentioned gap in formula sequence | ||

Uranus | 7 | 19.626 | 19.18 | 2.3272759364 | |

Neptune | 8 | 30.028 | 30.06 | -0.1052946353 | Armellini made fair prediction for Neptune |

Pluto | 9 | 45.943 | 39.44 | 16.4892827128 | dwarf planet, Pluto is not considered a planet. |

Note | Pluto is not considered a planet. | ||||

Note | Vesta representative of Asteroid belt here | ||||

Note | Bode-Like Laws etc usually break down for Neptune and Pluto, confusing references. |

The original Armellini planetary distance power function <y=C**x>, C=1.53, nn = -2 for Mercury, -1, 0=Earth, 1, 2, 3.... The Armellini average error was 0.937 percent here. Later authors modified the Armellini formula with different planet number assignments and assumed different gaps, and got some slightly different results. The calculation of average error is tricky because some authors interpreted planets and gaps differently. The original Armellini over 9 planets and objects was about half the relative error of the Titius-Bode results.

Power law curve fit in red line Power law parameter a=0.182490688 b=2.104691172 Power law y=a⋅xb=0.182490688⋅x2.104691172 Standard deviation σ=7.340978516 e-function curve fit in green line Parameter of the fitted e-function a=0.535853432 b=0.218240397 The e-Function f(x)=b⋅ea⋅x=0.218240397⋅e0.535853432⋅x Standard deviation σ=17.056378115

photo credit, ripple tank at falstad.com website.

Golden_Ratio_waves_ripple_tank

photo credit, ripple tank at falstad.com website.

- Wikipedia search engine < Titius Bode >
- Wikipedia search engine < Golden Mean >
- Wikipedia search engine < Programming Examples >
- Google search engine < vaporware >

- wikipedia.org/wiki/Titius Bode law
- Article: All Solar system periods fit
- the Fibonacci series and the Golden Ratio.
- Posted: February 20, 2013 by tallbloke
- The Golden Mean In The Solar System,
- Oreste W. Lombard I And Margaret A. Lombardi
- On a Suggested Substitute for Bode’s Law. By M. A. Blagg.
- Communicated by Professor H. B. Turner.
- Planetary distances: a new simplified model
- Sven-Ingmar Ragnarsson, 1994
- Fibonacci Series In The Solar System
- Captain B. A. Read, Canada
- A postulate leading to the Titius-Bode law
- R. Louise
- www.jpl.nasa.gov/edu/pdfs/scaless_reference.pdf
- Schuette, C. H., "Two new families of comets", Pop. Astron. 57, 176-82
- (1949); "Drei weitere Mitglieder der Transplutokometenfamilie", Acta
- Astronomica 15, 11-13 (1965).
- Bode’s Law And Spiral Structure In Nebulae
- By William Sutherland
- A Sedna-like body with a perihelion of 80
- astronomical units
- Chadwick A. Trujillo, Scott S. Sheppard
- Searching For Sedna’s Sisters: Exploring The Inner Oort Cloud
- Megan Schwamb with Advisor: Mike Brown
- A new object at the edge of our Solar System discovered
- by Carnegie Institution for Science
- Modeling Celestial Mechanics Using the Fibonacci Number,
- Robert G. Sacco, 2019
- A Supposed New Law For Planetary Distances, letter,
- Ennio Badolati, 1982, several approaches cited
- Munini and Armellini (1978) , d = 0.283 x 1.52**n, sequence < n = 1,2,... 12 >
- 1880 Gaussin, d~ = 0.2099 x 1.7226**n, (n = 1,2... 9)
- tester formula, d = $K1 x 1.842**n, sequence < n = 1,2,... 12 >
- Planetary distances: a new simplified model
- Sven-Ingmar Ragnarsson

Caption outline on plots. distance curve Leaves straight line middle portion appears Linear on log plot, Which is feature suitable For using power law formulas Mercury is outlier On measured data Distance curve Leaves straight le Neptune and pluto are Outliers on measured data Ceres and uranus appear Linear on middle log portion Titius-Bode output for predicted distances tcl club Planet number including Pluto and Ceres Distance curve Leaves straight line Distance curve Leaves straight line Middle portion appears Linear on log plot, Which is feature suitable For using power law formulas Mercury is outlier On titius-bode law Distance curve Leaves straight le Neptune and pluto are Outliers on titius-bode law Ceres and uranus appear Linear on middle log portion {distances for planets and objects on log plot } Tcl club } Planet number including Pluto and Ceres

;# 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, <AM> ;# 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 " ***************************"

;# some authors use different $cc and number scheme proc armellini { cc nn } { expr { $cc**[- $nn 1.] } } ;# generates list for Armellini law proc list_a { aa bb cc} { for {set i $aa} {$i<=$bb} {incr i} {lappend boo [ precisionx 4 [expr { $cc**$i}]]};return $boo} ;# used in calculations proc global golden_ratio_conjugate golden_ratio ;# golden_ratio used in report comparison set golden_ratio_conjugate .6180339887498948420 set golden_ratio 1.6180339887498948420 ;# load in output proc global golden_ratio_conjugate golden_ratio puts " C=1.53, nn = -2 for Mercury, -1, 0=Earth, 1, 2, 3.., 6=gap?..." puts " Original Armellini power law had gap? or unassigned slot at Armellini(6) " puts "Armellini list constant = 1.53 >>> [ list_a -2 9 1.53 ] " puts "Golden Ratio = 1.618, used for list constant comparison >>> [ list_a -2 9 $golden_ratio ]

2 tiered formula from Sven-Ingmar Ragnarsson, 1994 expr { 2.825/5 } ;# 0.565 Mercury badly off expr { 2.825/4 } ;# 0.70625 Venus expr { 2.825/3 } ;# 0.9416 Earth expr { 2.825/2 } ;# 1.412 Mars expr { 2.825/1 } ;# 2.825 Ceres expr { 5.203*(((5./2.)**(2./3.))**0) } ;# 5.203 Jupiter expr { 5.203*(((5./2.)**(2./3.))**1) } ;# 9.584 Saturn expr { 5.203*(((5./2.)**(2./3.))**2) } ;# 17.653 Uranus expr { 5.203*(((5./2.)**(2./3.))**3) } ;# 32.51875 Neptune? badly off expr { 5.203*(((5./2.)**(2./3.))**4) } ;# 59.9 ? PLuto? badly off

;# for starting the adventure to infinity and beyond. ;# Titius-Bode set < Earth = 1 ... > as number assignment scheme for planets ;# The Asteriod Ceres is included on most number assignment schemes ;# Ceres represents the Asteriod belt between Mars and Jupiter. ;# The dwarf planet Pluto is included on most number assignment schemes. proc titius_bode_law_1772 {aa } {expr { (4. + 3 * 2**$aa)*.1 } } ;# ;# $nn=l for Earth,2,... ;# Other planet number schemes are for power laws are available here, < Mercury = 1 ...> ;# from Gaussin (1880) and Armellini (1921) proc gaussin_formula_1880 {nn} {expr {0.2099 * (1.7226 ** $nn)} } ;# $nn=l for Mercury,2,...9 proc armellini_formula_1921 {nn} {expr {0.283 * (1.53 ** $nn)} } ;# $nn=l for Mercury,2,...11 ;# very interesting, Nicolini transformed planet number scheme in Titius_Bode ;# to < Mercury = 1 ...>, refer to Nicolini proc nicolini_formula_1957 {nn} {expr {0.4 + 0.075 * (2. ** $nn)} } ;# $nn=l for Mercury,2,... proc basano_hughes_formula_1979 {nn} {expr {0.285 * (1.523 ** $nn)} } ;# $nn=l for Mercury, 2,... ;# Sven-Ingmar Ragnarsson, 1994, modeled Jupiter and the outer planets to Uranus, separately. ;# See the Ragnarsson paper, setting these planet assignment numbers is tricky. ;# $nn=0 for Jupiter, 2 = Saturn, 3 = Uranus .... proc ragnarsson_formula_1979 {nn} {expr {5.203*(((5./2.)**(2./3.))**$nn) )} } ;# $nn=0 for Jupiter, 2 = Saturn,... proc list_integers { aa bb} { for {set i 1} {$i<=$bb} {incr i} {lappend boo [* 1. $i ] [* $i 1.]};return $boo} ;# usage, list_integers 1 10 ;# set answer_list_integers = [list 1.0 1.0 2.0 2.0 3.0 3.0 4.0 4.0 5.0 5.0 6.0 6.0 7.0 7.0 8.0 8.0 9.0 9.0 10.0 10.0 ] proc list_titius_bode { aa bb} { for {set i 1} {$i<=$bb} {incr i} {lappend boo [* 1. $i ] [expr { (4. + 3. * 2**$i)*.1}]};if {$i > $bb} {return $boo}} ;# Usage list_titius_bode 1 6 ;# set answer [ list 1.0 1.0 2.0 1.6 3.0 2.8 4.0 5.2 5.0 10.0 6.0 19.6] proc list_gaussin_formula { aa bb} { for {set ii 1} {$ii<=$bb} {incr ii} {lappend boo [* 1. $ii ] [expr {0.2099 * (1.7226 ** $ii)} ]};if {$ii > $bb} {return $boo}} ;# Usage list_gaussin_formula 1 6 ;# set answer_gaussin [ list 1.0 0.36 2.0 0.62 3.0 1.07 4.0 1.84 5.0 3.18 6.0 5.48 ] proc list_armellini_formula { aa bb} { for {set ii 1} {$ii<=$bb} {incr ii} {lappend boo [* 1. $ii ] [expr {0.283 * (1.53 ** $ii)}]};if {$ii > $bb} {return $boo}} ;# Usage list_armellini_formula 1 7 ;# set answer_armellini [ 1.0 0.43 2.0 0.66 3.0 1.013 4.0 1.55 5.0 2.37 6.0 3.63 7.0 5.55 ]

1 0.39 2 0.723 3 1. 4 1.524 6 5.203 7 9.539 8 19.18 9 30.07 10 39.482

Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Thanks, gold 12Aug2020

Category Numerical Analysis | Category Toys | Category Calculator | Category Mathematics | Category Example | Toys and Games | Category Games | Category Application | Category GUI |

# Functional math system for integers from RS # Playing with recursion # Richard Suchenwirth 2004-10-24 # two functions should be enough to derive all arithmetics proc func {name argl body} {proc $name $argl [list expr $body]} proc ' x {incr x} proc = {m n} {string equal $m $n} func pred n {[pred2 $n 0]} func pred2 {n m} {[= [' $m] $n]? $m: [pred2 $n [' $m]]} proc = {m n} {string equal $m $n} proc test args { foreach {case expected} $args { catch {uplevel 1 $case} res if {$res != $expected} {error "$case->$res, expected $expected"} } } func + {m n} {[= $n 0]? $m: [+ [' $m] [pred $n]]} #-- the product func * {m n} {[= $n 0]? 0: [+ $m [* $m [pred $n]]]} #-- the difference (defined only for m >= n) func - {m n} {[= $n 0]? $m: [- [pred $m] [pred $n]]} #-- the inequality predicate <= func <= {m n} {[= $m 0]? 1: [= $n 0]? 0: [<= [pred $m] [pred $n]]} #-- leading to the strict inequality < func < {m n} {[= $m $n]? 0: [<= $m $n]} #-- Integer division goes like this: func / {m n} {[< $m $n]? 0: [' [/ [- $m $n] $n]]} #-- Integer division remainder (% in expr) func rem {m n} {[< $m $n]? $m: [rem [- $m $n] $n]} #-- Divisibility of a number n by a number m func | {m n} {[= $n 0]? 1: [< $n $m]? 0: [| $m [- $n $m]]} func prime n {[= $n 0]? 0: [= $n 1]? 0: [prime2 $n 2]} func prime2 {m n} {[= $m $n]? 1: [| $n $m]? 0: [prime2 $m [' $n]]} func gcd {m n} {[<= $n $m]? [gcd $n $m]: [= [rem $n $m] 0]? $m: [gcd [rem $n $m] $m]}

PYK 2020-10-13: Hi gold, thank you for the cool pages you've contributed to this wiki. Your recent edit to upvar sugar was reverted by stevel, probably because it was so broad. My opinion: The concern is that if such broad reference sections proliferate, they lose the value they might have had. There is a natural hierarchy to content on the wiki. The page above upvar sugar is probably something like little language. A link to math sugar, for example, is a sibling to upvar sugar, so probably belongs on a higher page, and not on the upvar sugar page. For navigational purposes it's good enough to be able to browse through a "path" of links to some indirectly-related content, and to constrain the "reference" section only to directly-related pages, i.e. pages that might be considered siblings, children, or parents.

PYK 2020-10-21: In my recent edit to Playing Recursion V2 >> demo examples for one liner programs I removed the copyright notice. The entire content of this wiki is intended to be in th public domain, and thus copyright notices on individual pages are unneeded and could cause confusion. See Who owns the content on this Wiki.

gold 2020-10-20. How about me just loading the pix and charts alone at the bottom of these older works by other authors? That should not spoil the looks and "optics" of the older author pages. Since my moniker is on the pix, if readers want more info, refs, and the generating code, they may contact me. I do not have an ax to grind on copyright, other than no liability to me and TCL Wiki. I have some brain fog late at night, page was overwritten somehow. I have reloaded your edit 102 from the history, with omissions per request.

gold 2021-5-8. Removing copyright notices on <gold> authored pages as spare time allows. I do not have an ax to grind on copyright, other than no liability to me and TCL Wiki. The 2007 paper of David McFarland provided an excellent history of the quarter square multiplication algorithm in both the ancient and modern eras. The college institutes, textbooks, and computer companies in the USA that previously used the Babylonian mathematical ideas without credit may be glad to know that the Babylonian copyrights and patents expired about 4000 years ago.

If urgent matter, leave comment out in plain sight, here at bottom of page. As I am more likely to see it. If the issue is resolved, I may sweep under rug later.

Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Thanks, gold 12Dec2018

PYK 2020-10-13: Hi gold, thank you for the cool pages you've contributed to this wiki. Your recent edit to upvar sugar was reverted by stevel, probably because it was so broad. My opinion: The concern is that if such broad reference sections proliferate, they lose the value they might have had. There is a natural hierarchy to content on the wiki. The page above upvar sugar is probably something like little language. A link to math sugar, for example, is a sibling to upvar sugar, so probably belongs on a higher page, and not on the upvar sugar page. For navigational purposes it's good enough to be able to browse through a "path" of links to some indirectly-related content, and to constrain the "reference" section only to directly-related pages, i.e. pages that might be considered siblings, children, or parents.

PYK 2020-10-21: In my recent edit to Playing Recursion V2 >> demo examples for one liner programs I removed the copyright notice. The entire content of this wiki is intended to be in the public domain, and thus copyright notices on individual pages are unneeded and could cause confusion. See Who owns the content on this Wiki.

gold 2020-10-20. How about me just loading the pix and charts alone at the bottom of these older works by other authors? That should not spoil the looks and "optics" of the older author pages. Since my moniker is on the pix, if readers want more info, refs, and the generating code, they may contact me. I do not have an ax to grind on copyright, other than no liability to me and TCL Wiki. I have some brain fog late at night, page was overwritten somehow. I have reloaded your edit 102 from the history, with omissions per request.

gold 2021-5-8. Removing copyright notices on <gold> authored pages as spare time allows. I do not have an ax to grind on copyright, other than no liability to me and TCL Wiki. The 2007 paper of David McFarland provided an excellent history of the quarter square multiplication algorithm in both the ancient and modern eras. The college institutes, textbooks, and computer companies in the USA that previously used the Babylonian mathematical ideas without credit may be glad to know that the Babylonian copyrights and patents expired about 4000 years ago.

Category Numerical Analysis | Category Toys | Category Calculator | Category Mathematics | Category Example | Toys and Games | Category Games | Category Application | Category GUI |