On Sun, Jul 15, 2012 at 02:36:56PM +0300, ori ziv wrote:
> Hi,
>
> I've wrote two basic but useful utilities for probability and tests
> for them. I would like to ask if the developers of the Apache Commons
> Math project are interested in me submitting them. I still have some
> touching up to do so that they fit the style guidelines.
>
> The first is isProbability(double)
> which returns true if and only if x is a probability, i.e., not
> smaller than zero and not bigger than one.
I'd see something like that as useful within CM if it can replace this
kind of code
---
if (p < 0 || p > 1) {
throw new OutOfRangeException(p, 0, 1);
}
---
There are examples in "MathUtils" (e.g. "checkFinite").
I.e. it should come with an exception that inherits from
"OutOfRangeException" with a customized error message.
> The other is isSampleSpace(double[]) which returns true if and only if
> the values are a sample space, i.e., each value is a probability and
> the sum of the values in the input array is one.
Did you spot places in CM where this could be used?
>
> Prototype is attached.
I think that attachements are stripped by the ML manager. :-/
Regards,
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]