Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sébastien Villemot
antik
Commits
547719db
Commit
547719db
authored
Mar 23, 2011
by
Liam M. Healy
Browse files
Add hyperbolic trigonometric functions sinh, cosh, tanh
parent
135361ef
Changes
4
Hide whitespace changes
Inline
Side-by-side
grid/generic.lisp
View file @
547719db
;; Generic functions for generalized numbers
;; Liam Healy Tue Feb 9 1999 - 21:38
;; Time-stamp: <2011-0
2
-2
1
1
9:22:34ES
T generic.lisp>
;; Time-stamp: <2011-0
3
-2
3
1
2:07:40ED
T 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
;;;;****************************************************************************
...
...
grid/mathematics.lisp
View file @
547719db
;; Basic elementwise mathematics on grids.
;; Liam Healy 2011-01-03 21:04:20EST mathematics.lisp
;; Time-stamp: <2011-0
2-12 17:44:44ES
T mathematics.lisp>
;; Time-stamp: <2011-0
3-23 12:11:15ED
T 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
)
...
...
init/package.lisp
View file @
547719db
;; Define package and reader for Antik
;; Liam Healy 2010-12-24 09:12:15EST package.lisp
;; Time-stamp: <2011-03-
01
12:
4
0:
19ES
T package.lisp>
;; Time-stamp: <2011-03-
23
12:
1
0:
04ED
T 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
#:=
#:>=
#:>
#:<=
#:<
...
...
physical-quantities/arithmetic.lisp
View file @
547719db
;; Arithmetic with physical quantities.
;; Liam Healy Fri Apr 22 2005 - 09:58
;; Time-stamp: <2011-0
2-19 21:48:52ES
T arithmetic.lisp>
;; Time-stamp: <2011-0
3-23 12:17:34ED
T 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
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment