You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stephen Colebourne <sc...@btopenworld.com> on 2003/05/06 23:07:10 UTC

Re: [Lang] proposed math extensions

In theory, much of this sounds useful. However the problem is where to stop.
A maths library could grow and grow to be bigger than [lang] itself. So care
must be taken.

Some of the simpler addditions to RandomUtils sound fine. Reseeding, extra
methods etc.

I am less sure about the need for Gaussian, Exponential, Poisson,  Binomial,
Geometric, or HyperGeometric distribution random numbrs - I don't even know
what most of these are. The solution may be to have a plugin style, that can
generate numbers from Random, SecureRandom or any of the above
distributions.

Computing  densities  and  statistitics  sounds out of scope for [lang] to
me.

Given this, perhaps you could discuss each item/submit small patches with
test cases to gradually introduce those features that make sense.

Stephen

----- Original Message -----
From: "Phil Steitz" <ph...@steitz.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Sunday, April 27, 2003 8:36 PM
Subject: [Lang] proposed math extensions


> I have code (and tests :-) for each of the following that I would be
> willing to contribute.  Is any of this appropriate for lang.math?
>
> 1. Generate random numbers from Gaussian, Exponential, Poisson,
> Binomial, Geometric, or HyperGeometric distributions.
> 2. Use SecureRandom to provide cryptographically secure random sequences
> for each of the above, plus the stuff already in RandomUtils, plus
> secure random strings (useful for generating "unpredictable" session id's)
> 3. Compute binomial coeffiecients and binomial, geometric,
> hypergeometric densities
> 4. Generate univariate statistics or frequency distributions from input
data
>
> I could include the stuff in 1.as a patch to math.RandomUtils.  Not sure
> where (if anywhere) the other things belong.
>
> I would also like to see math.RandomUtils modified to support the
following:
> a) reseeding the Random number generator. I could submit a patch to do
> this by adding a static Random to use in generating the uniform variates
> in place of math.random().
> b) add nextInt(min,max) (inclusive) and/or nextInt(IntRange r)
> I could submit a patch for this small extension as well.
>
> Phil
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Lang] proposed math extensions

Posted by Phil Steitz <ph...@steitz.com>.
Stephen Colebourne wrote:
> In theory, much of this sounds useful. However the problem is where to stop.
> A maths library could grow and grow to be bigger than [lang] itself. So care
> must be taken.
> 
> Some of the simpler addditions to RandomUtils sound fine. Reseeding, extra
> methods etc.
> 
> I am less sure about the need for Gaussian, Exponential, Poisson,  Binomial,
> Geometric, or HyperGeometric distribution random numbrs - I don't even know
> what most of these are. The solution may be to have a plugin style, that can
> generate numbers from Random, SecureRandom or any of the above
> distributions.
> 
> Computing  densities  and  statistitics  sounds out of scope for [lang] to
> me.
> 
> Given this, perhaps you could discuss each item/submit small patches with
> test cases to gradually introduce those features that make sense.
> 
Based on all the feedback below, I will take this approach, at least
regarding [lang].  I have already submitted one small patch
(http://issues.apache.org/bugzilla/show_bug.cgi?id=19365) and I will
follow this post with a sequence of small extensions to what is already
in [lang.math] including patches and test cases. I will stick to things
that just logially complete what is already there. I assume that the
right way to do this is by submitting the patches + test cases as
Bugzilla bug reports.  The patch referenced above adds nextLong(n) plus
a math test suite.  It also modifies nextInt(n) to throw an
IllegalArgumentException if n<=0.  Since this last item could break code
that uses nextInt with non-positive arguments, I am not sure in
retrospect if that was the best thing to do. Should I submit a revised
patch to the ticket with the IllegalArgumentException removed?

I am interested in also discussing [math] or [math-stat].  I am a
mathematician by training, though, like Henri, not a numerical analyst,
so my own contributions would be limited to simple implementations of
well-known algorithms for common problems and reviewing code/test
cases/docs for more complex algorithms implemented by others. I have
implemented several of these things myself since either a) I could not
find OS implementations that did what I needed or b) what I could find
had extra baggage (sometimes legal :-) attached that made it difficult
to use.

I am pretty much an OS newbie in terms of contribution, so I would need
some help/gentle guidance getting something like [commons-math] going,
but I am willing to put some time into it and help out in any way that I
can. How exactly would something like this get started?  Should I start
by preparing a proposal based on the idea of starting with lang.math and
adding some simple stat and numerical analysis extensions? Or is this
just not something suitable for Jakarta-Commons?


Phil


> Stephen
> 
> ----- Original Message -----
> From: "Phil Steitz" <ph...@steitz.com>
> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> Sent: Sunday, April 27, 2003 8:36 PM
> Subject: [Lang] proposed math extensions
> 
> 
> 
>>I have code (and tests :-) for each of the following that I would be
>>willing to contribute.  Is any of this appropriate for lang.math?
>>
>>1. Generate random numbers from Gaussian, Exponential, Poisson,
>>Binomial, Geometric, or HyperGeometric distributions.
>>2. Use SecureRandom to provide cryptographically secure random sequences
>>for each of the above, plus the stuff already in RandomUtils, plus
>>secure random strings (useful for generating "unpredictable" session id's)
>>3. Compute binomial coeffiecients and binomial, geometric,
>>hypergeometric densities
>>4. Generate univariate statistics or frequency distributions from input
> 
> data
> 
>>I could include the stuff in 1.as a patch to math.RandomUtils.  Not sure
>>where (if anywhere) the other things belong.
>>
>>I would also like to see math.RandomUtils modified to support the
> 
> following:
> 
>>a) reseeding the Random number generator. I could submit a patch to do
>>this by adding a static Random to use in generating the uniform variates
>>in place of math.random().
>>b) add nextInt(min,max) (inclusive) and/or nextInt(IntRange r)
>>I could submit a patch for this small extension as well.
>>
>>Phil
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Lang] proposed math extensions

Posted by Henri Yandell <ba...@generationjava.com>.
On Tue, 6 May 2003, Stephen Colebourne wrote:

> You might be right, but I know I couldn't contribute as I don't have the
> expertise...

Ditto. I'm a mathematician by education, but applied-maths/mathematical-physics.
Stats and Numerical Analysis are the most likely Math package entries and
I didn't work a lot in these areas.

> There is also the question of whether there is a good OSS maths component
> already. http://dautelle.com/jade has some maths functionality - don't know
> how much though.

Not much more than Commons Lang would end up with at the maximum I think.
Complex, Real, Matrix and some Function/Operable concepts to map to
functional programming ideas, a bit like [functor].

I've not seen a good set of OSS numerical-analysis/statistic algorithm
implementations, but it's pretty early days in this area I think. Ronald
Mak's (sp?) recent Number Cruncher book is only the 2nd or 3rd numerical
analysis Java book I've seen and I've never seen one that focuses on a
statistical bent.

However, these people spam me each month with a newsletter and have a lot
listed for Java/Maths:

http://www.mathtools.net/Java/index.html

Hen

>
> Stephen
>
> ----- Original Message -----
> From: "robert burrell donkin" <ro...@blueyonder.co.uk>
> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> Sent: Tuesday, May 06, 2003 10:11 PM
> Subject: Re: [Lang] proposed math extensions
>
>
> > it's sort of in-scope but i agree that it's something that could easily
> > get out of hand. it sounds to me like there might be enough momentum for a
> > separate maths component here in the commons.
> >
> > - robert
> >
> > On Tuesday, May 6, 2003, at 10:07 PM, Stephen Colebourne wrote:
> >
> > > In theory, much of this sounds useful. However the problem is where to
> > > stop.
> > > A maths library could grow and grow to be bigger than [lang] itself. So
> > > care
> > > must be taken.
> > >
> > > Some of the simpler addditions to RandomUtils sound fine. Reseeding,
> extra
> > > methods etc.
> > >
> > > I am less sure about the need for Gaussian, Exponential, Poisson,
> > > Binomial,
> > > Geometric, or HyperGeometric distribution random numbrs - I don't even
> > > know
> > > what most of these are. The solution may be to have a plugin style, that
> > > can
> > > generate numbers from Random, SecureRandom or any of the above
> > > distributions.
> > >
> > > Computing  densities  and  statistitics  sounds out of scope for [lang]
> to
> > > me.
> > >
> > > Given this, perhaps you could discuss each item/submit small patches
> with
> > > test cases to gradually introduce those features that make sense.
> > >
> > > Stephen
> > >
> > > ----- Original Message -----
> > > From: "Phil Steitz" <ph...@steitz.com>
> > > To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> > > Sent: Sunday, April 27, 2003 8:36 PM
> > > Subject: [Lang] proposed math extensions
> > >
> > >
> > >> I have code (and tests :-) for each of the following that I would be
> > >> willing to contribute.  Is any of this appropriate for lang.math?
> > >>
> > >> 1. Generate random numbers from Gaussian, Exponential, Poisson,
> > >> Binomial, Geometric, or HyperGeometric distributions.
> > >> 2. Use SecureRandom to provide cryptographically secure random
> sequences
> > >> for each of the above, plus the stuff already in RandomUtils, plus
> > >> secure random strings (useful for generating "unpredictable" session
> id'
> > >> s)
> > >> 3. Compute binomial coeffiecients and binomial, geometric,
> > >> hypergeometric densities
> > >> 4. Generate univariate statistics or frequency distributions from input
> > > data
> > >>
> > >> I could include the stuff in 1.as a patch to math.RandomUtils.  Not
> sure
> > >> where (if anywhere) the other things belong.
> > >>
> > >> I would also like to see math.RandomUtils modified to support the
> > > following:
> > >> a) reseeding the Random number generator. I could submit a patch to do
> > >> this by adding a static Random to use in generating the uniform
> variates
> > >> in place of math.random().
> > >> b) add nextInt(min,max) (inclusive) and/or nextInt(IntRange r)
> > >> I could submit a patch for this small extension as well.
> > >>
> > >> Phil
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > >> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> > >>
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Lang] proposed math extensions

Posted by Stephen Colebourne <sc...@btopenworld.com>.
You might be right, but I know I couldn't contribute as I don't have the
expertise...

There is also the question of whether there is a good OSS maths component
already. http://dautelle.com/jade has some maths functionality - don't know
how much though.

Stephen

----- Original Message -----
From: "robert burrell donkin" <ro...@blueyonder.co.uk>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Tuesday, May 06, 2003 10:11 PM
Subject: Re: [Lang] proposed math extensions


> it's sort of in-scope but i agree that it's something that could easily
> get out of hand. it sounds to me like there might be enough momentum for a
> separate maths component here in the commons.
>
> - robert
>
> On Tuesday, May 6, 2003, at 10:07 PM, Stephen Colebourne wrote:
>
> > In theory, much of this sounds useful. However the problem is where to
> > stop.
> > A maths library could grow and grow to be bigger than [lang] itself. So
> > care
> > must be taken.
> >
> > Some of the simpler addditions to RandomUtils sound fine. Reseeding,
extra
> > methods etc.
> >
> > I am less sure about the need for Gaussian, Exponential, Poisson,
> > Binomial,
> > Geometric, or HyperGeometric distribution random numbrs - I don't even
> > know
> > what most of these are. The solution may be to have a plugin style, that
> > can
> > generate numbers from Random, SecureRandom or any of the above
> > distributions.
> >
> > Computing  densities  and  statistitics  sounds out of scope for [lang]
to
> > me.
> >
> > Given this, perhaps you could discuss each item/submit small patches
with
> > test cases to gradually introduce those features that make sense.
> >
> > Stephen
> >
> > ----- Original Message -----
> > From: "Phil Steitz" <ph...@steitz.com>
> > To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> > Sent: Sunday, April 27, 2003 8:36 PM
> > Subject: [Lang] proposed math extensions
> >
> >
> >> I have code (and tests :-) for each of the following that I would be
> >> willing to contribute.  Is any of this appropriate for lang.math?
> >>
> >> 1. Generate random numbers from Gaussian, Exponential, Poisson,
> >> Binomial, Geometric, or HyperGeometric distributions.
> >> 2. Use SecureRandom to provide cryptographically secure random
sequences
> >> for each of the above, plus the stuff already in RandomUtils, plus
> >> secure random strings (useful for generating "unpredictable" session
id'
> >> s)
> >> 3. Compute binomial coeffiecients and binomial, geometric,
> >> hypergeometric densities
> >> 4. Generate univariate statistics or frequency distributions from input
> > data
> >>
> >> I could include the stuff in 1.as a patch to math.RandomUtils.  Not
sure
> >> where (if anywhere) the other things belong.
> >>
> >> I would also like to see math.RandomUtils modified to support the
> > following:
> >> a) reseeding the Random number generator. I could submit a patch to do
> >> this by adding a static Random to use in generating the uniform
variates
> >> in place of math.random().
> >> b) add nextInt(min,max) (inclusive) and/or nextInt(IntRange r)
> >> I could submit a patch for this small extension as well.
> >>
> >> Phil
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Lang] proposed math extensions

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
it's sort of in-scope but i agree that it's something that could easily 
get out of hand. it sounds to me like there might be enough momentum for a 
separate maths component here in the commons.

- robert

On Tuesday, May 6, 2003, at 10:07 PM, Stephen Colebourne wrote:

> In theory, much of this sounds useful. However the problem is where to 
> stop.
> A maths library could grow and grow to be bigger than [lang] itself. So 
> care
> must be taken.
>
> Some of the simpler addditions to RandomUtils sound fine. Reseeding, extra
> methods etc.
>
> I am less sure about the need for Gaussian, Exponential, Poisson,  
> Binomial,
> Geometric, or HyperGeometric distribution random numbrs - I don't even 
> know
> what most of these are. The solution may be to have a plugin style, that 
> can
> generate numbers from Random, SecureRandom or any of the above
> distributions.
>
> Computing  densities  and  statistitics  sounds out of scope for [lang] to
> me.
>
> Given this, perhaps you could discuss each item/submit small patches with
> test cases to gradually introduce those features that make sense.
>
> Stephen
>
> ----- Original Message -----
> From: "Phil Steitz" <ph...@steitz.com>
> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> Sent: Sunday, April 27, 2003 8:36 PM
> Subject: [Lang] proposed math extensions
>
>
>> I have code (and tests :-) for each of the following that I would be
>> willing to contribute.  Is any of this appropriate for lang.math?
>>
>> 1. Generate random numbers from Gaussian, Exponential, Poisson,
>> Binomial, Geometric, or HyperGeometric distributions.
>> 2. Use SecureRandom to provide cryptographically secure random sequences
>> for each of the above, plus the stuff already in RandomUtils, plus
>> secure random strings (useful for generating "unpredictable" session id'
>> s)
>> 3. Compute binomial coeffiecients and binomial, geometric,
>> hypergeometric densities
>> 4. Generate univariate statistics or frequency distributions from input
> data
>>
>> I could include the stuff in 1.as a patch to math.RandomUtils.  Not sure
>> where (if anywhere) the other things belong.
>>
>> I would also like to see math.RandomUtils modified to support the
> following:
>> a) reseeding the Random number generator. I could submit a patch to do
>> this by adding a static Random to use in generating the uniform variates
>> in place of math.random().
>> b) add nextInt(min,max) (inclusive) and/or nextInt(IntRange r)
>> I could submit a patch for this small extension as well.
>>
>> Phil
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Lang] proposed math extensions

Posted by Henri Yandell <ba...@generationjava.com>.
+1. I think the important thing to focus on for Lang.Math is functionality
which makes the current JDK Math functionality easier/better to use. As
far as new features, I think the only place we should be nosing around is
something like a Complex numbers class or another utterly basic
mathematical construct.

ie) We should have a Math.sign(number) method for returning +1/-1.

Hen

On Tue, 6 May 2003, Stephen Colebourne wrote:

> In theory, much of this sounds useful. However the problem is where to stop.
> A maths library could grow and grow to be bigger than [lang] itself. So care
> must be taken.
>
> Some of the simpler addditions to RandomUtils sound fine. Reseeding, extra
> methods etc.
>
> I am less sure about the need for Gaussian, Exponential, Poisson,  Binomial,
> Geometric, or HyperGeometric distribution random numbrs - I don't even know
> what most of these are. The solution may be to have a plugin style, that can
> generate numbers from Random, SecureRandom or any of the above
> distributions.
>
> Computing  densities  and  statistitics  sounds out of scope for [lang] to
> me.
>
> Given this, perhaps you could discuss each item/submit small patches with
> test cases to gradually introduce those features that make sense.
>
> Stephen
>
> ----- Original Message -----
> From: "Phil Steitz" <ph...@steitz.com>
> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> Sent: Sunday, April 27, 2003 8:36 PM
> Subject: [Lang] proposed math extensions
>
>
> > I have code (and tests :-) for each of the following that I would be
> > willing to contribute.  Is any of this appropriate for lang.math?
> >
> > 1. Generate random numbers from Gaussian, Exponential, Poisson,
> > Binomial, Geometric, or HyperGeometric distributions.
> > 2. Use SecureRandom to provide cryptographically secure random sequences
> > for each of the above, plus the stuff already in RandomUtils, plus
> > secure random strings (useful for generating "unpredictable" session id's)
> > 3. Compute binomial coeffiecients and binomial, geometric,
> > hypergeometric densities
> > 4. Generate univariate statistics or frequency distributions from input
> data
> >
> > I could include the stuff in 1.as a patch to math.RandomUtils.  Not sure
> > where (if anywhere) the other things belong.
> >
> > I would also like to see math.RandomUtils modified to support the
> following:
> > a) reseeding the Random number generator. I could submit a patch to do
> > this by adding a static Random to use in generating the uniform variates
> > in place of math.random().
> > b) add nextInt(min,max) (inclusive) and/or nextInt(IntRange r)
> > I could submit a patch for this small extension as well.
> >
> > Phil
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org