Use lifted Racket math definitions
Continue to provide the same definitions, but lift the Racket ones rather than rewrite and redefine them.
This commit is contained in:
parent
65ace21d22
commit
4ecc0525e7
|
@ -1,50 +1,18 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
;; math.rkt: some extra math routines
|
;; math.rkt: some extra math routines
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(module math frtime/frtime-lang-only
|
(module math frtime/frtime-lang-only
|
||||||
(provide e
|
(require (only-in racket/math pi sqr sgn conjugate sinh cosh))
|
||||||
pi
|
|
||||||
sqr
|
(provide (lifted
|
||||||
sgn conjugate
|
sqr
|
||||||
sinh cosh)
|
sgn conjugate
|
||||||
|
sinh cosh))
|
||||||
(define (sqr z) (* z z))
|
|
||||||
|
(provide pi e)
|
||||||
;; circular constants and aliases
|
|
||||||
(define e (exp 1.0))
|
;; circular constants and aliases
|
||||||
(define pi (atan 0 -1))
|
(define e (exp 1.0)))
|
||||||
|
|
||||||
;; sgn function
|
|
||||||
(define sgn
|
|
||||||
(lambda (x)
|
|
||||||
(if (exact? x)
|
|
||||||
(cond
|
|
||||||
((< x 0) -1)
|
|
||||||
((> x 0) 1)
|
|
||||||
(else 0))
|
|
||||||
(cond
|
|
||||||
((< x 0.0) -1.0)
|
|
||||||
((> x 0.0) 1.0)
|
|
||||||
(else 0.0)))))
|
|
||||||
|
|
||||||
;; complex conjugate
|
|
||||||
(define conjugate
|
|
||||||
(lambda (z)
|
|
||||||
(make-rectangular
|
|
||||||
(real-part z)
|
|
||||||
(- (imag-part z)))))
|
|
||||||
|
|
||||||
;; real hyperbolic functions
|
|
||||||
(define sinh
|
|
||||||
(lambda (x)
|
|
||||||
(/
|
|
||||||
(- (exp x) (exp (- x)))
|
|
||||||
2.0)))
|
|
||||||
|
|
||||||
(define cosh
|
|
||||||
(lambda (x)
|
|
||||||
(/
|
|
||||||
(+ (exp x) (exp (- x)))
|
|
||||||
2.0))))
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user