<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jun 3, 2010, at 6:40 PM, <a href="mailto:mokus@deepbondi.net">mokus@deepbondi.net</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">If anyone knows a way this could be done while still allowing general<br>functions to be mapped over RVars, I'd love to hear about it. My<br>suspicion though is that it is not possible. It would be a very similar<br>problem to computing the inverse of a function since the PDF is a measure<br>of the size of the preimage of an event in the probability space (if I'm<br>putting all those words together correctly ;)).<br></span></blockquote></div><div><br></div><div>We don't necessarily have to compute the inverse of the distribution via sampling to do it. It can be done algebraically, in terms of the convolution operator. Since the types are enumerated, wouldn't something like... work?</div><div><br></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">-- A set and binary operation. We have an algebra. I like the J for 'join'.</span></font></div><div><font class="Apple-style-span" face="Courier">-- With this algebra, we can use the real-complex analytical methods to</font></div><div><font class="Apple-style-span" face="Courier">-- interpret the terms later, if we want to actually reify a Distribution</font></div><div><span class="Apple-style-span" style="font-family: Courier; ">-- instance as a "Real" (Float, Double) function.</span></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">> data DistributionJ a = UniformDistribution Uniform a</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">></span></font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">                 | ...</span></font></span></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">><span class="Apple-tab-span" style="white-space:pre">        </span> | ExponentialDistribution Exponential a</span></font></span></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-style-span" style="white-space: pre;">><span class="Apple-tab-span" style="white-space:pre">                </span> | DistributionJ a `Convolve` (DistributionJ a)</span></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-style-span" style="white-space: pre;"><br></span></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-style-span" style="white-space: pre;"><br></span></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-style-span" style="white-space: pre;">-- I hope I understand the semantics for the PromptT monad.</span></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-style-span" style="white-space: pre;">> newtype RVarT m a = RVarT { unRVarT :: PromptT (Prim, DistributionJ) m a }</span></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-style-span" style="white-space: pre;"><br></span></font></div><div><span class="Apple-style-span" style="white-space: pre;"><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;">I guess threading fst and snd in all the low level computations is inelegant, but it's a step closer.</span></font></span></div></body></html>