SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
vandervolt
Posts: 51
Joined: April 30th, 2007, 10:21 am

MATLAB v Mathematica (as a purchase)

May 31st, 2010, 10:32 pm

edit: 2D Black-Scholes with r=0 of course....
 
User avatar
Cuchulainn
Posts: 62626
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

MATLAB v Mathematica (as a purchase)

June 1st, 2010, 7:19 am

QuoteOriginally posted by: vandervoltAlan,I think you are correct about the Matlab 2D PDE toolbox (ie not supporting advection/diffusion equation in 2D). So I don' think anyone will give you an answer to your Heston model test case.Its strength is in solving elliptic problems in nasty geometries. The GUI for setting up domains and meshes in nice and very easy to use, but unless your trying to solve 2D Black Scholes in a wrench it is perhaps not of much use in finance. The 1D solver pdepe is however, very easy to use and very accurate. It can be pretty slow though if you choose a fine spatial grid. Unless, maybe you can semidiscretise in S to get a ODE that you can solve with ODEI don't know how Matlab handles functions, but why not?
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
Hansi
Posts: 3300
Joined: January 25th, 2010, 11:47 am

MATLAB v Mathematica (as a purchase)

June 1st, 2010, 8:20 am

QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: vandervoltI don't know how Matlab handles functions, but why not?No reason why not, should work fine.
 
User avatar
Cuchulainn
Posts: 62626
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

MATLAB v Mathematica (as a purchase)

June 1st, 2010, 8:39 am

QuoteOriginally posted by: HansiQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: vandervoltI don't know how Matlab handles functions, but why not?No reason why not, should work fine.I saw once Matlab binding; so a function diffusion f(S, t) will be converted to a vector function (f1(t), ... fN(t)) where fj(t) = f(jh, t) and h is mesh size in S space. Then assemble all the stuff to y' = F(y,t). At least that's in Bind or Phoenix. Boost.Matlab anyone?Any Matlabbers' comment?
Last edited by Cuchulainn on May 31st, 2010, 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
Hansi
Posts: 3300
Joined: January 25th, 2010, 11:47 am

MATLAB v Mathematica (as a purchase)

June 1st, 2010, 9:44 am

Never looked closely into Matlab Toolbox option for creating such a mesh for you automatically as I've always done it explicitly but I'm sure there is something for that.Also just ran across this on google, haven't read through it but it might give insight into what is possible with Matlab in this space:http://www.iaeng.org/publication/WCE200 ... 022.pdfThe semidiscretisation is handled in the following manner for BS and Heston:
 
User avatar
quantmeh
Posts: 5974
Joined: April 6th, 2007, 1:39 pm

MATLAB v Mathematica (as a purchase)

June 1st, 2010, 2:11 pm

performance wise Mathematica and Matlab are on the same plane. you dont implement production software in them. figure out your algorithms in either of them, then implement the prod software in real programming language.
 
User avatar
Cuchulainn
Posts: 62626
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

MATLAB v Mathematica (as a purchase)

June 1st, 2010, 3:34 pm

QuoteOriginally posted by: jawabeanperformance wise Mathematica and Matlab are on the same plane. you dont implement production software in them. figure out your algorithms in either of them, then implement the prod software in real programming language.Oi vey!MM and Matlab are real languages. There is more than Java ... And for the record, if you want speed you need a fast language
Last edited by Cuchulainn on May 31st, 2010, 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
quantmeh
Posts: 5974
Joined: April 6th, 2007, 1:39 pm

MATLAB v Mathematica (as a purchase)

June 1st, 2010, 4:32 pm

QuoteOriginally posted by: CuchulainnOi vey!MM and Matlab are real languages. There is more than Java ... And for the record, if you want speed you need a fast language "fast" is only one dimension, otherwise we'd all be in ASM. Matlab is not the real language. it's a good scripting language for array processing. i'd say it's a nice tool for rapid prototyping or research, i wrote my thesis almost entirely on Matlab, love it. i dont write prod code in it though. it's too much hassle to support it.
 
User avatar
Cuchulainn
Posts: 62626
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

MATLAB v Mathematica (as a purchase)

June 2nd, 2010, 7:55 am

QuoteThe semidiscretisation is handled in the following manner for BS and Heston:function [x,y0,A,u]=get_ode_blackscholes(kind,N,L,r,sigma)%Semidiscretization of Black-Scholes call option PDE% Usage: [x,y0,A,u]=get_ode_blackscholes(kind,N,L,r,sigma)% kind='fd' (finite difference) or 'sc' (spectral collocation)[...]Yes, that's the idea I had. Then you can just translate your SD scheme a mano to ODE Matlab form and off you go. A nice exercise would be to do it from exsiting C++/C# code.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
Alan
Posts: 10270
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

MATLAB v Mathematica (as a purchase)

June 5th, 2010, 5:15 pm

QuoteOriginally posted by: vandervoltAlan,I think you are correct about the Matlab 2D PDE toolbox (ie not supporting advection/diffusion equation in 2D). So I don' think anyone will give you an answer to your Heston model test case.Yes, agree - I am not holding my breath. p.s. Regarding elliptic problems, we had an interesting thread in the Numerical forum about that.As we also agree, the ones that occur in finance have very simple boundaries, usually rectangular.At first, because Mathematica's NDSolve does not support elliptical problems, I went searching elsewhereto solve a particular problem I was interested in. Found FreeFem++; however this proved disappointing on this problem (see the thread) and I finally ended up simply goingback to Mathematica and setting it up as the stationary limit of a parabolic problem, which NDSolve can handle. Since, as you point out, Matlab apparently does have an FEM toolbox, again disappointing to not seeany Matlab users chime in to that thread with a quick toolbox result. So, here is a second challenge to the Matlab folks. Use the Matlab FEM toolbox to solvethe elliptic problem discussed in the linked thread. It is theultimate hitting probability of the stock price to S=0 in the (beta=0) SABR model.The pde operator, boundary conditions, and exact solution are given in the thread.Post a brief summary of your methods in the Numerical Methods forum.
Last edited by Alan on June 4th, 2010, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 62626
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

MATLAB v Mathematica (as a purchase)

June 6th, 2010, 11:38 am

Another solution is to program an iterative solver for the elliptic PDE directly in Matlab. The FEM route seems to be a bit heavy.Most of the posts on Matlab here tend to centred on debugging lattice model. With the exception of a couple of posters, MM threads are thinly distributed.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
Alan
Posts: 10270
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

MATLAB v Mathematica (as a purchase)

June 6th, 2010, 3:21 pm

Yes, I am not doubting that you can program solvers directly in Matlab. What I am trying toflesh out is whether or not the Matlab pde toolbox can solve some basic finance pde problems (Heston model, SABR, etc.)
 
User avatar
Cuchulainn
Posts: 62626
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

MATLAB v Mathematica (as a purchase)

June 6th, 2010, 3:23 pm

QuoteOriginally posted by: AlanYes, I am not doubting that you can program solvers directly in Matlab. What I am trying toflesh out is whether or not the Matlab pde toolbox can solve some basic finance pde problems (Heston model, SABR, etc.)I had a look, but I suspect not. The 'specials' are not supported? Juergen Topper uses pde2d for 2d/3d baskets. It has a trial version and output to Matlab.Anyways, a bit closer ....
Last edited by Cuchulainn on June 5th, 2010, 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
GiusCo
Posts: 124
Joined: March 26th, 2010, 10:00 pm

MATLAB v Mathematica (as a purchase)

September 25th, 2010, 3:12 am

QuoteOriginally posted by: CuchulainnWhat about VBA? And this 750 page book by Nick Webber does it step-by-step and is very clear.The price differential in packages can be steep. And VBA works with Excel.Thanks a lot, that book is really going to sort my IT issues in the field neatly. Just preordered.
 
User avatar
Cuchulainn
Posts: 62626
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

MATLAB v Mathematica (as a purchase)

September 25th, 2010, 8:39 am

QuoteOriginally posted by: GiusCoQuoteOriginally posted by: CuchulainnWhat about VBA? And this 750 page book by Nick Webber does it step-by-step and is very clear.The price differential in packages can be steep. And VBA works with Excel.Thanks a lot, that book is really going to sort my IT issues in the field neatly. Just preordered.You're welcome.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
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