Well, the current FRP systems don&#39;t accurately solve this, since they just use an Euler integrator, as do many games. As long as the time steps are tiny enough this usually works good enough. But I wouldn&#39;t use these FRPs to guide an expensive robot or spaceship at high precision :-)<div>
<br><div><br><br><div class="gmail_quote">On Tue, Apr 21, 2009 at 11:48 AM, jean-christophe mincke <span dir="ltr">&lt;<a href="mailto:jeanchristophe.mincke@gmail.com">jeanchristophe.mincke@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Paul,<br><br>Thank you for your reply.<br><br>Integration is a tool to solve a some ODEs but ot all of them. Suppose
all we have is a paper and a pencil and we need to symbolically solve:<br><br><br>                                                                         / t<br>de(t)/dt = f(t)  -&gt; the solution is given by e(t) = |      f(t) dt + e(t0)<br>

                                                                        / t0<br><br>de(t)/dt
= f(e(t), t) -&gt; A simple integral cannot solve it, we need to use
the dedicated technique appropriate to this type of ODE. <br><br><br>Thus, if the intention of the expression <br><br>   e = integrate <i>something </i><br><br>is &quot;I absolutely want to integrate <i>something</i> using some integration scheme&quot;, I am not convinced that this solution properly covers the second case above.<br>

<br>However if its the meaning is &quot;I want to solve the ODE : de(t)/dt =<i>something</i> &quot; I would be pleased if the system should be clever enough to analyse the <i>something expression</i> and to apply or propose the most appropriate numerical method.<br>

<br>Since
the two kinds of ODEs require 2 specific methematical solutions, I do
not find suprising that this fact is also reflected in a program.<br>
<br>I have not the same experience as some poster/authors but I
am curious about the way the current FRPs are able to accurately solve
the most simple ODE:<br>
<br>
    de(t)/dt = e<br>
<br>
All I have seen/read seems to use the Euler method. I am really interested in knowing whether anybody has implemented a higher order method?<br>
<br>
Regards<br><font color="#888888">
<br>
J-C</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">On Tue, Apr 21, 2009 at 5:03 AM, Paul L <span dir="ltr">&lt;<a href="mailto:ninegua@gmail.com" target="_blank">ninegua@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Trying to give different semantics to the same declarative definition based<br>
on whether it&#39;s recursively defined or not seems rather hack-ish, although<br>
I can understand what you are coming from from an implementation angle.<br>
<br>
Mathematically an integral operator has only one semantics regardless<br>
of what&#39;s put in front of it or inside. If our implementation can&#39;t match this<br>
simplicity, then we got a problem!<br>
<br>
The arrow FRP gets rid of the leak problem and maintains a single definition<br>
of integral by using a restricted form of recursion - the loop operator.<br>
If you&#39;d rather prefer having signals as first class objects, similar technique<br>
existed in synchronous languages [1], i.e., by using a special rec primitive.<br>
<br>
Disclaimer: I was the co-author of the leak paper [2].<br>
<br>
[1] A co-iterative characterization of synchronous stream functions, P<br>
Caspi, M Pouzet.<br>
[2] Plugging a space leak with an arrow, H. Liu, P. Hudak<br>
<br>
--<br>
Regards,<br>
Paul Liu<br>
<br>
Yale Haskell Group<br>
<a href="http://www.haskell.org/yale" target="_blank">http://www.haskell.org/yale</a><br>
<div><div></div><div><br>
On 4/20/09, jean-christophe mincke &lt;<a href="mailto:jeanchristophe.mincke@gmail.com" target="_blank">jeanchristophe.mincke@gmail.com</a>&gt; wrote:<br>
&gt; In a post in the *Elerea, another FRP library *thread*,* Peter Verswyvelen<br>
&gt; wrote:<br>
&gt;<br>
&gt; *&gt;I think it would be nice if we could make a &quot;reactive benchmark&quot; or<br>
&gt; something: some tiny examples that capture the essence of reactive systems,<br>
&gt; and a way to compare each solution&#39;s &gt;pros and cons.* *<br>
&gt; *<br>
&gt; *&gt;For example the &quot;plugging a space leak with an arrow&quot; papers reduces the<br>
&gt; recursive signal problem to<br>
&gt; *<br>
&gt; *<br>
&gt; *<br>
&gt; *&gt;e = integral 1 e*<br>
&gt; *<br>
&gt; *<br>
&gt;  *&gt;Maybe the Nlift problem is a good example for dynamic collections, but I<br>
&gt; guess we&#39;ll need more examples.*<br>
&gt; *<br>
&gt; *<br>
&gt; *&gt;The reason why I&#39;m talking about examples and not semantics is because the<br>
&gt; latter seems to be pretty hard to get right for FRP?*<br>
&gt;<br>
&gt; I would like to come back to this exemple. I am trying to write a small FRP<br>
&gt; in F# (which is a strict language, a clone of Ocaml) and I also came across<br>
&gt; space and/or time leak. But maybe not for the same reasons...<br>
&gt;<br>
&gt; Thinking about these problems and after some trials and errors, I came to<br>
&gt; the following conclusions:<br>
&gt;<br>
&gt; I believe that writing the expression<br>
&gt;<br>
&gt;       e = integral 1 *something*<br>
&gt;<br>
&gt;       where e is a Behavior (thus depends on a continuous time).<br>
&gt;<br>
&gt; has really two different meanings.<br>
&gt;<br>
&gt; 1. if *something *is independent of e, what the above expression means is<br>
&gt; the classical integration of a time dependent function between t0 and t1.<br>
&gt; Several numerical methods are available to compute this integral and, as far<br>
&gt; as I know, they need to compute *something *at t0, t1 and, possibly, at<br>
&gt; intermediate times. In this case, *something *can be a Behavior.<br>
&gt;<br>
&gt; 2. If *something *depends directly or indirectly of e then we are faced with<br>
&gt; a first order differential equation of the form:<br>
&gt;<br>
&gt;        de/dt = *something*(e,t)<br>
&gt;<br>
&gt;     where de/dt is the time derivative of e and  *something*(e,t) indicates<br>
&gt; that *something* depends, without loss of generality, on both e and t.<br>
&gt;<br>
&gt; There exist specific methods to numerically solve differential equations<br>
&gt; between t0 and t1. Some of them only require the knowledge of e at t0 (the<br>
&gt; Euler method), some others needs  to compute *something *from intermediate<br>
&gt; times (in [t0, t1[ ) *and *estimates of e at those intermediary times.<br>
&gt;<br>
&gt; 3. *something *depends (only) on one or more events that, in turns, are<br>
&gt; computed from e. This case seems to be the same as the first one where the<br>
&gt; integrand can be decomposed into a before-event integrand and an after-event<br>
&gt; integrand (if any event has been triggered). Both integrands being<br>
&gt; independent from e. But I have not completely investigated this case  yet...<br>
&gt;<br>
&gt; Coming back to my FRP, which is based on residual behaviors, I use a<br>
&gt; specific solution for each case.<br>
&gt;<br>
&gt; Solution to case 1 causes no problem and is similar to what is done in<br>
&gt; classical FRP (Euler method, without recursively defined behaviors). Once<br>
&gt; again as far as I know...<br>
&gt;<br>
&gt; The second case has two solutions:<br>
&gt; 1. the &#39;integrate&#39; function is replaced by a function &#39;solve&#39; which has the<br>
&gt; following signature<br>
&gt;<br>
&gt;        solve :: a -&gt; (Behavior a -&gt; Behavior a) -&gt; Behavior a<br>
&gt;<br>
&gt;       In fact,  *something*(e,t) is represented by an integrand function<br>
&gt; from behavior to behavior, this function is called by the<br>
&gt; integration           method. The integration method is then free to pass<br>
&gt; estimates of e, as constant behaviors, to the integrand function.<br>
&gt;<br>
&gt;       The drawbacks of this solution are:<br>
&gt;       - To avoid space/time leaks, it cannot be done without side effects<br>
&gt; (to be honest, I have not been able to  find a solution without<br>
&gt; assignement). However these side effects are not visible from outside of the<br>
&gt; solve function. ..<br>
&gt;       - If behaviors are defined within the integrand function, they are not<br>
&gt; accessible from outside of this integrand function.<br>
&gt;<br>
&gt; 2. Introduce constructions that looks like to signal functions.<br>
&gt;<br>
&gt;       solve :: a -&gt; SF a a -&gt; Behavior a<br>
&gt;<br>
&gt;    where a SF is able to react to events and may manage an internal state.<br>
&gt;    This solution solves the two above problems but make the FRP a bit more<br>
&gt; complex.<br>
&gt;<br>
&gt;<br>
&gt; Today, I tend to prefer the first solution, but what is important, in my<br>
&gt; opinion, is to recognize the fact that<br>
&gt;<br>
&gt;     e = integral 1 *something*<br>
&gt;<br>
&gt; really addresses two different problems (integration and solving of<br>
&gt; differential equations) and each problem should have their own solution.<br>
&gt;<br>
&gt; The consequences are :<br>
&gt;<br>
</div></div>&gt;    1. There is no longer any need for my FRP to be able to define a Behavior<br>
<div>&gt;    recursively. That is a good news for this is quite tricky in F#.<br>
&gt;    Consequently, there is no need to introduce delays.<br>
</div>&gt;    2. Higher order methods for solving of diff. equations can be used (i.e.<br>
<div><div></div><div>&gt;    Runge-Kutta). That is also good news for this was one of my main goal in<br>
&gt;    doing the exercice of writing a FRP.<br>
&gt;<br>
&gt; Regards,<br>
&gt;<br>
&gt; J-C<br>
&gt;<br>
</div></div></blockquote></div><br>
</div></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div></div>