-
Should simple functions be implemented in apfloat? I'm thinking of:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
There must be very many such functions. For example HarmonicNumber was one of the ones suggested previously. It's not implemented (yet) but is trivial to compute with the digamma function. Some of the more common ones that are missing are e.g. Cot, Sec, Csc and their hyperbolic and arcus versions. There are of course some implementation details why some of such "simple" functions might make sense to implement. For example haversine probably suffers catastrophic precision loss near zero if calculated as |
Beta Was this translation helpful? Give feedback.
-
It's difficult to draw the line which ones might make sense to implement in the library and which not. Do you have a comprehensive list of functions that you suggest should be (possibly) implemented? Considerations include at least:
Historically I have tried to keep a "less is more" approach but recently this has slipped a bit. Instead of just having "building block" functions the library now contains dozens of obscure functions for which all of the three considerations above could be questioned (or at least some of them). So it's really a question of "less is more" vs. "everything but the kitchen sink" - there is no single answer to this question, it's more a matter of opinion perhaps. |
Beta Was this translation helpful? Give feedback.
-
I'm thinking that apfloat is a floating-point arithmetic with arbitrary precision for Java, similar to what is
and here is the index: |
Beta Was this translation helpful? Give feedback.
-
Well, mpmath was implemented by Fredrik Johansson who is a professional mathematician (and also a large number of other people have contributed to mpmath) whereas apfloat is a hobby project done mostly by one amateur hobbyist (me, that is). So aiming for everything that mpmath has might be a tall order, or at the very least take many years to implement. (Many algorithms used in apfloat have been taken from papers published by Mr. Johansson.) From the simple function list above, it seems mpmath doesn't have at least haversine or its inverse, or inverse Gudermannian. (Mathematica has all of them, apparently.) So perhaps the logistic sigmoid could be implemented, and sinc. |
Beta Was this translation helpful? Give feedback.
Well, mpmath was implemented by Fredrik Johansson who is a professional mathematician (and also a large number of other people have contributed to mpmath) whereas apfloat is a hobby project done mostly by one amateur hobbyist (me, that is). So aiming for everything that mpmath has might be a tall order, or at the very least take many years to implement. (Many algorithms used in apfloat have been taken from papers published by Mr. Johansson.)
From the simple function list above, it seems mpmath doesn't have at least haversine or its inverse, or inverse Gudermannian. (Mathematica has all of them, apparently.)
So perhaps the logistic sigmoid could be implemented, and sinc.