fix math docs, refactor a bit
parent
4a5bf7e9d1
commit
3075eeb4ab
|
@ -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
|
! See http://factorcode.org/license.txt for BSD license
|
||||||
|
USING: help.markup help.syntax math ;
|
||||||
USING: help.markup help.syntax ;
|
|
||||||
|
|
||||||
IN: math.finance
|
IN: math.finance
|
||||||
|
|
||||||
HELP: sma
|
HELP: sma
|
||||||
|
@ -73,3 +71,18 @@ HELP: weekly
|
||||||
{ "y" number }
|
{ "y" number }
|
||||||
}
|
}
|
||||||
{ $description "Divides a number by the number of weeks in a year." } ;
|
{ $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"
|
||||||
|
|
|
@ -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.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays assocs kernel grouping sequences shuffle
|
USING: arrays assocs kernel grouping sequences shuffle
|
||||||
math math.functions math.statistics math.vectors ;
|
math math.functions math.statistics math.vectors ;
|
||||||
|
|
|
@ -4,15 +4,16 @@ USING: arrays kernel sequences namespaces make math math.ranges
|
||||||
math.vectors vectors ;
|
math.vectors vectors ;
|
||||||
IN: math.numerical-integration
|
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 )
|
: setup-simpson-range ( from to -- frange )
|
||||||
2dup swap - num-steps get / <range> ;
|
2dup swap - num-steps get / <range> ;
|
||||||
|
|
||||||
: generate-simpson-weights ( seq -- seq )
|
: generate-simpson-weights ( seq -- seq )
|
||||||
{ 1 4 }
|
length 2 / 2 - { 2 4 } <repetition> concat
|
||||||
swap length 2 / 2 - { 2 4 } <repetition> concat
|
{ 1 4 } { 1 } surround ;
|
||||||
{ 1 } 3append ;
|
|
||||||
|
|
||||||
: integrate-simpson ( from to f -- x )
|
: integrate-simpson ( from to f -- x )
|
||||||
[ setup-simpson-range dup ] dip
|
[ setup-simpson-range dup ] dip
|
||||||
|
|
Loading…
Reference in New Issue