EconPDEs.jl icon indicating copy to clipboard operation
EconPDEs.jl copied to clipboard

Mixed Derivative with Non Uniform Grid

Open matthieugomez opened this issue 5 years ago • 3 comments

For now, I use the same formula as in the case of the uniform grid. Check that it is correct.

matthieugomez avatar Jul 05 '19 17:07 matthieugomez

Hi Matthieu,

Perhaps another alternative to the way you're currently implementing the finite differences is to use the Fornberg algorithm. It generates weights for one-dimensional finite differences of arbitrary order and accuracy, for both uniform and non-uniform grids. Then to approximate a mixed derivative, you'd just apply the one-dimensional finite difference in both directions. In the case of a uniform grid, this will yield the standard formula for a mixed derivative approximation. Note that I'm fairly certain this is the way Mathematica implements its finite differences (or so it seemed when I implemented a replication of Di Tella (2017) in Matlab recently).

A Matlab implementation of the Fornberg algorithm is posted here, and if you're interested, then I can try coding it up in Julia for you because I would like to use your tools. My personal research uses continuous-time macrofinance methods, and I'd prefer not to re-invent the wheel!

Best,

William

chenwilliam77 avatar Oct 10 '19 14:10 chenwilliam77

@chenwilliam77 A less focused project than EconPDEs working on these things is https://github.com/JuliaDiffEq/DiffEqOperators.jl/ which implements fornberg, different upwinding, etc. and the intention is to get very solid lazy operator composition as well. It is implemented largely for matrix-free methods using convolutions (which is a little different than the stencils that @matthieugomez is using) but there are concretizations to structured matrices where appropriate

If you are interested in doing any julia code on these topics, we would love to have you work on using these for finance applications.

jlperla avatar Oct 10 '19 18:10 jlperla

Thanks for the example of mixed derivatives. Before I thought the monotonicity condition of Barles-Souganidis' framework is violated by the mixed derivative, so it would've been a problem for the finite difference method.

So it seems with a fully implicit algorithm we can still handle the cross derivative term (at least when it's not too large)?

FuZhiyu avatar Mar 21 '21 00:03 FuZhiyu