This page is under development. Comments are welcome, but please load any comments in the comments section at the middle of the page. Thanks,gold
gold Here is an eTCL script on estimating mountain height for the etcl console.
In planning any software, there is a need to develop testcases. With back of envelope calculations, we can develop a number of peg points to check output of program.
Testcases
quantity | angle | units | angle | units | baseline | answer | method |
---|---|---|---|---|---|---|---|
1.0 | 56 | degrees | 67 | degrees | 500 | 525 | nasawebsite |
2.0 | 78 | degrees | 85 | degrees | 500 | 1924 | nasawebsite |
10.0 | 45 | degrees | 45 | degrees | 500 | 288 | nasawebsite |
Comments Section
Please place any comments here, Thanks.
Why do you utilize meaningless variable names in many of your procedures? I.e., aa, bb, cc as the inputs to mountain. Absent external explanations, aa, bb , cc have no meaning and therefore the names themselves do not help to guide a reader as to their meaning. Additionally, nom, denom have some meaning, numerator, denominator, but that meaning is self evident by being utilized in a division operation, so in the end, those names also convey zero additional meaning. Your example would be far easier to understand if you picked variable names that related to the real-world values that aa, bb, cc, nom, and denom actually represented.
# Pretty print version from autoindent # and ased editor # written on Windows XP on eTCL # code from TCL WIKI, eTCL console script # 8jun2011, [gold] console show proc deg {} {return [ expr {180./[pi]} ]} proc pi {} {expr acos(-1)} set counter 1 proc mountain { aa bb cc } { global counter past set aa [ expr { [deg]*$aa } ] set bb [ expr { [deg]*$bb } ] set nom [ expr { $cc*sin($aa)*sin($bb) } ] set denom [ expr { sin($aa)*sin($aa)-sin($bb)*sin($bb) } ] set denom [ expr { sqrt($denom) } ] set xheight [ expr { $nom/$denom } ] puts "$counter $aa $bb distance $cc moun $xheight " incr counter wm title . "estimating mountain height" } mountain 30 20 10