2005-02-08 22:02:44 -05:00
|
|
|
! Copyright (C) 2004, 2005 Slava Pestov.
|
|
|
|
! See http://factor.sf.net/license.txt for BSD license.
|
2004-07-16 02:26:21 -04:00
|
|
|
IN: math
|
2005-02-08 22:02:44 -05:00
|
|
|
USING: kernel math math-internals ;
|
2004-07-16 02:26:21 -04:00
|
|
|
|
2006-08-16 21:55:53 -04:00
|
|
|
: acosh ( x -- y ) dup sq 1- sqrt + log ; inline
|
|
|
|
|
|
|
|
: asech ( x -- y ) recip acosh ; inline
|
|
|
|
|
|
|
|
: asinh ( x -- y ) dup sq 1+ sqrt + log ; inline
|
|
|
|
|
|
|
|
: acosech ( x -- y ) recip asinh ; inline
|
|
|
|
|
|
|
|
: atanh ( x -- y ) dup 1+ swap 1- neg / log 2 / ; inline
|
|
|
|
|
|
|
|
: acoth ( x -- y ) recip atanh ; inline
|
|
|
|
|
|
|
|
: [-1,1]? ( x -- ? )
|
|
|
|
dup complex? [ drop f ] [ abs 1 <= ] if ; inline
|
|
|
|
|
|
|
|
: asin ( x -- y )
|
|
|
|
dup [-1,1]? [ fasin ] [ i * asinh -i * ] if ; inline
|
|
|
|
|
|
|
|
: acos ( x -- y )
|
|
|
|
dup [-1,1]? [ facos ] [ asin pi 2 / swap - ] if ; inline
|
|
|
|
|
|
|
|
: atan ( x -- y )
|
|
|
|
dup [-1,1]? [ fatan ] [ i * atanh i * ] if ; inline
|
|
|
|
|
|
|
|
: asec ( x -- y ) recip acos ; inline
|
|
|
|
|
|
|
|
: acosec ( x -- y ) recip asin ; inline
|
|
|
|
|
|
|
|
: acot ( x -- y ) recip atan ; inline
|