Now with statistically unbiased approx.
parent
5ddb166caa
commit
0e34b0259a
|
@ -3,7 +3,8 @@
|
|||
USING: kernel math math.points math.function-tools ;
|
||||
IN: math.derivatives
|
||||
|
||||
: small-amount ( -- n ) 1.0e-12 ;
|
||||
: near ( x -- y ) small-amount + ;
|
||||
: derivative ( x function -- m ) 2dup [ near ] dip [ eval ] 2bi@ slope ;
|
||||
: small-amount ( -- n ) 1.0e-14 ;
|
||||
: some-more ( x -- y ) small-amount + ;
|
||||
: some-less ( x -- y ) small-amount - ;
|
||||
: derivative ( x function -- m ) [ [ some-more ] dip eval ] [ [ some-less ] dip eval ] 2bi slope ;
|
||||
: derivative-func ( function -- function ) [ derivative ] curry ;
|
Loading…
Reference in New Issue