*** Chinese Sea Island Height Slot Calculator Example*** ---- 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 to estimate Sea Island Height. Sea Island Mathmatics Manual was a Chinese math book by Liu Hui. ---- In planning any software, need a good testcase. height of both poles was 30 chi distance between 2 poles was 6000 chi back pole offset distance was 762 chi forward pole offset distance was 738 chi. textbook answer was 4 li and 55 steps or 7530 chi. checking the math by hand calculator: ((pole height * distance between 2 poles)/ (back pole offset distance - forward pole offset distance)) +pole height ((30 chi * 6000 chi)/(762 chi - 738 chi)) +30 chi equals 7530 chi ---- ---- ***Screenshots Section*** [http://farm5.static.flickr.com/4095/4905065165_1f66b1e43f.jpg] ---- '''Comments Section''' Please place any comments here, Thanks. ---- ***References:*** * http://wwmat.mat.fc.ul.pt/~jnsilva/Sherlock/china2.pdf * Liu Hui * http://www-groups.dcs.st-and.ac.uk/~history/Biographies/Liu_Hui.html * http://www.hardsumsclub.co.uk/quiz/liu.pdf * http://en.wikipedia.org/wiki/The_Sea_Island_Mathematical_Manual * http://math.ucsd.edu/programs/undergraduate/history_of_math_resource/history_papers/math_history_01.pdf * http://kaleidoscope.cultural-china.com/en/135Kaleidoscope5304.html * http://math2033.uark.edu/wiki/index.php/Liu_Hui ---- ****Appendix Code**** ****appendix TCL programs and scripts **** ---- ********************* ****FIRST VERSION *** ====== # Liu Hui on Sea Island Height # written on Windowws XP on eTCL # working under TCL version 8.5.6 and eTCL 1.0.1 # gold on TCL WIKI , 18aug2010 frame .frame -relief flat -bg aquamarine4 pack .frame -side top -fill y -anchor center set names {{} {both poles height:} {distance tween 2 poles:} {back poll offset :} {front pole offset:} {height:} {answer height :} {height/1000:}} foreach i {1 2 3 4 5 6 7} { 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 Sea Island Height. from TCL WIKI, written on eTCL " tk_messageBox -title "About" -message $msg } proc pi {} {expr acos(-1)} proc interlinear { xx1 yy1 xx3 yy3 xx2 } { return [expr { ((($xx2-$xx1)*($yy3-$yy1))/($xx3-$xx1))+ $yy1 } ] ;} proc pol { xx1 yy1 xx3 yy3 xx2 } { return [expr { ((($xx2-$xx1)*($yy3-$yy1))/($xx3-$xx1))+ $yy1 } ] ;} proc errorx {aa bb} {expr { $aa > $bb ? (($aa*1.)/$bb -1.)*100. : (($bb*1.)/$aa -1.)*100.}} proc height5 { aa bb cc } { set bb [ expr { $cc*[pi]/180. } ] set cc [ expr { $cc*[pi]/180. } ] set dd [ expr { 1.*$aa*tan($bb)*tan($cc)/( tan($cc)-tan($bb))} ] return $dd } proc seaisland5 { xx1 } { global side1 side2 side3 global side4 side5 side6 side7 set ss side1 set tt $side2 set xxx [ expr { $side4*[pi]/180. } ] set side5 [ expr { ((1.*$side1*$side2)/(1.*$side3-1.*$side4))+$side1} ] set side6 [ expr { ((1.*$side1*$side2)/(1.*$side3-1.*$side4))+$side1} ] set side7 [ expr { ((1.*$side1*$side2)/(1.*$side3-1.*$side4))+$side1} ] set side7 [ expr { $side7*.001} ] return $side7 } proc calculate { } { global colorwarning global colorback global answer2 answer3 global side1 side2 side3 side4 side5 side6 side7 set answer2 5 set answer2 [ seaisland5 $side1 ] set side7 $answer2 } proc fillup {aa bb cc dd ee ff gg} { .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 " } proc clearx {} { foreach i {1 2 3 4 5 6 7} { .frame.entry$i delete 0 end } } proc reportx {} { console show; puts " The interpolation function takes two know points on a line and solves for an intermediate point. The points are xx1,yy1 xx2,yy2 and xx3,?yy3? The input order of the five items is xx1 yy1 xx2 yy2 xx3 and solving for ?yy3?. The interpolation function loaded as proc pol. User should be able to write pol 50. 1000. 200. 1200. 150. and save answer (1133.3) on console." } frame .buttons -bg aquamarine4 ::ttk::button .calculator -text "Solve" -command { calculate } ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 30. 6000. 762. 738. 7530. 7530. 7530.} ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 30. 6000. 762. 738. 7530. 7530. 7530.} ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 30. 6000. 762. 738. 7530. 7530. 7530. } ::ttk::button .clearallx -text clear -command {clearx } ::ttk::button .about -text about -command about ::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 .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 . "Sea Island Height" ====== ---- <> Numerical Analysis | Toys | Calculator | Example | Mathematics+