Serving the Quantitative Finance Community

 
User avatar
kelang
Topic Author
Posts: 5
Joined: November 14th, 2011, 4:53 pm

solving 2D forward PDE with initial Dirac condition

February 27th, 2013, 2:05 pm

Hi All,I am trying to solve the 2D forward PDE with an initial condition being a 2D Dirac function. It is obviously good to approximate the Dirac function@t0 with a bivariate normal function @a small dt. However, i am just curious if the following works (the reason is that I would like the 2D procedue to be consistent with the procedure where I solve the 1D forward PDE)//->say we have the following 2D PDE with mixing terms (by some correlation),Y_n-1 = (1 + dt*Lx + dt*Ly + dt*Lxy) * Y_nwhere Lx, Ly represents the x, y terms, and Lxy represents the mixing termat t=0, generate grids with center node (0,0) of value 1/dxdyroll forward PDE using ADI scheme (implicit along x and y, but explicit for mixing term)<-//However, what I observe are,1. if setting the mixing terms to be zero, the above procedure works fine2. if the mixing terms is non-zero, at t=dt, I have an extremely unrealistic PDE solution (like a VV shape and most part if negative except the center node)Thanks,
 
User avatar
kelang
Topic Author
Posts: 5
Joined: November 14th, 2011, 4:53 pm

solving 2D forward PDE with initial Dirac condition

February 27th, 2013, 2:10 pm

BTW, can I do a trick like the following,1) for the initial step, I set the mixing term to be zero in order to get a good solution at dt (i know it is wrong..., but if the dt -> 0)2) for the later step, I turn on the mixing term backQuoteOriginally posted by: kelangHi All,I am trying to solve the 2D forward PDE with an initial condition being a 2D Dirac function. It is obviously good to approximate the Dirac function@t0 with a bivariate normal function @a small dt. However, i am just curious if the following works (the reason is that I would like the 2D procedue to be consistent with the procedure where I solve the 1D forward PDE)//->say we have the following 2D PDE with mixing terms (by some correlation),Y_n-1 = (1 + dt*Lx + dt*Ly + dt*Lxy) * Y_nwhere Lx, Ly represents the x, y terms, and Lxy represents the mixing termat t=0, generate grids with center node (0,0) of value 1/dxdyroll forward PDE using ADI scheme (implicit along x and y, but explicit for mixing term)<-//However, what I observe are,1. if setting the mixing terms to be zero, the above procedure works fine2. if the mixing terms is non-zero, at t=dt, I have an extremely unrealistic PDE solution (like a VV shape and most part if negative except the center node)Thanks,
 
User avatar
Cuchulainn
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

solving 2D forward PDE with initial Dirac condition

February 27th, 2013, 2:47 pm

QuoteY_n-1 = (1 + dt*Lx + dt*Ly + dt*Lxy) * Y_n (1)where Lx, Ly represents the x, y terms, and Lxy represents the mixing termat t=0, generate grids with center node (0,0) of value 1/dxdyroll forward PDE using ADI scheme (implicit along x and y, but explicit for mixing term)<-//This (1) looks like an explicit method(?) It is well known that ADI (can) give awful results for Lxy.The problem has be solved by Soviet Splitting some time ago. (see the photo of the man who did it).Providing a reference to your PDE and FDM formulations would be very helpful.
Last edited by Cuchulainn on February 26th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
kelang
Topic Author
Posts: 5
Joined: November 14th, 2011, 4:53 pm

solving 2D forward PDE with initial Dirac condition

February 27th, 2013, 3:03 pm

Thanks Cuchulainn.The ADI scheme I am using is,(1+ dt* Lx)*Y_n+1/2 = (1 - 0.5*dt*Lxy) * Y_n(1+ dt* Ly) *Y_n+1 = (1-0.5*dt*Lxy) * Y_n+1/2QuoteOriginally posted by: CuchulainnQuoteY_n-1 = (1 + dt*Lx + dt*Ly + dt*Lxy) * Y_n (1)where Lx, Ly represents the x, y terms, and Lxy represents the mixing termat t=0, generate grids with center node (0,0) of value 1/dxdyroll forward PDE using ADI scheme (implicit along x and y, but explicit for mixing term)<-//This (1) looks like an explicit method(?) It is well known that ADI (can) give awful results for Lxy.The problem has be solved by Soviet Splitting some time ago. (see the photo of the man who did it).Providing a reference to your PDE and FDM formulations would be very helpful.
 
User avatar
Cuchulainn
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

solving 2D forward PDE with initial Dirac condition

February 27th, 2013, 3:52 pm

QuoteThe ADI scheme I am using is,(1+ dt* Lx)*Y_n+1/2 = (1 - 0.5*dt*Lxy) * Y_n(1+ dt* Ly) *Y_n+1 = (1-0.5*dt*Lxy) * Y_n+1/2hmmmFirst, it is not ADI (it's Soviet Splitting), second it's not implicit. Not much I can say; missing information. Have a look at the CFD thread for inspiration on how to formulate the problem.//Providing a reference to your PDE and FDM formulations would be very helpful.
Last edited by Cuchulainn on February 26th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
kelang
Topic Author
Posts: 5
Joined: November 14th, 2011, 4:53 pm

solving 2D forward PDE with initial Dirac condition

February 27th, 2013, 4:02 pm

thanks for the info. It turns out the trick I mentioned above seems to work. Will test more.QuoteOriginally posted by: CuchulainnQuoteThe ADI scheme I am using is,(1+ dt* Lx)*Y_n+1/2 = (1 - 0.5*dt*Lxy) * Y_n(1+ dt* Ly) *Y_n+1 = (1-0.5*dt*Lxy) * Y_n+1/2hmmmFirst, it is not ADI (it's Soviet Splitting), second it's not implicit. Not much I can say; missing information. Have a look at the CFD thread for inspiration on how to formulate the problem.//Providing a reference to your PDE and FDM formulations would be very helpful.
 
User avatar
Cuchulainn
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

solving 2D forward PDE with initial Dirac condition

February 27th, 2013, 4:31 pm

What value of dt are you using (very small I bet)?
 
User avatar
kelang
Topic Author
Posts: 5
Joined: November 14th, 2011, 4:53 pm

solving 2D forward PDE with initial Dirac condition

February 27th, 2013, 4:45 pm

very fine at the beginning of the time grids, actually quite aggressive, 0.0001~0.001QuoteOriginally posted by: CuchulainnWhat value of dt are you using (very small I bet)?
 
User avatar
Cuchulainn
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

solving 2D forward PDE with initial Dirac condition

February 27th, 2013, 7:21 pm

QuoteOriginally posted by: kelangvery fine at the beginning of the time grids, actually quite aggressive, 0.0001~0.001QuoteOriginally posted by: CuchulainnWhat value of dt are you using (very small I bet)?That's cheating :-)
 
User avatar
kelang
Topic Author
Posts: 5
Joined: November 14th, 2011, 4:53 pm

solving 2D forward PDE with initial Dirac condition

March 6th, 2013, 6:59 pm

thank you Cuchulainn. I think I am now having a good feeling about the problem.I've tried the operator splitting scheme (Soviet?), and ADI scheme (Douglas, CS, Modified CS, and HV). a) unfortunately, operator splitting does not seem to work in this case. But for zero-correlation, it works fine.b) ADI scheme works fine if the correlation is less than 70%. It looks like CS method works the best.For larger correlation (>70%), the ADI scheme oscillates significantly... But after I searched the forum, it seems your ADE method might work, will try later for sure.BTW, instead of using a simple Dirac function (i.e. central node to be 1), I am using a bivariate Gaussian (not cheating any more by setting zero correlation at the first step : ) )QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: kelangvery fine at the beginning of the time grids, actually quite aggressive, 0.0001~0.001QuoteOriginally posted by: CuchulainnWhat value of dt are you using (very small I bet)?That's cheating :-)
Last edited by kelang on March 5th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

solving 2D forward PDE with initial Dirac condition

March 7th, 2013, 9:11 am

QuoteOriginally posted by: kelangthank you Cuchulainn. I think I am now having a good feeling about the problem.I've tried the operator splitting scheme (Soviet?), and ADI scheme (Douglas, CS, Modified CS, and HV). a) unfortunately, operator splitting does not seem to work in this case. But for zero-correlation, it works fine.b) ADI scheme works fine if the correlation is less than 70%. It looks like CS method works the best.For larger correlation (>70%), the ADI scheme oscillates significantly... But after I searched the forum, it seems your ADE method might work, will try later for sure.BTW, instead of using a simple Dirac function (i.e. central node to be 1), I am using a bivariate Gaussian (not cheating any more by setting zero correlation at the first step : ) )QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: kelangvery fine at the beginning of the time grids, actually quite aggressive, 0.0001~0.001QuoteOriginally posted by: CuchulainnWhat value of dt are you using (very small I bet)?That's cheating :-)Have you tried Yanenko method for mixed derivatives? See thesis by Roelof Sheppard.
 
User avatar
Cuchulainn
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

solving 2D forward PDE with initial Dirac condition

March 7th, 2013, 9:15 am

Quotea) unfortunately, operator splitting does not seem to work in this case. But for zero-correlation, it works fine.b) ADI scheme works fine if the correlation is less than 70%. It looks like CS method works the best.You are doing something not quite right if these are your conclusions for a) and b).BTW The CS method was discovered by Samarksi in 1964. CS rediscovered it years later :-)Sheppard has shown -experimentally- that Yanenko is stable for all values of rho.I have never seen where ADI worked and splitting did not (but vice versa yes; see the CFD thread).BTW what values of dt are now acceptable? The source code for ADE + Yanenko for FD2 is herehttp://qfcl.wilmott.com/ page 56 FPE for SABR by @pcaspers QuoteBTW, instead of using a simple Dirac function (i.e. central node to be 1), I am using a bivariate Gaussian (not cheating any more by setting zero correlation at the first step : ) )It's got to be approximated by something.BTW is 1st step <==> t = 0 or t = h?
Last edited by Cuchulainn on March 6th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

solving 2D forward PDE with initial Dirac condition

March 7th, 2013, 5:03 pm

J. D. Lambert defines stiffness as follows:"If a numerical method with a finite region of absolute stability, applied to a system with any initial conditions, is forced to use in a certain interval of integration a steplength which is excessively small in relation to the smoothness of the exact solution in that interval, then the system is said to be stiff in that interval."So, maybe this is the current context as well. Alglib used to have Bulirch-Stoer which is goood for stiff ODEs, it seems its follow up is RK Cash Karp which is in Alglib as well.So, one way is to do Method of Lines MOL in state variables to get y' = dy/dt = f(x,y), y(0) = dirac and then plug into RKCK. // think aloud1. For each leg of splitting you could in space to get an ode; solve ode by RKCK.2. Time integration of stiff ode will not be so optimal with implicit Euler, CN or such IMO.dy/dt = 100(sin(t) - y), y(0) = 0takes something like 10^6 steps with Euler; Bulisch-Stoer was real fast.
Last edited by Cuchulainn on March 6th, 2013, 11:00 pm, edited 1 time in total.