## Biology >> Dinosaur Mass from Trackway and TCL demo example calculator, numerical analysis

• Starter Wiki Page ***

Title: Biology >> Dinosaur Mass from Trackway and TCL demo example calculator, numerical analysis

### Preface

gold12Feb2020. Here are some calculations using TCL expressions on estimating Dinosaur Mass from Trackway.

### Introduction

The rule of thumb is that hip height equals expr ( foot_length * 5. )

### Calculator Usage

As as alternate way of using the calculator

### Testcases are important in development of TCL programs.

In planning any software, it is advisable to gather a number of testcases to check the results of the program. The math for the testcases can be checked by pasting statements in the TCL console. Aside from the TCL calculator display, when one presses the report button on the calculator, one will have console show access to the capacity functions (subroutines).

By inspection

### Testcases Section

#### Testcase 1

table 1 printed in tcl format
quantity value comment, if any
1 :testcase_number
25000000.0 :mutation rate years (1/N):
5000.0 :number of females:
5.0 :offspring per female:
1700000.0 :geologic interval years:
1000.0 :mutation years:
1000.0 :mutation years:
1000.0 :mutation years:
1700.0 :mutations per geologic interval:

#### Testcase 2

table 2 printed in tcl format
quantity value comment, if any
2 :testcase_number
20000000.0 :mutation rate years (1/N):
7000.0 :number of females:
5.0 :offspring per female:
600000.0 :geologic interval years:
1000.0 :mutation years:
571.428 :mutation years:
571.428 :mutation years:
1050.0 :mutations per geologic interval:

#### Testcase 3

table 3 printed in tcl format
quantity value comment, if any
3 :testcase_number
10000000.0 :mutation rate years (1/N):
9000.0 :number of females:
5.0 :offspring per female:
800000.0 :geologic interval years:
1000.0 :mutation years:
222.222 :mutation years:
222.222 :mutation years:
3600.0 :mutations per geologic interval:

### Screenshots Section

#### figure 1. Calculator Screenshot

Biological Mutation Rate and TCL calculator screenshot

### Pseudocode & Equations Section

```    more than one formula for 1) calculator shell
hip_height equals expr { foot_length * 5. }
relative_stride_length = [ expr { \$stride_length/\$hip_height} ]
dim_speed = [ expr {0.5*\$actual_speed/(10.*\$hip_height)}]```

## Appendix Code

### Trial Code

```        # TCL source code follows
# pretty print from autoindent and ased editor
# Biological Dinosaur Trackway Mass calculator V2
# written on Windows XP on TCL
# working under TCL version 8.6
# gold on TCL Club, 12Feb2020
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 {{} {Dinosaur foot length meters ( N) :} }
lappend names {stride length meters:}
lappend names {test: }
lappend names {test : }
lappend names {hip height meters:}
lappend names {test: }
lappend names {test: }
lappend names {test: }
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
set msg "Calculator for Biological Dinosaur Trackway Mass
from TCL
# gold on TCL Club, 12Dec2019 "
tk_messageBox -title "About" -message \$msg }
proc self_help {} {
set msg " Biological Dinosaur Trackway Mass V2
from TCL ,
# self help listing
# problem, Biological Dinosaur Trackway Mass V2
# 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, the
# testcase number is internal to the calculator and
# will not be printed until the report button is pushed
# for the current result numbers.
# This posting, screenshots, and TCL source code is
# Editorial rights and disclaimers
# retained under the TCL/TK license terms
# and will be defended as necessary in court.
Conventional text editor formulas or
grabbed from internet
screens can be pasted into green console.
# gold on  TCL Club, 12Feb2020 "
tk_messageBox -title "Self_Help" -message \$msg }
proc calculate {     } {
global side1 side2 side3 side4 side5
global side6 side7 side8
global testcase_number
incr testcase_number
set side1 [* \$side1 1. ]
set side2 [* \$side2 1. ]
set side3 [* \$side3 1. ]
set side4 [* \$side4 1. ]
set side5 [* \$side5 1. ]
set side6 [* \$side6 1. ]
set side7 [* \$side7 1. ]
set side8 [* \$side8 1. ]
set foot_length \$side1
set hip_height [* \$side1 5. ]
set actual_speed 2.
set stride_length 2.
set relative_stride_length [ expr \$stride_length/\$hip_height ]
set dim_speed [ expr 0.5*\$actual_speed/(10.*\$hip_height)]
set side5 [* \$side1 5. ]
set side6 1.
set side7 1.
set side8 1.
}
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 eval {.console config -bg palegreen}
console eval {.console config -font {fixed 20 bold}}
console eval {wm geometry . 40x20}
console eval {wm title . " Biological Dinosaur Trackway Mass Report V2, screen grab and paste from console 2 to texteditor"}
console eval {. configure -background orange -highlightcolor brown -relief raised -border 30}
console show;
puts "%|table \$testcase_number |printed in| tcl format|% "
puts "&| quantity| value| comment, if any|& "
puts "&| \$testcase_number :|testcase_number | |&"
puts "&| \$side1 :|Dinosaur foot length meters (N):  |   |&"
puts "&| \$side2 :|test:   | |& "
puts "&| \$side3 :|test: | |& "
puts "&| \$side4 :|test:  | |&"
puts "&| \$side5 :|hip height meters: | |&"
puts "&| \$side6 :|test: |  |&"
puts "&| \$side7 :|test: |  |&"
puts "&| \$side8 :|test: |  |&"
}
frame .buttons -bg aquamarine4
::ttk::button .calculator -text "Solve" -command { set side8 0 ; calculate   }
::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 1. 1. 1. 1.   1. 1. 1. 1. }
::ttk::button .test3 -text "Testcase2" -command {clearx;fillup .5 1. 1. 1. 1. 1. 1. 1. }
::ttk::button .test4 -text "Testcase3" -command {clearx;fillup .1 1. 1. 1.  1. 1. 1. 1. }
::ttk::button .clearallx -text clear -command {clearx }
::ttk::button .self_help -text self_help -command { self_help }
::ttk::button .cons -text report -command { reportx }
::ttk::button .exit -text exit -command {exit}
pack  .clearallx .cons  .self_help .about .exit .test4 .test3 .test2   -side bottom -in .buttons
grid .frame .buttons -sticky ns -pady {0 10}
. configure -background aquamarine4 -highlightcolor brown -relief raised -border 30
wm title . "Biological Dinosaur Trackway Mass Calculator V2"
```