From 0e34b0259ad48aae467a67494ba3c7c1fd94a438 Mon Sep 17 00:00:00 2001 From: Rex Ford Date: Sat, 2 Aug 2008 13:57:59 -0400 Subject: [PATCH] Now with statistically unbiased approx. --- extra/math/derivatives/derivatives.factor | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extra/math/derivatives/derivatives.factor b/extra/math/derivatives/derivatives.factor index fef93cabc4..d92066efaf 100644 --- a/extra/math/derivatives/derivatives.factor +++ b/extra/math/derivatives/derivatives.factor @@ -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 ; \ No newline at end of file