Commit 547719db authored by Liam M. Healy's avatar Liam M. Healy
Browse files

Add hyperbolic trigonometric functions sinh, cosh, tanh

parent 135361ef
;; Generic functions for generalized numbers
;; Liam Healy Tue Feb 9 1999 - 21:38
;; Time-stamp: <2011-02-21 19:22:34EST generic.lisp>
;; Time-stamp: <2011-03-23 12:07:40EDT generic.lisp>
;; Copyright 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -317,6 +317,33 @@
(:method ((seq sequence))
(map (type-of seq) #'abs seq)))
(defgeneric sinh (num)
(:documentation "The hyperbolic sine of the generalized or regular number.")
(:method ((num rational))
(cl:sinh (coerce num *read-default-float-format*)))
(:method ((num number))
(cl:sinh num))
(:method ((x sequence))
(map (type-of x) #'sinh x)))
(defgeneric cosh (num)
(:documentation "The hyperbolic cosine of the generalized or regular number.")
(:method ((num rational))
(cl:cosh (coerce num *read-default-float-format*)))
(:method ((num number))
(cl:cosh num))
(:method ((x sequence))
(map (type-of x) #'cosh x)))
(defgeneric tanh (num)
(:documentation "The hyperbolic tangent of the generalized or regular number.")
(:method ((num rational))
(cl:tanh (coerce num *read-default-float-format*)))
(:method ((num number))
(cl:tanh num))
(:method ((x sequence))
(map (type-of x) #'tanh x)))
;;;;****************************************************************************
;;;; Comparisons
;;;;****************************************************************************
......
;; Basic elementwise mathematics on grids.
;; Liam Healy 2011-01-03 21:04:20EST mathematics.lisp
;; Time-stamp: <2011-02-12 17:44:44EST mathematics.lisp>
;; Time-stamp: <2011-03-23 12:11:15EDT mathematics.lisp>
;; Copyright 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -36,6 +36,9 @@
(def-monadic sin)
(def-monadic cos)
(def-monadic tan)
(def-monadic sinh)
(def-monadic cosh)
(def-monadic tanh)
(def-monadic asin)
(def-monadic acos)
(def-monadic exp)
......
;; Define package and reader for Antik
;; Liam Healy 2010-12-24 09:12:15EST package.lisp
;; Time-stamp: <2011-03-01 12:40:19EST package.lisp>
;; Time-stamp: <2011-03-23 12:10:04EDT package.lisp>
;; Copyright 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -28,6 +28,7 @@
;; (:nicknames)
(:shadow #:+ #:- #:* #:/
#:sin #:cos #:tan #:asin #:acos #:atan
#:sinh #:cosh #:tanh
#:sqrt #:expt #:log #:exp #:abs
#:plusp #:minusp #:zerop #:min #:max
#:= #:>= #:> #:<= #:<
......
;; Arithmetic with physical quantities.
;; Liam Healy Fri Apr 22 2005 - 09:58
;; Time-stamp: <2011-02-19 21:48:52EST arithmetic.lisp>
;; Time-stamp: <2011-03-23 12:17:34EDT arithmetic.lisp>
;; Copyright 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -155,6 +155,18 @@
(undimensioned-should-not-be-here)
(cl:tan (flatten-angle x)))
(defmethod sinh ((x physical-quantity))
(undimensioned-should-not-be-here)
(cl:sinh (flatten-angle x)))
(defmethod cosh ((x physical-quantity))
(undimensioned-should-not-be-here)
(cl:cosh (flatten-angle x)))
(defmethod tanh ((x physical-quantity))
(undimensioned-should-not-be-here)
(cl:tanh (flatten-angle x)))
(defmethod asin ((x physical-quantity))
;; This should always signal an error
(check-dimension x 'dimensionless))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment