Re: [racket] Function composition in Racket

2012-10-16 Thread Gregory Woodhouse
Indeed it does! These plots are very nice. On Oct 16, 2012, at 1:35 PM, Neil Toronto wrote: > On 10/16/2012 12:02 PM, Michael Wilber wrote: >> Does surface3d and isosurface3d from racket/plot do what you want? >> >> file:///usr/share/racket/doc/plot/renderer3d.html?q=isosurface#(def._((lib._plo

Re: [racket] Function composition in Racket

2012-10-16 Thread Neil Toronto
On 10/16/2012 12:02 PM, Michael Wilber wrote: Does surface3d and isosurface3d from racket/plot do what you want? file:///usr/share/racket/doc/plot/renderer3d.html?q=isosurface#(def._((lib._plot/main..rkt)._isosurface3d)) In particular: #lang racket (require plot) (define (f x y) (+ 2 (* 2

Re: [racket] Function composition in Racket

2012-10-16 Thread Michael Wilber
Does surface3d and isosurface3d from racket/plot do what you want? file:///usr/share/racket/doc/plot/renderer3d.html?q=isosurface#(def._((lib._plot/main..rkt)._isosurface3d)) Gregory Woodhouse writes: > I'm intrigued. I suppose pattern based macros could be used to implement > operations like +

Re: [racket] Function composition in Racket

2012-10-16 Thread Gregory Woodhouse
I'm intrigued. I suppose pattern based macros could be used to implement operations like + and *, and passing to the field of quotients should formally be no different from rational arithmetic. Are you interested in Chebyshev polynomials for a particular reason (e.g, applications to differential

Re: [racket] Function composition in Racket

2012-10-16 Thread Neil Toronto
I hadn't thought of making two passes. Thanks! I'd have to have the terms indexed by two different orderings (nondecreasing in x's degree and nondecreasing in y's), or be willing to sort. That seems tricky or slowish, but much better than what I've had in mind. It should also work with other o

Re: [racket] Function composition in Racket

2012-10-15 Thread Gregory Woodhouse
I suppose I'm just stating the obvious here, but R[x, y] is naturally isomorphic to R[x][y]. That is, polynomials in x and y over the ring R have a natural interpretation as polynomials in y over the ring R[x] of polynomials over R. So, if you had a good library for working with polynomials (of

Re: [racket] Function composition in Racket

2012-10-15 Thread Neil Toronto
On 10/15/2012 11:49 AM, Jens Axel Søgaard wrote: 2012/10/15 Stephen Bloch : But probably slower, at least for exact numbers. If "expt" were implemented naively as "for i = 1 to num", the total number of multiplications would be quadratic in degree; if it were implemented by repeated squaring

Re: [racket] Function composition in Racket

2012-10-15 Thread Jens Axel Søgaard
2012/10/15 Stephen Bloch : > But probably slower, at least for exact numbers. If "expt" were implemented > naively as "for i = 1 to num", the total number of multiplications would be > quadratic in degree; if it were implemented by repeated squaring, the total > number of multiplications would

Re: [racket] Function composition in Racket

2012-10-15 Thread Stephen Bloch
On Oct 15, 2012, at 11:35 AM, Robby Findler wrote: > What degree of polynomial, I wonder, would it take to find a > noticeable difference between these? To distinguish between linear and quadratic, probably thousands to millions (depending on whether "noticeable" means "to a human being" or "to

Re: [racket] Function composition in Racket

2012-10-15 Thread Robby Findler
What degree of polynomial, I wonder, would it take to find a noticeable difference between these? On Mon, Oct 15, 2012 at 9:57 AM, Stephen Bloch wrote: > > On Oct 15, 2012, at 10:44 AM, Justin R. Slepak wrote: > >> Ah, I forgot about for/sum. This version is probably clearer: >> >> (struct polyno

Re: [racket] Function composition in Racket

2012-10-15 Thread Stephen Bloch
On Oct 15, 2012, at 10:44 AM, Justin R. Slepak wrote: > Ah, I forgot about for/sum. This version is probably clearer: > > (struct polynomial (coeffs) > #:transparent > #:property prop:procedure > (lambda (poly num) > (for/sum ([x (length (polynomial-coeffs poly))] > [c (polynomial-

Re: [racket] Function composition in Racket

2012-10-15 Thread Justin R. Slepak
Slepak PhD student, Computer Science dept. - Original Message - From: Matthias Felleisen To: Justin R. Slepak Cc: users@racket-lang.org Sent: Mon, 15 Oct 2012 10:02:17 -0400 (EDT) Subject: Re: [racket] Function composition in Racket Do you want to try for/sum here? On Oct 14, 2012, at

Re: [racket] Function composition in Racket

2012-10-15 Thread Matthias Felleisen
r Science dept. > > - Original Message - > From: Gregory Woodhouse > To: Justin R. Slepak > Sent: Sun, 14 Oct 2012 22:07:59 -0400 (EDT) > Subject: Re: [racket] Function composition in Racket > > Thanks! This does what I want. To tell you the truth, I've shied aw

Re: [racket] Function composition in Racket

2012-10-14 Thread Justin R. Slepak
t: Re: [racket] Function composition in Racket Thanks! This does what I want. To tell you the truth, I've shied away from prop:procedure (probably more due to my own confusion than anything else!). The define-values here seems a bit mysterious, but I assume the point is to support the

Re: [racket] Function composition in Racket

2012-10-14 Thread Justin R. Slepak
that? --- Justin Slepak PhD student, Computer Science dept. - Original Message - From: Gregory Woodhouse To: Racket Mailing List Sent: Sun, 14 Oct 2012 19:00:19 -0400 (EDT) Subject: [racket] Function composition in Racket I wrote a small recursive function to convert a list (a0 a1 .

Re: [racket] Function composition in Racket

2012-10-14 Thread Gregory Woodhouse
Uh... never mind. I should have looked for the obvious > (define (f x) (+ x 1)) > (define (g x) (* x x)) > ((compose f g) 1) 2 > ((compose f g) 2) 5 > On Oct 14, 2012, at 4:00 PM, Gregory Woodhouse wrote: > Now, my question is: is there a notation in Racket for representing > composition tha

[racket] Function composition in Racket

2012-10-14 Thread Gregory Woodhouse
I wrote a small recursive function to convert a list (a0 a1 ... an) coefficients into a polynomial function ;;Given a list (a0 a1 ... an) return a function that computes ;;p(x) = a0 + a1*x + ... + an*x^n (define (polynomial coeffs) (lambda (x) (cond [(= (length coeffs) 0) 0] [