SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
chocolatemoney
Topic Author
Posts: 322
Joined: October 8th, 2008, 6:50 am

F# / F Sharp

May 22nd, 2013, 2:52 pm

I could not find any existing thread on this topic.Any experience in F#?What do you think of F#? Is it gaining some popularity in the quant fin community?Thanks.Cheers.
 
User avatar
spursfan
Posts: 893
Joined: October 7th, 2001, 3:43 pm

F# / F Sharp

May 22nd, 2013, 5:28 pm

This is state-of-the-art use of F# with GPUshttps://www.quantalea.net/‎
 
User avatar
Cuchulainn
Posts: 62591
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

F# / F Sharp

May 22nd, 2013, 5:38 pm

Can Programming Be Liberated from the von Neumann Style? A Functional Style and Its Algebra of Programs 1977John BackusIBM Research Laboratory, San Jose (John Backus is one of the inventors of FORTRAN.)You see FP becoming popular in C# and C++. Objects are not for maths And for parallel... too many side effects ...Maybe Haskell learn first // I guess very very very few quants/developers know FP; it's typically what university CS students are subjected to as a language. // 20 years ago few knew OOP.
Last edited by Cuchulainn on May 21st, 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
 
User avatar
BramJ
Posts: 372
Joined: January 10th, 2006, 2:01 pm

F# / F Sharp

May 23rd, 2013, 2:21 am

I believe the creator of F# now works at CS. If you google for it, you'll find some info on it (it was in another thread too). Also, if you look for implementing functional extensions in spreadsheets, you'll eventually come across some presentations from a guy who (is/was) at Barclays I believe and where they have implemented some code generators for exotics pricers in a functional language (Haskell I believe).I sort of made the switch (coming from C#) and like it a lot (but I'm not a quant dev at all).
 
User avatar
chocolatemoney
Topic Author
Posts: 322
Joined: October 8th, 2008, 6:50 am

F# / F Sharp

May 23rd, 2013, 7:10 am

I have been working in scala for a few years. I am very happy with the functional approach. Actors+FP has helped me being productive when developing on server side. I do find Scala more aesthetically pleasing than F#. However, I think that being within .net would facilitate my work when developing desktop/quant on win machines.Furthermore, I am not very fond of working in java and I realized I've spent a fair amount of time building Scala "wrappers" for existing Java classes.The F# Math Provider looks very interesting.Hence, I am considering moving from scala to F# for an ongoing project.Thanks for the feedback.
 
User avatar
Cuchulainn
Posts: 62591
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

F# / F Sharp

May 23rd, 2013, 7:51 am

If one did the SABR PDE in F#, how would that look like and is a good approach, CM? "The F# Math Provider looks very interesting."Is there a link to this? I suppose creating a universal lattice pricing model/calibration in F# would be so easy compared to VBA or OOP? The power of functions.
Last edited by Cuchulainn on May 22nd, 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
 
User avatar
fulmerspot
Posts: 515
Joined: July 8th, 2009, 12:44 pm

F# / F Sharp

May 23rd, 2013, 10:03 am

I've started converting my particle swarm optimiser into F# as a way of learning it - just when I think I've got my head round it I realise I haven't. A big shift from C based languages.
 
User avatar
chocolatemoney
Topic Author
Posts: 322
Joined: October 8th, 2008, 6:50 am

F# / F Sharp

May 23rd, 2013, 11:08 pm

@Chuch:I have no experience in F# yet. I am talking from the scala perspective.IMHO, a lattice pricing model/calibration may not be the best textbook use case of FP - I could not envision a great deal of difference between my scala implementation and my C++ implementation. C++ templates and function pointers bring the two implementations close. Lambda expressions would do the rest. Maybe an advocate of a purely functional approach may have a different opinion on this...An implementation in VBA would be a nightmare as it provides limited tools for generalization and code reuse.FP is extremely convenient in other cases, for example in the design of a Domain Specific Language (f.ex a custom econometric library for the manipulation of time series). I'd say that a FP approach would lead to a significantly more concise implementation than a C++ one, even if C++ operators could come in very handy in this case.I'd say that a mix of FP and OOD are often the best solution in my opinion (hit nails with the hammer, paint walls with a brush). Some concepts are naturally expressed as objects. At the same time, the removal of side-effects makes debugging easier; and stateless means running in parallel without too many headaches. If we are implementing a toolbox of mathematical functions, than it is great to have the possibility to treat them as first-class citizens in a native way, no workarounds.Lambdas have been introduced to the C* family for a good reason. I see the convergence of the C family towards a mixed paradigm to continue.F# math: http://msdn.microsoft.com/en-us/library ... .100).aspx This is prob a good place to start...@Fulmerspot: it took me 1 year to improve my scala to a just OK level. It has been extremely frustrating at times.
Last edited by chocolatemoney on May 23rd, 2013, 10:00 pm, edited 1 time in total.
 
User avatar
Polter
Posts: 2526
Joined: April 29th, 2008, 4:55 pm

F# / F Sharp

May 25th, 2013, 3:02 pm

 
User avatar
katastrofa
Posts: 9436
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

F# / F Sharp

May 25th, 2013, 9:10 pm

Maths is very easy to express in pure functional languages.Numerics, not so much.Lack of mutability is not very convenient.F# approach of mixing mutable and non-mutable variables is better than Haskell's dogmatism.
 
User avatar
VivienB
Posts: 130
Joined: August 6th, 2012, 3:32 pm

F# / F Sharp

May 27th, 2013, 12:32 pm

QuoteOriginally posted by: CuchulainnI suppose creating a universal lattice pricing model/calibration in F# would be so easy compared to VBA or OOP? The power of functions.Hi Cuchulainn,I don't know in F#, but in OCaml (that is close to F#), it is. However, some part of the "generic pde framework" should be implemented with imperative programming, mainly for speed reasons (and as mentionned by Katastrofa, lack of mutability is not always convenient).
 
User avatar
chocolatemoney
Topic Author
Posts: 322
Joined: October 8th, 2008, 6:50 am

F# / F Sharp

May 27th, 2013, 1:18 pm

However, maybe, could mutability be hidden within a monad?Some ideas?
Last edited by chocolatemoney on May 26th, 2013, 10:00 pm, edited 1 time in total.
 
User avatar
VivienB
Posts: 130
Joined: August 6th, 2012, 3:32 pm

F# / F Sharp

May 27th, 2013, 1:41 pm

Monads look like a patch to allow mutability in pure FP. There is (IMO) two disadvantages with monads : it produces complicated code, and it is "contagious" : You must be in a monad to call a function that returns a monad.I prefere the OCaml (and then, F#) approach, that is multi paradigm and then allows to use mutable variables.
 
User avatar
chocolatemoney
Topic Author
Posts: 322
Joined: October 8th, 2008, 6:50 am

F# / F Sharp

May 27th, 2013, 2:18 pm

"Monads look like a patch to allow mutability in pure FP."Monads are much more than that... If a PDE solves for the evolution of a system in time, then at some point, the PDE solver will inevitably need to deal with state (as opposed to a functional stateless implementation) Hence, one more reason to use monads and monadic functions (well, unless you just want to give up and go imperative)[EDIT] Ugly english & typos.
Last edited by chocolatemoney on May 26th, 2013, 10:00 pm, edited 1 time in total.
 
User avatar
VivienB
Posts: 130
Joined: August 6th, 2012, 3:32 pm

F# / F Sharp

May 27th, 2013, 2:43 pm

QuoteOriginally posted by: chocolatemoney"Monads look like a patch to allow mutability in pure FP."Monads are much more than that.You might be right, I'm not that much familiar with monads.QuoteOriginally posted by: chocolatemoney.. If a PDE solves for the evolution of a system in time, then at some point, the PDE solver will inevitably need to deal with state (as opposed to a functional stateless implementation) Hence, one more reason to use monads and monadic functions (well, unless you just want to give up and go imperative)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).Btw, yes, in some case, I prefer to give up and go imperative. IMHO, whatever the paradigm, it is not a good idea to follow only this paradigm.
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On