2008-11-07 01:24:32 -05:00
|
|
|
! Copyright (c) 2008 Reginald Keith Ford II.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2008-12-18 01:16:43 -05:00
|
|
|
USING: kernel math arrays sequences ;
|
2008-11-07 01:24:32 -05:00
|
|
|
IN: math.function-tools
|
|
|
|
|
|
|
|
! Tools for quickly comparing, transforming, and evaluating mathematical functions
|
|
|
|
|
|
|
|
: difference-func ( func func -- func )
|
|
|
|
[ bi - ] 2curry ; inline
|
|
|
|
|
|
|
|
: eval ( x func -- pt )
|
2009-04-17 21:49:59 -04:00
|
|
|
dupd call( x -- y ) 2array ; inline
|
2008-11-07 01:24:32 -05:00
|
|
|
|
|
|
|
: eval-inverse ( y func -- pt )
|
2009-04-17 21:49:59 -04:00
|
|
|
dupd call( y -- x ) swap 2array ; inline
|
2008-11-07 01:24:32 -05:00
|
|
|
|
|
|
|
: eval3d ( x y func -- pt )
|
2009-04-17 21:49:59 -04:00
|
|
|
[ 2dup ] dip call( x y -- z ) 3array ; inline
|