diff --git a/README.md b/README.md index 1d2430a..f513df9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,20 @@ # regLines -Tool for generating random variables that follows given frequency distibution using linear regressions in given intervals. +Tool for generating random variables that follows given frequency distibution using linear regressions in given intervals. +GitHub: https://github.com/YujiSODE/regLines +>Copyright (c) 2017 Yuji SODE \ +>This software is released under the MIT License. +>See LICENSE or http://opensource.org/licenses/mit-license.php +______ +## 1. Synopsis +`::regLines::reglines X Y ?name?;` +it outputs tcl script file that defines additional math functions (`lines(x)`, `linesPDF(x)` and `linesVar()`) and returns generated filename +- `$X` and `$Y`: numerical lists for x-axis and y-axis +- `$name`: a text used in order to generate filename of output file, and numbers are default value. + generated filename has a form of `"${name}_regL.tcl"` + +## 2. Script +It requires Tcl/Tk 8.6+. +- `regLines.tcl` + +## 3. Library list +- lSum/lSum.tcl (Yuji SODE, 2018): https://gist.github.com/YujiSODE/1f9a4e2729212691972b196a76ba9bd0 diff --git a/regLines.tcl b/regLines.tcl index 7da6c87..b5ee5a6 100644 --- a/regLines.tcl +++ b/regLines.tcl @@ -54,10 +54,10 @@ package require Tcl 8.6; namespace eval ::tcl::mathfunc { #=== lSum.tcl (Yuji SODE, 2018): https://gist.github.com/YujiSODE/1f9a4e2729212691972b196a76ba9bd0 === #it returns sum of given list - #Reference: Iri, M., and Fujino., Y. 1985. Suchi keisan no joshiki (Japanese). Kyoritsu Shuppan Co., Ltd. ISBN 978-4-320-01343-8 + #Reference: Iri, M. and Fujino, Y. 1985. Suchi keisan no joshiki (Japanese). Kyoritsu Shuppan Co., Ltd. ISBN 978-4-320-01343-8 proc lSum {list} { #=== lSum.tcl (Yuji SODE, 2018): https://gist.github.com/YujiSODE/1f9a4e2729212691972b196a76ba9bd0 === - #Reference: Iri, M., and Fujino., Y. 1985. Suchi keisan no joshiki (Japanese). Kyoritsu Shuppan Co., Ltd. ISBN 978-4-320-01343-8 + #Reference: Iri, M. and Fujino, Y. 1985. Suchi keisan no joshiki (Japanese). Kyoritsu Shuppan Co., Ltd. ISBN 978-4-320-01343-8 namespace path {::tcl::mathop};set S 0.0;set R 0.0;set T 0.0;foreach e $list {set R [+ $R [expr double($e)]];set T $S;set S [+ $S $R];set T [+ $S [expr {-$T}]];set R [+ $R [expr {-$T}]];};return $S; }; #