TanjaM / MFP

Repozitorij za projekt pri predmetu matematika s funkcijskim programiranjem
0 stars 0 forks source link

What exactly to do in this project? #1

Open andrejbauer opened 9 years ago

andrejbauer commented 9 years ago

This is a class project in a functional programming course

G. Bazerman & J. Polakow: Declarative Equations, Compositional Strategies: Solving Differential Systems with Lazy Splines

We are looking for ideas on how to improve and extend the lazysplines library. I summon Jeff Polakow!

andrejbauer commented 9 years ago

This seems like a much better link for lazysplines, https://hackage.haskell.org/package/lazysplines-0.1/docs/Numeric-LazySplines.html

andrejbauer commented 9 years ago

One possible improvement: implement Arrows and Applicative class instances, as discussed in "Future work". Also, for a more advanced improvement, consider two-dimensional splines and try to deal with PDEs (this could be hard).

gbaz commented 9 years ago

Jeff passed on this query to me. Here are some later slides I did on the idea: http://gbaz.github.io/slides/integration.html

Glad that it's still got some life in it!

Most future work I've been thinking about but not doing is theoretical rather than implementation-focused --giving clearer semantics, relating versions of this to classic solvers, proving correctness properties, etc.

One branch of work is to plug in an AST instead of doubles at the lowest level. Now you can crank out symbolic series and perform computer algebraic operations on them -- simplification, etc. Another idea -- plug in dual numbers as with automatic differentiation -- certain types of calculations should then become more possible, as the paper describes. Once you have ASTs you can maybe extend with more operations in the AST besides + and * -- i.e. what if you want to represent exp or ln directly. So you toss in some simplification and get a system for mixed numeric-symbolic exploration of certain interesting differentials.

Another simple project that I never got around to -- extend the system to handle complex numbers (as i recall, there's a nice commutative property like a spline of complexes is the same as a complex representation of a spline) -- and now you can test solvers for a-stability (http://en.wikipedia.org/wiki/Stiff_equation#A-stability)

Another interesting question -- more mathematical than FP -- the polynomial splines used here are well behaved but naive. Could some other sort of spline representation be more pleasant for some purposes? Or what about Laurent polynomials?

Finally, moving from double valued polynomials to vector valued polynomials in general seems potentially interesting? It doesn't give you the full power of PDEs, but it does allow for a fair number more equations to be represented without nearly as much work, I suspect.

mutjida commented 9 years ago

Duly summoned...

It's exciting to find that someone is actually interested in this stuff. I think Gershom touched on most of the things I've thought to mention, but I'll go ahead anyhow.

The paper, and to a certain extent the practical interest of the work, is not about lazy splines so much as about the ability to have compositional transformations which (more-or-less) correspond to known techniques in numerical solvers. With this in mind I think a more thorough exploration of the strategies would be nice; this might entail adding more strategies, studying how strategies interact, clearing up the relationship between known numerical methods and these (compositions of) strategies. Another nice practical bit of work would be to explore more equations, there are only 3 in the draft paper, to see how well the techniques work.

Two other avenues for exploration which I find quite intriguing are: 1) Can the machinery really be switched to representing smooth infinitesimal analysis by generalizing the duration type, and if so what interesting stuff would this allow? 2) What would be gained/lost by using this machinery as a basis for FRP?

andrejbauer commented 9 years ago

Thank you both for your comments! We've got enough here for a PhD dissertation, I think. Now we need something concrete and doable for a class project. Certainly working out more examples is one thing that can be done. Let me think a bit more to come up with something concrete that the students have a chance of understanding without a whole lot of background reading. Students, does any of the suggested stuff sound interesting? I can explain what it means.

gbaz commented 9 years ago

On the "simpler idea" track -- the shooting method (http://en.wikipedia.org/wiki/Shooting_method) is, once grasped, a really simple approach to tackling boundary value problems. The intuition, which the wikipedia article doesn't really capture, is imagine you have a cannon. For each initial value, think of it as a trajectory from which a canon shoots a cannonball. Now just wiggle the canon around until you land at the desired final boundary value.

So, the idea is this: create a higher order function that, given a nice description of a boundary value problem, turns that into something that represents a solver via the shooting method.

TanjaM commented 9 years ago

Hi, firstly thank you for all you comments and effort.

My colleague and I will take a closer look at the given implementation and try to find out what can we do in the given time. Currently we are most interested in implementation of Arrow and Applicative class instances and the shooting method.

andrejbauer commented 9 years ago

Yeah, I also like the shooting method. So if you do all three (arrows, applicative and shooting), I'd be pretty happy.