egison-3.6.0: lib/math/common/functions.egi
;;;;;
;;;;;
;;;;; Mathematical Functions
;;;;;
;;;;;
(define $exp
(lambda [$x]
(if (float? x)
(b.exp x)
(if (term? x)
(match x term-expr
{[,0 1]
[,1 e]
[<term $a <cons ,i <cons ,pi <nil>>>> (** -1 a)]
[_ (to-math-expr <Apply exp (map from-math-expr {x})>)]})
(to-math-expr <Apply exp (map from-math-expr {x})>)))))
(define $log
(lambda [$x]
(if (float? x)
(b.log x)
(match x math-expr
{[,1 0]
[,e 1]
[_ (to-math-expr <Apply log (map from-math-expr {x})>)]}))))
(define $cos
(lambda [$x]
(if (float? x)
(b.cos x)
(match x math-expr
{[,0 1]
[,(* 2 pi) 1]
[_ (to-math-expr <Apply cos (map from-math-expr {x})>)]}))))
(define $sin
(lambda [$x]
(if (float? x)
(b.sin x)
(match x math-expr
{[,0 0]
[_ (to-math-expr <Apply sin (map from-math-expr {x})>)]}))))
(define $tan
(lambda [$x]
(if (float? x)
(b.tan x)
(match x math-expr
{[,0 0]
[_ (to-math-expr <Apply tan (map from-math-expr {x})>)]}))))
(define $cosh
(lambda [$x]
(if (float? x)
(b.cosh x)
(match x math-expr
{[,0 1]
[_ (to-math-expr <Apply cosh (map from-math-expr {x})>)]}))))
(define $sinh
(lambda [$x]
(if (float? x)
(b.sinh x)
(match x math-expr
{[,0 0]
[_ (to-math-expr <Apply sinh (map from-math-expr {x})>)]}))))
(define $tanh
(lambda [$x]
(if (float? x)
(b.tanh x)
(match x math-expr
{[,0 0]
[_ (to-math-expr <Apply tanh (map from-math-expr {x})>)]}))))
(define $sinc
(lambda [$x]
(if (float? x)
(if (eq? x 0.0)
1.0
(/ (b.sin x) x))
(match x math-expr
{[,0 1]
[_ (/ (sin x) x)]}))))
(define $sigmoid
(lambda [$z]
(/ 1 (+ 1 (exp (* -1 z))))))
(define $kronecker-delta
(cambda $js
(if (all (eq? $ (car js)) (cdr js)) 1 0)))