wip as of ~2023.3.24
Transcendental and algebraic functions in native Hoon (and later jets).
It's time to supersede lazytrig
.
Arms in ++rs
and other @r
-servicing cores will be provided with necessary transcendental and trigonometric functions.
As a first pass, we implement operators for @rs
, @rd
, @rq
, and @rh
. After Lagoon is merged, we implement @lvs
, @lms
, @lvd
, and @lmd
.
-
@rs
-
@rd
-
@rq
-
@rh
-
@rsc
-
@rdc
-
@rqc
-
@rhc
-
@lvs
-
@lvd
-
@lvq
-
@lvh
-
@lms
-
@lmd
-
@lmq
-
@lmh
This requires us to finally resolves the treatment of complex numbers in Hoon (which I've here noted as @rsc
etc.).
- Possible four-letter alternative names: sake, salt, saxe, soon, star
- Possible two-letter core names: sa, sl
Checkmarks are a first pass in @rs
single-precision floating-point implementation:
-
pi
-
e
-
i
(complex only) -
phi
-
sqrt2
-
isclose
-
allclose
(over a(list @r)
) -
isint
-
isreal
(complex only) -
isimag
(complex only)
-
sgn
(also++sig
for compatibility) -
abs
-
sqrt
-
cbrt
-
arg
-
conj
(complex conjugate) (complex only) -
pow
-
pown
(faster integerpow
) -
log
-
log10
-
log2
-
exp
-
binomial
(Binomial coefficient)
-
sin
-
cos
-
tan
-
csc
-
sec
-
cot
-
arcsin
-
arccos
-
arctan
-
arccsc
-
arcsec
-
arccot
-
crd
(chord) -
siv
(versine)
-
sinh
-
cosh
-
tanh
-
csch
-
sech
-
coth
-
arcsinh
-
arccosh
-
arctanh
-
arccsch
-
arcsech
-
arccoth
-
besselj
-
bessely
-
besseli
-
besselk
-
ai
-
bi
-
gamma
-
elliptic
-
zeta
-
round
(regular banker's roundaing)-
round-decimal
(rounding to specific accuracy, e.g..100.01
)
-
-
linspace
(++gulf
which evenly spans a range in floating-point) -
iota
(APL-style++gulf
in floating-point) -
diff
(placeholder for adaptive algorithm in future)-
difffinite
(finite difference) -
diffpade
(Padé approximation)
-
-
integrate
(placeholder for adaptive algorithm as door in future)-
inttrapez
(trapezoid rule) -
intsimpson
(Simpson's rule)
-
-
newton
(locate a function zero using Newton's method)
The library will pass through ++rs
behaviors for ++add
and so forth for ease of use. Thus Saloon's ++rs
can act as a drop-in core for almost all Hoon ++rs
arms (except ++exp
and ++ma
).
- Milton Abramowitz & Irene Stegun, Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. 1964–2010.
- Forman Acton, Numerical Methods that (Usually) Work, 1ed. 1997.
- Bartosz Ciechanowski, “Float Exposed” (webapp)
- David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”
- Parviz Moin, Fundamentals of Engineering Numerical Analysis. 2ed. 2001.