QuoteOriginally posted by: chocolatemoneyYes, we all agree on a mixed model, benefiting from the best of both worlds.Happy to read that my initial guess, back on Friday, has been confirmed.@Vivien:"I don't see where you need states. I think PDE can be implemented in a pure functional style without using monad (or imperative prog)."State, in my mind, is for example applying the scheme on the lattice from t=now to T=expiry, following the application of the ICs and eventually doing something else at expiry.I guess you refer to "lack of mutability" - I call it "state".I thought a monad could take care of the work pipeline.Ok I understand. The application of the ICs can also be done outside the pure FP part (eg we can have a function that take a vector and return a vector, the vector inputed has the IC applied).QuoteOriginally posted by: chocolatemoney*PURE* Functional programming (scala) is something very new to me - I have been working with Scala for something like 1-2 years.I'd be happy to see your pure functional implementation of a PDE solver, if you could share...PS: Is F# the language of choice at LexiFi?I don't have pure functional implementation of a PDE solver, it is mixed with imperative and OOP. In the past it were much more functionnal, but it was too slow, then we replaced some functional part with imperative, what drastically increased speed.About the language we use at LexiFi, it is mainly OCaml (when LexiFi was created, I don't think that F# existed, the choice were between OCaml and Haskell).

- Cuchulainn
**Posts:**62608**Joined:****Location:**Amsterdam-
**Contact:**

QuoteI don't have pure functional implementation of a PDE solver, it is mixed with imperative and OOP. In the past it were much more functionnal, but it was too slow, then we replaced some functional part with imperative, what drastically increased speed.Modelling-wise, PDEs are structural things, so a pure FP way to model them would be difficult IMO. However, PDE contains as well a bunch of FP functions, yes?

Step over the gap, not into it. Watch the space between platform and train.

http://www.datasimfinancial.com

http://www.datasim.nl

http://www.datasimfinancial.com

http://www.datasim.nl

- Cuchulainn
**Posts:**62608**Joined:****Location:**Amsterdam-
**Contact:**

QuoteOriginally posted by: chocolatemoneyPestering the thread again.Hey, I am not sure I am going in the right direction, but here is a state monad in scala.The idea is that the monad could pass along the lattice, instead of the fibonacci serie, and do all that has to be done.Bad idea?Looks kind of complicated. But maybe that's just me. Do you have any simpler examples? e.g. sum the elements of a vector, print the even-valued elements in a vector, propagate data changes in vector starting at 0.

Last edited by Cuchulainn on May 27th, 2013, 10:00 pm, edited 1 time in total.

Step over the gap, not into it. Watch the space between platform and train.

http://www.datasimfinancial.com

http://www.datasim.nl

http://www.datasimfinancial.com

http://www.datasim.nl

- Cuchulainn
**Posts:**62608**Joined:****Location:**Amsterdam-
**Contact:**

QuoteI don't have pure functional implementation of a PDE solver, it is mixed with imperative and OOP. In the past it were much more functionnal, but it was too slow, then we replaced some functional part with imperative, what drastically increased speed.Why? All that currying and bindin' and stuff like that? Is it stack-based? Is it all run-time?

Last edited by Cuchulainn on May 27th, 2013, 10:00 pm, edited 1 time in total.

Step over the gap, not into it. Watch the space between platform and train.

http://www.datasimfinancial.com

http://www.datasim.nl

http://www.datasimfinancial.com

http://www.datasim.nl

QuoteOriginally posted by: CuchulainnQuoteI don't have pure functional implementation of a PDE solver, it is mixed with imperative and OOP. In the past it were much more functionnal, but it was too slow, then we replaced some functional part with imperative, what drastically increased speed.Why? All that currying and bindin' and stuff like that? Is it stack-based? Is it all run-time?I don't remeber exactly, but we used a lot of functors, the change of variable were represented with function instead of beeing directly applied to vectors, etc.

- Cuchulainn
**Posts:**62608**Joined:****Location:**Amsterdam-
**Contact:**

QuoteOriginally posted by: VivienBQuoteOriginally posted by: CuchulainnQuoteI don't have pure functional implementation of a PDE solver, it is mixed with imperative and OOP. In the past it were much more functionnal, but it was too slow, then we replaced some functional part with imperative, what drastically increased speed.Why? All that currying and bindin' and stuff like that? Is it stack-based? Is it all run-time?I don't remeber exactly, but we used a lot of functors, the change of variable were represented with function instead of beeing directly applied to vectors, etc.I was considering various domain transformers y = S/(S + a), tanh(S) on 1/2 s^2 S^2 using a single binded functor in C++, but chose instead for a separate PDE for each transformer...

http://www.datasimfinancial.com

http://www.datasim.nl

QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: VivienBQuoteOriginally posted by: CuchulainnQuoteI don't have pure functional implementation of a PDE solver, it is mixed with imperative and OOP. In the past it were much more functionnal, but it was too slow, then we replaced some functional part with imperative, what drastically increased speed.Why? All that currying and bindin' and stuff like that? Is it stack-based? Is it all run-time?I don't remeber exactly, but we used a lot of functors, the change of variable were represented with function instead of beeing directly applied to vectors, etc.I was considering various domain transformers y = S/(S + a), tanh(S) on 1/2 s^2 S^2 using a single binded functor in C++, but chose instead for a separate PDE for each transformer...In our current framework the change of variable is an imput of the PDE, but we are limited to the change of variable of the form S(t) = f(t)g(x), then g has to be applied only once, and the transformation of the pde is fast enough.

- Cuchulainn
**Posts:**62608**Joined:****Location:**Amsterdam-
**Contact:**

How do you impart design intent in F# and OCaml? At code level or higher-level aids? e.g. explaining a state monad by a 'language' that everyone understands, initially. Think of when you are in a team of people.

Last edited by Cuchulainn on May 28th, 2013, 10:00 pm, edited 1 time in total.

http://www.datasimfinancial.com

http://www.datasim.nl

Most time when I explain OCaml I start with a simple example that use a lot of aspect of FP: I design a simple calculus algebra, that can be represented with algebraic data types, and I write a function that evaluate expressions using pattern matching, recursion, etc.Edit: Typo.

Last edited by VivienB on May 28th, 2013, 10:00 pm, edited 1 time in total.

- chocolatemoney
**Posts:**322**Joined:**

QuoteOriginally posted by: VivienBMost time when I explain OCaml I start with a simple example that use a lot of aspect of FP: I design a simple calculus algebra, that can be represented with algebraic data types, and I write a function that evaluate expressions using pattern matching, resistivity, etc.What is resistivity in this context?

QuoteOriginally posted by: chocolatemoneyQuoteOriginally posted by: VivienBMost time when I explain OCaml I start with a simple example that use a lot of aspect of FP: I design a simple calculus algebra, that can be represented with algebraic data types, and I write a function that evaluate expressions using pattern matching, resistivity, etc.What is resistivity in this context?Resistivity in this context is a typo (maybe due to my spell checker) The good word is recursion.

- chocolatemoney
**Posts:**322**Joined:**

QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: chocolatemoneyPestering the thread again.Hey, I am not sure I am going in the right direction, but here is a state monad in scala.The idea is that the monad could pass along the lattice, instead of the fibonacci serie, and do all that has to be done.Bad idea?Looks kind of complicated. But maybe that's just me. Do you have any simpler examples? e.g. sum the elements of a vector, print the even-valued elements in a vector, propagate data changes in vector starting at 0.I just noticed this comment that branched out.I really enjoyed this: http://learnyouahaskell.com/a-fistful-of-monads

GZIP: On