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 20Aug2021
gold 15aug2021 Here are some calculations for Koch Snowflake Modeling Growth. High school geometry class was to the rescue on constructing the Universe From scratch, Bruce Camber,2016,. Note. When I started this page, I did not know about L-system 2D on this TCL wiki, but still think I could learn some. Strange that some search engines are not pulling this remarkable page L-system 2D on this wiki.
Fractal Code of the simulated reality is similar to repetitive patters in our lives, per lecture of Gregg Braden. Repetitive patterns in our lives hows fractal growth is limited. Koch snowflake. Area or growing curve of Koch snowflake has 1.6X limit. Koch snowflake has 1.6X limit to area growth of fractal pattern. First area increase of Koch snowflake is 1/3, 2nd iteration is 4/27, 3ird iteration is 16/243, 4th iteration is 64/2187. The area limit is 1.6X. Perimeter or edge of fractal simulation can change to infinite complexity. How long fractal pattern or simulation lasts? How complex edge or perimeter can become? The limiting scale of universe may called the Planck length, which means there may be a limit to how large the universe may become, quoting Steven Hawking.
In planning any software, it is advisable to gather a number of testcases to check the results of the program.
Testcase 1. Equilateral triangle has side of length 1. The area of equilateral triangle is expr {1.*1.*1.732/4.}, 0.433. The snowflake formula is expr {(1.*1.*1.732*2) /5.}, 0.692799. Check: the ratio of the two areas approximates expr {0.692/.433}, ~1.598. The exact ratio is 1.6. TCL calculator returns 0.69282032302755092. The exact ratio expr {0.69282032302755092/0.4330127018922193}, returns 1.600000000000000.
table 1 | printed in tcl wiki format | ||
---|---|---|---|
quantity | value | value | comment, if any |
1: | testcase_number | ||
1.0 : | initial length | ||
1.0 : | iteration : | ||
1.0 : | option switch mode, usually 1 , modes = 2, 3, 4: | ||
1.0 : | optional constant, nominal 1 :: | ||
1. : | experimental decay constant_K1 : | ||
Note : | experimental constant_k1 not used : | ||
4.0 : | Koch snowflake perimeter from iteration N : | ||
0.4330127018922193 : | area initial triangle : | ||
0.57735026918962573 : | area first iteration : | ||
0.57735026918962573 : | Koch snowflake area from iteration N : | ||
0.69282032302755092 : | limit to Koch snowflake area from infinite series : |
The snowflake starts with equilateral triangle, which has side of length 10. The TCL calculator returns snowflake area of 69.2820
table 2 | printed in tcl wiki format | ||
---|---|---|---|
quantity | value | value | comment, if any |
2: | testcase_number | ||
10.0 : | initial length | ||
1.0 : | iteration : | ||
1.0 : | option switch mode, usually 1 , modes = 2, 3, 4: | ||
1.0 : | optional constant, nominal 1 :: | ||
1. : | experimental decay constant_K1 : | ||
Note : | experimental constant_k1 not used : | ||
40.0 : | Koch snowflake perimeter from iteration N : | ||
43.301270189221931 : | area initial triangle : | ||
57.735026918962575 : | area first iteration : | ||
57.735026918962575 : | Koch snowflake area from iteration N : | ||
69.282032302755084 : | limit to Koch snowflake area from infinite series : |
The snowflake starts with equilateral triangle, which has side of length 100. The TCL calculator returns snowflake area of 6928.2032.
table 3 | printed in tcl wiki format | ||
---|---|---|---|
quantity | value | value | comment, if any |
3: | testcase_number | ||
100.0 : | initial length | ||
1.0 : | iteration : | ||
1.0 : | option switch mode, usually 1 , modes = 2, 3, 4: | ||
1.0 : | optional constant, nominal 1 :: | ||
1. : | experimental decay constant_K1 : | ||
Note : | experimental constant_k1 not used : | ||
400.0 : | Koch snowflake perimeter from iteration N : | ||
4330.1270189221932 : | area initial triangle : | ||
5773.5026918962576 : | area first iteration : | ||
5773.5026918962576 : | Koch snowflake area from iteration N : | ||
6928.2032302755088 : | limit to Koch snowflake area from infinite series : |
The snowflake starts with equilateral triangle.
Dimensions after 1 iteration length | 4 (times initial side length) area | 4/3 ≈ 1.33333 (times initial area) Dimensions after 2 iterations length | 16/3 ≈ 5.33333 (times initial side length) area | 40/27 ≈ 1.48148 (times initial area) Dimensions after 3 iterations length | 64/9 ≈ 7.11111 (times initial side length) area | 376/243 ≈ 1.54733 (times initial area) Dimensions after 4 iterations length | 256/27 ≈ 9.48148 (times initial side length) area | 3448/2187 ≈ 1.57659 (times initial area) Dimensions after 5 iterations length | 1024/81 ≈ 12.642 (times initial side length) area | 31288/19683 ≈ 1.5896 (times initial area)
;# pretty print from autoindent and ased editor occurrence ;# Koch Snowflake Modeling Growth calculator ;# written on Windows 10 ;# working under TCL version 8.6 ;# gold on TCL WIKI, 19aug2021 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 {{} {initial length :} } lappend names {iteration N: } lappend names {optional switch mode, usually 1 , modes = 2, 3, 4: } lappend names {optional constant in mode, nominal 1 : } lappend names {answers, Koch snowflake perimeter from iteration N : } lappend names { area initial triangle : } lappend names { area first iteration : } lappend names { Koch snowflake area from iteration N : } lappend names { limit to Koch snowflake area from infinite series : } 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 Koch Snowflake Modeling Growth V2 from TCL WIKI, written on TCL 8.6 " tk_messageBox -title "About" -message $msg } proc self_help {} { set msg "Calculator for Koch Snowflake Modeling Growth V2 from TCL , ;# self help listing ;# 2 given follow. 1) initial length N1 2) iteration 3) optional switch mode, usually 1 for no decay ;# optional decay modes = 2, 3, 4, experimental use 4) optional variable decay constant, not used now ;# This calculator uses Koch snowflake proportions ;# based on initial length and iteration number ;# optional switch mode, usually 1 for no decay, ;# optional decay modes = 2, 3, 4 ;# experimental constant_k1 reduces later ;# optional rise modes = -2, -3, -4 ;# setting _k1 rise factor and extra length set on time waves, ;# but deacceleration of events to person as observer on timeline. ;# not used & open yet, optional constant in decay mode, nominal 1 ;# 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. ;# Proc precisionx <AM> is loaded and may be used to ;# trim lengthy mantissas. ;# precisionx used on select numbers only, not used on every number. ;# 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, 30apr2021 " 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 7nd significant figure set x [ format "%#.7g" $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.}} ;# adapted from tcl-wiki Stats 2011-05-22, arithmetic mean [RLE] ;# ;# ::math::snowflake_area -- ;# ;# Return the division of quantity by two or more given ratios ;# ;# Arguments: ;# length first value is length ;# iteration second value is length ;# ;# Results: snowflake_area ;# proc ::math::snowflake_area {length iteration} { set sum [ expr { ($length*$length*sqrt(3.))/4.} ] set count 0 while {$count < $iteration} { set val [ expr { $length*$length*(sqrt(3.)/12.)} ] set sum [ expr { $sum + $val } ] incr count } return $sum } proc calculate { } { global side1 side2 side3 side4 side5 global side6 side7 side8 side9 global side10 side11 side12 global g_constant gr age_years reference_year global testcase_number golden_time_cycle global option_mode optional_constant seed_date incr testcase_number set side1 [* $side1 1. ] set side2 [* $side2 1. ] set side3 [* $side3 1. ] set side4 [* $side4 1. ] set side9 1. set side10 1. set side11 1. set option_mode [ expr { $side3*1.0 } ] set optional_constant [ expr { $side4*1.0 } ] set seed_date [ expr { $side1 + $side2 } ] ;# golden conjugate is 0.61803398874989484820 ;# alternate test value for ;# golden conjugate is 0.618 ;# but do not see much difference on small numbers ;# under 20 ;# initialize golden ratio constants set gr 1.61803398874989484820 set g_constant 0.61803398874989484820 ;# experimental constant_k1 reduces later ;# time waves in length after 1st occurence set constant_k1 1. ;# setting if { $side3 == 1. } {set constant_k1 1. } set side12 $constant_k1 set length $side1 set iteration $side2 set area_initial_triangle [ expr { ($side1*$side1*sqrt(3.))/4.} ] set area_first_iteration [ expr { ($side1*$side1*sqrt(3.))/3.} ] set side6 $area_initial_triangle set side7 $area_first_iteration set koch_snowflake_perimeter [ expr { 3.*$side1*((4./3.)**$iteration)} ] ;# koch_snowflake_area is sum of infinite series of Nth areas set koch_snowflake_perimeter [ expr { 3.*$side1*((4./3.)**$iteration)} ] set side5 $koch_snowflake_perimeter set side8 [::math::snowflake_area $length $iteration] set koch_snowflake_area [ expr {(2.*$side1*$side1*sqrt(3.))/5.} ] set side9 $koch_snowflake_area ;# we have computed the set } 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 gr global side10 side11 side12 global testcase_number golden_time_cycle global g_constant gr age_years reference_year global option_mode optional_constant console show; puts "%|table $testcase_number| || printed in tcl wiki format|% " puts "&| quantity| value |value| comment, if any|& " puts "&| $testcase_number:|testcase_number || |&" puts "&| $side1 :|initial length | | |&" puts "&| $side2 :|iteration : | | |& " puts "&| $side3 :|option switch mode, usually 1 , modes = 2, 3, 4: | | |& " puts "&| $side4 :|optional constant, nominal 1 :: | | |& " puts "&| $side12 :| experimental decay constant_K1 : | | |& " puts "&| Note :| experimental constant_k1 not used : | | |& " puts "&| $side5 :| Koch snowflake perimeter from iteration N : | | |& " puts "&| $side6 :| area initial triangle : | | |& " puts "&| $side7 :| area first iteration : | | |&" puts "&| $side8 :| Koch snowflake area from iteration N : | | |&" puts "&| $side9 :| limit to Koch snowflake area from infinite series : | | |&" } frame .buttons -bg aquamarine4 ::ttk::button .calculator -text "Solve" -command { calculate } ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 1. 2. 1. 1. 5.33 0.433 0.577 5.33 0.69 } ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 1. 3. 1. 1. 7.11 0.433 0.577 7.11 0.69 } ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 1. 4. 1. 1. 9.48 0.433 0.577 9.48 0.69} ::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 . "Koch Snowflake Modeling Growth Calculator 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 Koch Snowflake Modeling Growth Calculator V2 "} console eval {. configure -background orange -highlightcolor brown -relief raised -border 30} puts " Console wrapper for solution proc" puts " ***************************" puts " ***************************"
Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Thanks, gold 12Aug2021
Category Numerical Analysis | Category Toys | Category Calculator | Category Mathematics | Category Example | Toys and Games | Category Games | Category Application | Category GUI |