-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mixed Derivative with Non Uniform Grid #10
Comments
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 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. |
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)? |
For now, I use the same formula as in the case of the uniform grid. Check that it is correct.
The text was updated successfully, but these errors were encountered: