]> gitweb.factorcode.org Git - factor.git/commitdiff
fix math docs, refactor a bit
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 7 Dec 2008 05:12:38 +0000 (23:12 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 7 Dec 2008 05:12:38 +0000 (23:12 -0600)
extra/math/finance/finance-docs.factor
extra/math/finance/finance.factor
extra/math/numerical-integration/numerical-integration.factor

index 97e44d2927de44df95ecfab9ebe3eda5752d0a42..a1e81bf66595038e2c3289b27869b995fbdb09f9 100644 (file)
@@ -1,8 +1,6 @@
-! Copyright (C) 2008 John Benediktsson
+! Copyright (C) 2008 John Benediktsson, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license
-
-USING: help.markup help.syntax ;
-
+USING: help.markup help.syntax math ;
 IN: math.finance
 
 HELP: sma
@@ -73,3 +71,18 @@ HELP: weekly
      { "y" number }
 }
 { $description "Divides a number by the number of weeks in a year." } ;
+
+ARTICLE: "time-period-calculations" "Calculations over periods of time"
+{ $subsection monthly }
+{ $subsection semimonthly }
+{ $subsection biweekly }
+{ $subsection weekly }
+{ $subsection daily-360 }
+{ $subsection daily-365 } ;
+
+ARTICLE: "math.finance" "Financial math"
+"The " { $vocab-link "math.finance" } " vocabulary contains financial calculation words." $nl
+"Calculating payroll over periods of time:"
+{ $subsection "time-period-calculations" } ;
+
+ABOUT: "math.finance"
index a1f2316c3890d3c8e8936b8770e72d851c98eb35..4823e358b007137783752f7258d3998eb9727daa 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 John Benediktsson.
+! Copyright (C) 2008 John Benediktsson, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays assocs kernel grouping sequences shuffle
 math math.functions math.statistics math.vectors ;
index dfaa618b536f27b2ea0b4cb8e4e1e2d823cab5c6..6b46ba02430a6e78464ba76bed93907128296957 100644 (file)
@@ -4,15 +4,16 @@ USING: arrays kernel sequences namespaces make math math.ranges
 math.vectors vectors ;
 IN: math.numerical-integration
 
-SYMBOL: num-steps 180 num-steps set-global
+SYMBOL: num-steps
+
+180 num-steps set-global
 
 : setup-simpson-range ( from to -- frange )
     2dup swap - num-steps get / <range> ;
 
 : generate-simpson-weights ( seq -- seq )
-    { 1 4 }
-    swap length 2 / 2 - { 2 4 } <repetition> concat
-    { 1 } 3append ;
+    length 2 / 2 - { 2 4 } <repetition> concat
+    { 1 4 } { 1 } surround ;
 
 : integrate-simpson ( from to f -- x )
     [ setup-simpson-range dup ] dip