more minor fixes

db4
Rex Ford 2008-07-22 20:45:13 -04:00
parent fa2e448e38
commit 4fc9860c0a
4 changed files with 7 additions and 5 deletions

View File

@ -8,6 +8,7 @@ backtrack math.ranges locals fry memoize macros assocs ;
IN: 24-game IN: 24-game
: nop ;
: do-something ( a b -- c ) { + - * } amb-execute ; : do-something ( a b -- c ) { + - * } amb-execute ;
: maybe-swap ( a b -- a b ) { nop swap } amb-execute ; : maybe-swap ( a b -- a b ) { nop swap } amb-execute ;
: some-rots ( a b c -- a b c ) : some-rots ( a b c -- a b c )

View File

@ -1,8 +1,9 @@
! Copyright © 2008 Reginald Keith Ford II ! Copyright © 2008 Reginald Keith Ford II
! Tool for computing the derivative of a function at a point ! Tool for computing the derivative of a function at a point
USING: kernel math math.points math.function-tools ; USING: kernel math math.points math.function-tools ;
IN: derivatives IN: math.derivatives
: small-amount ( -- n ) 1.0e-12 ; : small-amount ( -- n ) 1.0e-12 ;
: near ( x -- y ) small-amount + ; : near ( x -- y ) small-amount + ;
: derivative ( x function -- m ) 2dup [ near ] dip [ eval ] 2bi@ slope ; : derivative ( x function -- m ) 2dup [ near ] dip [ eval ] 2bi@ slope ;
: derivative-func ( function -- function ) [ derivative ] curry ;

View File

@ -1,8 +1,8 @@
! Copyright © 2008 Reginald Keith Ford II ! Copyright © 2008 Reginald Keith Ford II
! Tools for quickly comparing and evaluating mathematical Factor functions ! Tools for quickly comparing, transforming, and evaluating mathematical Factor functions
USING: kernel math arrays ; USING: kernel math arrays ;
IN: math.function-tools IN: math.function-tools
: difference-func ( func func -- func ) [ bi - ] 2curry ; : difference-func ( func func -- func ) [ bi - ] 2curry ;
: eval ( x func -- pt ) dupd call 2array ; : eval ( x func -- pt ) dupd call 2array ;
: eval3d ( x y func -- pt ) [ 2dup ] dip call 3array ; : eval3d ( x y func -- pt ) [ 2dup ] dip call 3array ;

View File

@ -1,7 +1,7 @@
! Copyright © 2008 Reginald Keith Ford II ! Copyright © 2008 Reginald Keith Ford II
! Newton's Method of approximating roots ! Newton's Method of approximating roots
USING: kernel math math.derivatives derivatives ; USING: kernel math math.derivatives ;
IN: newtons-method IN: newtons-method
<PRIVATE <PRIVATE