Re: [racket] Math library ready for testing

2012-12-17 Thread Neil Toronto
On 12/17/2012 04:06 AM, Pierpaolo Bernardi wrote: Some comments after scanning the manual. flulp-error "For non-rational arguments such as +nan.0, flulp-error returns 0.0 if (eqv? x r); otherwise it returns +inf.0." However one example is: (flulp-error +inf.0 +nan.0) +nan.0 Which does

Re: [racket] Math library ready for testing

2012-12-17 Thread Pierpaolo Bernardi
On Mon, Dec 17, 2012 at 1:55 PM, Jens Axel Søgaard wrote: >> >> moebius-mu > Would it be enough to add "distinct" ? IMO, yes. >> >> multinomial >> >> "(multinomial n ks) → Natural >>n : Integer >> ks : (Listof Integer) >> ... >>> (multinomial 5 3 2) >> 10" >> >> The example doe

Re: [racket] Math library ready for testing

2012-12-17 Thread Jens Axel Søgaard
Thank you for reading the manual carefully. 2012/12/17 Pierpaolo Bernardi : > Some comments after scanning the manual. > > gamma-inc > > "The following identities should hold: > > • (gamma-inc k x) = 0" > > I'm no expert, but this identity smells 8^) I think it should be (gamma-inc k x) >

Re: [racket] Math library ready for testing

2012-12-17 Thread Pierpaolo Bernardi
Some comments after scanning the manual. flulp-error "For non-rational arguments such as +nan.0, flulp-error returns 0.0 if (eqv? x r); otherwise it returns +inf.0." However one example is: > (flulp-error +inf.0 +nan.0) +nan.0 Which does not agree with the doc. "2.3.2 Flonum Constan

Re: [racket] Math library ready for testing

2012-12-12 Thread Harry Spier
Neil Toronto wrote: >The maximum number of threads a parallelized math function will use. > The default value is (max 1 (processor-count))." Pierpaolo replied:: >Isn't (max 1 (processor-count)) the same as (processor-count) ? >Or does Racket runs on machines with less than 1 processors? 8^) F

Re: [racket] Math library ready for testing

2012-12-12 Thread Neil Toronto
eil Toronto" Cc: users@racket-lang.org Sent: Wednesday, December 12, 2012 9:17:57 AM GMT -05:00 US/Canada Eastern Subject: Re: [racket] Math library ready for testing On Fri, Dec 7, 2012 at 9:33 PM, Neil Toronto wrote: I've just pushed the last commits that make the new math library

Re: [racket] Math library ready for testing

2012-12-12 Thread Pierpaolo Bernardi
Racket's sake. >>> -Ian >>> - Original Message - >>> From: "Pierpaolo Bernardi" >>> To: "Neil Toronto" >>> Cc: users@racket-lang.org >>> Sent: Wednesday, December 12, 2012 9:17:57 AM GMT -05:00 US/Canada >

Re: [racket] Math library ready for testing

2012-12-12 Thread Neil Toronto
-Ian - Original Message - From: "Pierpaolo Bernardi" To: "Neil Toronto" Cc: users@racket-lang.org Sent: Wednesday, December 12, 2012 9:17:57 AM GMT -05:00 US/Canada Eastern Subject: Re: [racket] Math library ready for testing On Fri, Dec 7, 2012 at 9:33 PM, Neil To

Re: [racket] Math library ready for testing

2012-12-12 Thread Robby Findler
> Cc: users@racket-lang.org > Sent: Wednesday, December 12, 2012 9:17:57 AM GMT -05:00 US/Canada Eastern > Subject: Re: [racket] Math library ready for testing > > On Fri, Dec 7, 2012 at 9:33 PM, Neil Toronto wrote: >> I've just pushed the last commits that make the new math

Re: [racket] Math library ready for testing

2012-12-12 Thread J. Ian Johnson
I imagine that's there more for Typed Racket's sake. -Ian - Original Message - From: "Pierpaolo Bernardi" To: "Neil Toronto" Cc: users@racket-lang.org Sent: Wednesday, December 12, 2012 9:17:57 AM GMT -05:00 US/Canada Eastern Subject: Re: [racket] Math lib

Re: [racket] Math library ready for testing

2012-12-12 Thread Pierpaolo Bernardi
On Fri, Dec 7, 2012 at 9:33 PM, Neil Toronto wrote: > I've just pushed the last commits that make the new math library ready for > wider testing. Almost everything ready for use is documented, the tests keep > passing, and everything *seems* to work. (max-math-threads) → Positive-Integer

Re: [racket] Math library ready for testing

2012-12-12 Thread Pierpaolo Bernardi
BTW, I seem to remember that GMP stores the table of small primes as a vector of the differences between consecutive primes. Storing a byte per prime goes a long way. Let's see... there are 50847534 primes under 10^9, the max difference between a consecutive pair of them is 282. We can store that

Re: [racket] Math library ready for testing

2012-12-11 Thread Hendrik Boom
On Tue, Dec 11, 2012 at 05:56:03PM +0100, Pierpaolo Bernardi wrote: > On Tue, Dec 11, 2012 at 5:11 PM, Stephen Bloch wrote: > > > > How many primes are below ten million? A hundred million? At some > > point storing the primes will take less memory than storing > > primality flags, but that

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Jens Axel Søgaard : I have just pushed an improvement for prime? on small numbers. Before: >> (time (for/sum ([n (in-range 100)] >> #:when (prime? n)) >> n)) >> >> ; cpu time: 8944 real time: 9079 gc time: 257 >> ; 37550402023 Now: cpu time: 1511 real time:

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Phil Bewig : > I can't type. The correct count of primes less than a million is 78498. And > there is something wrong if (nth-prime 78498) returns 13, as the 78498th > prime is 83. That's because nth-prime counts from 0 and Mathematica counts from 1. -- Jens Axel Søgaard

Re: [racket] Math library ready for testing

2012-12-11 Thread Pierpaolo Bernardi
On Tue, Dec 11, 2012 at 5:11 PM, Stephen Bloch wrote: > How many primes are below ten million? A hundred million? At some point > storing the primes will take less memory than storing primality flags, but > that point may be above the size of tables we can realistically store today. > (for

Re: [racket] Math library ready for testing

2012-12-11 Thread Phil Bewig
I can't type. The correct count of primes less than a million is 78498. And there is something wrong if (nth-prime 78498) returns 13, as the 78498th prime is 83. On Tue, Dec 11, 2012 at 10:46 AM, Martin Neal wrote: > I clicked the link, and the result shows 78498 which jives with nth-pri

Re: [racket] Math library ready for testing

2012-12-11 Thread Martin Neal
I clicked the link, and the result shows 78498 which jives with nth-prime On Tue, Dec 11, 2012 at 8:31 AM, Phil Bewig wrote: > There must be an error in the prime-counting function. According to href=" > http://www.wolframalpha.com/input/?i=how+many+primes+less+than+a+million";>Wolfram|Alpha, >

Re: [racket] Math library ready for testing

2012-12-11 Thread Phil Bewig
There must be an error in the prime-counting function. According to http://www.wolframalpha.com/input/?i=how+many+primes+less+than+a+million";>Wolfram|Alpha, there are 79486 primes less than a million, not 78497. I don't use Racket, but I do have lots of Scheme code that computes with prime number

Re: [racket] Math library ready for testing

2012-12-11 Thread Stephen Bloch
On Dec 11, 2012, at 9:03 AM, Jens Axel Søgaard wrote: > 2012/12/11 Stephen Bloch : > >> Would it perhaps make more sense for small-primes to contain primes >> themselves, in increasing order so one can be found by binary search, rather >> than booleans? The O(1) behavior would be replaced by O(

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Stephen Bloch : > Would it perhaps make more sense for small-primes to contain primes > themselves, in increasing order so one can be found by binary search, rather > than booleans? The O(1) behavior would be replaced by O(log(limit)), but > perhaps you would save enough memory to put

Re: [racket] Math library ready for testing

2012-12-11 Thread Sam Tobin-Hochstadt
Unfortunately, Maxima seems to be distributed under the GPL, which means that we can't easily just take their code and add it to Racket. Sam On Tue, Dec 11, 2012 at 8:52 AM, Jens Axel Søgaard wrote: > 2012/12/11 Jens Axel Søgaard : >> 2012/12/11 Jens Axel Søgaard : >>> Here is what Maxima does (

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Jens Axel Søgaard : > 2012/12/11 Jens Axel Søgaard : >> Here is what Maxima does (line 628 and below): >> >> https://github.com/andrejv/maxima/blob/master/src/ifactor.lisp > > I have attached a port in the attached file. The new primality > tester is called new-prime? and the old one pri

Re: [racket] Math library ready for testing

2012-12-11 Thread Sam Tobin-Hochstadt
On Tue, Dec 11, 2012 at 6:01 AM, Jens Axel Søgaard wrote: > > The second will be to experiment with "medium numbers" > and see whether trial division is faster than the pseudo > prime test, when the small prime limit is raised to larger number > again. One thing that might be worth considering, e

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Stephen Bloch : > On Dec 11, 2012, at 6:01 AM, Jens Axel Søgaard wrote: > Would it perhaps make more sense for small-primes to contain primes > themselves, in increasing order so one can be found by binary search, rather > than booleans? The O(1) behavior would be replaced by O(log(lim

Re: [racket] Math library ready for testing

2012-12-11 Thread Stephen Bloch
On Dec 11, 2012, at 6:01 AM, Jens Axel Søgaard wrote: > For a small (less than 1) number n prime? looks up primality of > with a simple (vector-ref small-primes n). > > For a large number (greater than 1) a pseudo prime test is used. > > Originally the limit for small primes was a mil

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Pierpaolo Bernardi : > On Tue, Dec 11, 2012 at 12:01 PM, Jens Axel Søgaard > wrote: > >> Below 60 there are only 16 numbers not divisible by 2, 3 or 5. >> The number of bytes needed to store primality results for the >> first million numbers will therefore be >> 100 * 16/60 *

Re: [racket] Math library ready for testing

2012-12-11 Thread Pierpaolo Bernardi
On Tue, Dec 11, 2012 at 12:01 PM, Jens Axel Søgaard wrote: > Below 60 there are only 16 numbers not divisible by 2, 3 or 5. > The number of bytes needed to store primality results for the > first million numbers will therefore be > 100 * 16/60 * 1/8 ~ 3.3 > > How much space would b

Re: [racket] Math library ready for testing

2012-12-11 Thread Robby Findler
FWIW, I think these questions are best answered with an app in hand, but my apriori guess would be to say that 32k isn't too bad, but that it also doesn't seem necessary in this case. Martin Neal's micro benchmark already saw lots of improvements with just a different algorithm so perhaps that's en

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Martin Neal : > First - I love the library. There's so much functionality that it's going > to take quite some time to explore it all > > I'd love to see an `in-primes` function added to math/number-theory. Excellent idea. I have added it to the todo-list. > Using a pseudo prime test

Re: [racket] Math library ready for testing

2012-12-10 Thread Neil Toronto
On 12/09/2012 04:52 AM, Jens Axel Søgaard wrote: The matrix library uses arrays to represent the matrices. An 2x3 matrix can be constructed as: (matrix/dim 2 3 1 2 3 4 5 6) (list->matrix '[[1 2 3] [4 5 6]]) (for/matrix: : Number 2 3 ([

Re: [racket] Math library ready for testing

2012-12-10 Thread Martin Neal
First - I love the library. There's so much functionality that it's going to take quite some time to explore it all I'd love to see an `in-primes` function added to math/number-theory

Re: [racket] Math library ready for testing

2012-12-09 Thread Jens Axel Søgaard
2012/12/8 Danny Yoo : >> Or maybe using a : or something to separate rows for 2D arrays? >> (array 1 2 : 3 4) The matrix library uses arrays to represent the matrices. An 2x3 matrix can be constructed as: (matrix/dim 2 3 1 2 3 4 5 6) (list->mat

Re: [racket] Math library ready for testing

2012-12-08 Thread Noel Welsh
On Fri, Dec 7, 2012 at 8:33 PM, Neil Toronto wrote: > I've just pushed the last commits that make the new math library ready for > wider testing. Almost everything ready for use is documented, the tests > keep passing, and everything *seems* to work. > > We (the Racket development team) need peop

Re: [racket] Math library ready for testing

2012-12-08 Thread Justin R. Slepak
Science dept. - Original Message - From: Neil Toronto To: Danny Yoo Cc: users@racket-lang.org Sent: Fri, 7 Dec 2012 22:50:57 -0500 (EST) Subject: Re: [racket] Math library ready for testing On 12/07/2012 07:57 PM, Danny Yoo wrote: > > Or maybe using a : or something to separat

Re: [racket] Math library ready for testing

2012-12-07 Thread Neil Toronto
On 12/07/2012 07:31 PM, Michael Wilber wrote: This is such an exciting time to be a Racket programmer! Thanks for all your work, Neil. You're welcome! You're also right, it is an exciting time. I wouldn't have even attempted the distributions and special functions without Typed Racket's opti

Re: [racket] Math library ready for testing

2012-12-07 Thread Neil Toronto
On 12/07/2012 07:57 PM, Danny Yoo wrote: Or maybe using a : or something to separate rows for 2D arrays? (array 1 2 : 3 4) (array 1 0 0 0 0 0 : 0 1 0 0 0 0 : 0 0 1 0 0 0 : 0 0 0 1 0 0 : 0 0 0 0 1 0 : 0 0 0 0 0 1) What about somethi

Re: [racket] Math library ready for testing

2012-12-07 Thread Danny Yoo
> Or maybe using a : or something to separate rows for 2D arrays? > (array 1 2 : 3 4) > > (array 1 0 0 0 0 0 > : 0 1 0 0 0 0 > : 0 0 1 0 0 0 > : 0 0 0 1 0 0 > : 0 0 0 0 1 0 > : 0 0 0 0 0 1) > > What about something like: (array #:cols 6 1 0 0 0 0 0 0 1 0 0

Re: [racket] Math library ready for testing

2012-12-07 Thread Robby Findler
Friends don't let friends program drunk. On Fri, Dec 7, 2012 at 8:31 PM, Michael Wilber wrote: > This is such an exciting time to be a Racket programmer! Thanks for all > your work, Neil. > > During winter break once I'm finished with grad school apps, I'll > convert my final Signals and Systems

Re: [racket] Math library ready for testing

2012-12-07 Thread Michael Wilber
This is such an exciting time to be a Racket programmer! Thanks for all your work, Neil. During winter break once I'm finished with grad school apps, I'll convert my final Signals and Systems Matlab project to racket/math to get a feel for the library. One note off-hand: I really don't like the (

Re: [racket] Math library ready for testing

2012-12-07 Thread Neil Toronto
On 12/07/2012 03:14 PM, Hendrik Boom wrote: On Fri, Dec 07, 2012 at 01:33:22PM -0700, Neil Toronto wrote: Also, I've been considering allowing negative axis numbers and row indexes. Need feedback on how helpful it would be vs. confusing and error-hiding. The last big matrix library I

Re: [racket] Math library ready for testing

2012-12-07 Thread Hendrik Boom
On Fri, Dec 07, 2012 at 01:33:22PM -0700, Neil Toronto wrote: > > Also, I've been considering allowing negative axis numbers and row > indexes. Need feedback on how helpful it would be vs. confusing and > error-hiding. The last big matrix library I've been in any way associated with was To

Re: [racket] Math library ready for testing

2012-12-07 Thread Neil Toronto
On 12/07/2012 02:35 PM, Asumu Takikawa wrote: On 2012-12-07 14:31:36 -0700, Neil Toronto wrote: I should make that list and some others on my to-do list public, like the "planned special functions" list. Where's a good place for that? The github wiki would be good. We already have some stuff t

Re: [racket] Math library ready for testing

2012-12-07 Thread Ray Racine
Good as time as any to see out how the boat will float, maybe start the a discussion topic with the list on the Google+ Racket Language community. On Fri, Dec 7, 2012 at 4:31 PM, Neil Toronto wrote: > I've bumped Dirichlet to the top of the "unordered distributions" list. >

Re: [racket] Math library ready for testing

2012-12-07 Thread Asumu Takikawa
On 2012-12-07 14:31:36 -0700, Neil Toronto wrote: > I should make that list and some others on my to-do list public, > like the "planned special functions" list. Where's a good place for > that? The github wiki would be good. We already have some stuff there: https://github.com/plt/racket/wiki

Re: [racket] Math library ready for testing

2012-12-07 Thread Neil Toronto
I've bumped Dirichlet to the top of the "unordered distributions" list. I should make that list and some others on my to-do list public, like the "planned special functions" list. Where's a good place for that? Neil ⊥ On 12/07/2012 01:58 PM, Ray Racine wrote: Amazing. Tons of hard work. Th

Re: [racket] Math library ready for testing

2012-12-07 Thread Laurent
Woah, this is very impressive! And now I can convince more people to use Racket! On Fri, Dec 7, 2012 at 9:33 PM, Neil Toronto wrote: > I've just pushed the last commits that make the new math library ready for > wider testing. Almost everything ready for use is documented, the tests > keep pass