2
$\begingroup$

NDSolve`FiniteDifferenceDerivative is a very helpful function to calculate numerical derivatives. It is explained in the tutorial The Numerical Method of Lines in more detail.

Here I found the reference BENGT FORNBERG:CALCULATION OF WEIGHTS IN FINITE DIFFERENCE FORMULAS which explains how the weights are to be calculated in the one dimensional case.

I couldn't find a similar reference for the two dimensional case.

My question:

  • How is the differentiation matrix evaluated in this case, especially at boundary meshpoints?
  • Are there additional helpful references in the Mathematica documentation?

Thanks!

$\endgroup$
8
  • $\begingroup$ Well, I think there's nothing special for n-D case? It is just a natural extension of the 1D case. Can you add an example that cannot be handled by the 1D formula in your opinion? $\endgroup$ Commented Jan 16 at 0:40
  • $\begingroup$ @xzczd I tried to estimate the differentiation matrix in an irregular mesh (as we tried in How can I construct the derivative matrix for an irregular domain? ) by approximating the function by its taylorexpansion in a small neighborhood. Works fine for inner meshpoints, but gives bad results at the boundary. That's why I want to understand differentiationmatrix in more detail. Thanks for your interest! $\endgroup$ Commented Jan 16 at 8:27
  • $\begingroup$ Oh then Fornberg's work in this paper won't help, it's only for regular grid… $\endgroup$ Commented Jan 16 at 8:38
  • $\begingroup$ That's why I try to understand the case regular grid first! $\endgroup$ Commented Jan 16 at 8:53
  • $\begingroup$ As mentioned in my first comment, for regular grid there's nothing special. We just need some list manipulation on the 1D differentiation matrix, for example: SeedRandom[123]; d1 = 4; d2 = 5; xgrid = Accumulate@RandomReal[1, d1]; ygrid = Accumulate@RandomReal[1, d2]; fdd = NDSolve`FiniteDifferenceDerivative[##, DifferenceOrder -> 2] &; func02 = fdd[{0, 2}, {xgrid, ygrid}]; func2 = fdd[2, ygrid]; {mat2, mat02} = #@"DifferentiationMatrix" & /@ {func2, func02}; SparseArray[Band[{1, 1}] -> Table[mat2, d1]] == mat02 I don't think this will help one understanding the irregular cases. $\endgroup$ Commented Jan 16 at 8:58

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.