[racket] Numerical Optimization in Racket (i.e. Finding Local Minima and Maxima)

From: J. Ian Johnson (ianj at ccs.neu.edu)
Date: Mon Oct 28 11:46:16 EDT 2013

Doug, I believe Dan is looking for algorithms for finding minima and maxima in the sense of "Numerical Optimization" by Nocedal and Wright, and not compiler transforms to improve performance. There is a pdf on the first page of hits on google, so someone with time on their hands might want to go implement the book :P
----- Original Message -----
From: "Doug Williams" <m.douglas.williams at gmail.com>
To: "Konrad Hinsen" <konrad.hinsen at fastmail.net>
Cc: users at racket-lang.org
Sent: Monday, October 28, 2013 9:36:49 AM GMT -05:00 US/Canada Eastern
Subject: Re: [racket] Numerical Optimization in Racket (i.e. Finding Local Minima and Maxima)

The science collection predates Typed Racket - among many other things. It is hand optimized using the fl- and fx- primitives, which were added before Typed Racked, but this misses some optimizations that Typed Racket is able to do. The biggest problem with the hand optimized code is that bugs tend to lead to seg faults rather than decent error messages. It also does some optimization of sequences to make some loops work better, but this mainly just affects the statistics routines. 

I also added unchecked- versions to many/most of the computationally intensive routines to bypass the contract checks. This was important in the early days of the contracts, but I'm not so sure it is anymore. [The exception is the median and quantile routines that check for a sorted sequence and the contracts are O(n) while the code itself is O(1). 


On Mon, Oct 28, 2013 at 12:51 AM, Konrad Hinsen < konrad.hinsen at fastmail.net > wrote: 

Daniel King writes: 

> I think Racket has the first three features (the math library looks 
> awesome), but AFAICT it lacks a numerical optimizer. Has anyone 

The math library *is* awesome (I have been discovering it myself 
during the last weeks). The only other source of math/science code 
I know of is Doug Williams' science collection on PLaneT: 


I don't see any optimization routines in there, so you are probably 
right that there is none, at least nothing published. 


Racket Users list: 

  Racket Users list:

Posted on the users mailing list.