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
|
||||
|
||||
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"
|
||||
|
|
|
@ -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 ;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue