Re: Help with Math Question

2009-06-05 Thread CuppoJava
Thanks everybody for their help! I solved the problem (almost) but only for my specific f(x,y), which is enough for me for now. Paul Mooser's hint about accumulating state was the key I needed. By introducing another accumulator I got my color compositing to blend correctly from front to back. T

Re: Help with Math Question

2009-06-04 Thread Max Suica
I'm not sure how you're compositing your colors, but the function you're using is not associative or commutative (I checked at lunch, mmm), so I don't think you can reverse order. It's: a + b = (b1 + a1 (1 - b2), a2) Your function might need to be something like a + b = (b1*(1 - a2) + a1 (1 -

Re: Help with Math Question

2009-06-04 Thread Paul Mooser
For a general non-commutative operation, I'm not sure you can do this without keeping extra state around. You can clearly cheat by accumulating state as you run reduce, and then as the last reduce step perform the actual computation, but that isn't any better than the original problem you're tryin

Re: Help with Math Question

2009-06-04 Thread philip.hazel...@gmail.com
On Jun 4, 3:00 pm, CuppoJava wrote: > Hey guys. > Thanks for the help. I have to clarify my question a bit. > > f(x,y) and a0 are given and do not assume any properties. > Find g(x,y) and b0, such that for *any* list of numbers v, > > (reduce f a0 v) = (reduce g b0 (reverse v)) This is not alway

Re: Help with Math Question

2009-06-04 Thread CuppoJava
Hey guys. Thanks for the help. I have to clarify my question a bit. f(x,y) and a0 are given and do not assume any properties. Find g(x,y) and b0, such that for *any* list of numbers v, (reduce f a0 v) = (reduce g b0 (reverse v)) -- In case it helps at all, my specif

Re: Help with Math Question

2009-06-04 Thread Michael Wood
On Thu, Jun 4, 2009 at 12:27 PM, Mark Reid wrote: > > Hi again, > > I misinterpreted the question first time around but here's another > attempt. > > Given f, a0 and v, let b0 = (reduce f a0 v) = f( f( f( f(a0, v[1]), v > [2]), ...), v[n]) > > Now define the function g to ignore its second argume

Re: Help with Math Question

2009-06-04 Thread philip.hazel...@gmail.com
On Jun 4, 6:23 am, CuppoJava wrote: > Hey guys, > I'm really stuck on this math question, and I'm wondering if you guys > know of any links that may help me. > > Given: f(x,y), a0, a list of numbers v. > Find: g(x,y) and b0 such that: > >  (reduce f a0 v) = (reduce g b0 (reverse v)) > > Thanks fo

Re: Help with Math Question

2009-06-04 Thread Konrad Hinsen
On Jun 4, 2009, at 7:23, CuppoJava wrote: > I'm really stuck on this math question, and I'm wondering if you guys > know of any links that may help me. > > Given: f(x,y), a0, a list of numbers v. > Find: g(x,y) and b0 such that: > > (reduce f a0 v) = (reduce g b0 (reverse v)) If that's for any

Re: Help with Math Question

2009-06-04 Thread Mark Reid
Hi again, I misinterpreted the question first time around but here's another attempt. Given f, a0 and v, let b0 = (reduce f a0 v) = f( f( f( f(a0, v[1]), v [2]), ...), v[n]) Now define the function g to ignore its second argument and return its first. That is, g(x, y) = x. Then (reduce g b0 (r

Re: Help with Math Question

2009-06-04 Thread Daniel Lyons
On Jun 3, 2009, at 11:23 PM, CuppoJava wrote: > > Hey guys, > I'm really stuck on this math question, and I'm wondering if you guys > know of any links that may help me. > > Given: f(x,y), a0, a list of numbers v. > Find: g(x,y) and b0 such that: > > (reduce f a0 v) = (reduce g b0 (reverse v)) >

Re: Help with Math Question

2009-06-04 Thread Michael Wood
On Thu, Jun 4, 2009 at 8:37 AM, Mark Reid wrote: > > Hi, > > Maybe I'm missing something but doesn't + fit the bill (or any > symmetric function)? > > (== (reduce + 3 [1 2 3]) (reduce + 3 [3 2 1])) ;; => true > > In this case f = g = + and a0 = b0 for any choice of a0 and v. I think he can't cho

Re: Help with Math Question

2009-06-03 Thread Mark Reid
Hi, Maybe I'm missing something but doesn't + fit the bill (or any symmetric function)? (== (reduce + 3 [1 2 3]) (reduce + 3 [3 2 1])) ;; => true In this case f = g = + and a0 = b0 for any choice of a0 and v. Regards, Mark. On Jun 4, 3:23 pm, CuppoJava wrote: > Hey guys, > I'm really stuck