Saturday, June 09, 2012

Announcements

Yesterday I added an intended feature to the ODESolver. Now, the system announces each calculated state/time pair, so any interested observers can handle this information. Very simple observers include a state recorder, that just stores all incoming data in a sorted collection, and transcript recorder, that just writes information to the transcript (smalltalk's output stream). Practical extensions include curve fitting the data after the capture (take the set of points, and find a function that fits them).

One simple side-effect of being able to inspect the output is that I'm nearly certain I'm returning the wrong value in explicit steps, I noticed that I'm probably taking one step too many due to (initialTime to: endTime by: dt) do: [interesting parts here], which steps forward once to many times.

Is there a standard idiom to exclude the last item in a sequence? I would change to (initialTime to: endTime - dt by: dt), but I'm concerned about edge cases where delta-t isn't evenly divisible by dt, where does it stop?

No comments: