Matrix representation of Mixed derivatives

kronecker productnumerical methodspartial derivative

Imagine we have the problem

\begin{cases}
-\frac{d^2u}{dx^2} = f(x), x \in [0,L] \\
u(0) = 0 \\
u(L) = 0
\end{cases}

We know that we can approximate the second derivative using this formula:$$ \frac{d^2u(x)}{dx^2} \approx \frac{u(x+h)-2u(x)+u(x-h)}{h^2} $$

if we define $u_{k} := u(x_{k}) $; $\ \ x_{k} = kh $ and $ \ \ k = 0,1,2,…,N$. $h$ is known as the mesh size or step size. We get:

$$ \frac{d^2u_{k}}{dx^2} \approx \frac{u_{k+1}-2u_{k}+u_{k-1}}{h^2} = \frac{u_{k-1}-2u_{k}+u_{k+1}}{h^2} $$ for $k=1,…,N-1$

Since $u(0) = u_{0} = 0$ and $ u(L) = u(x_{N}) = u_{N} = 0 $ we get the following matrix representation of the second derivative operator

\begin{equation}
\frac{d^2}{dx^2} \approx L_{2} = \frac{1}{h^2}\left(\begin{matrix}
-2 & 1 & & 0\\
1 & \ddots & \ddots & \\
& \ddots & \ddots & 1 \\
0 & & 1 & -2 \end{matrix} \right)
\end{equation}

Then to approximate the solution of the differental equation we solve the system:

$$-L_{2}\hat{u} = \hat{f}$$
where $ \hat{f} = [ f(x_{1}) \ f(x_{2}) \ … \ f(x_{N-1}) ]^T $ and $\hat{u} = [ u_{1} \ … \ u_{N-1} ]^T$

The matrix representation of the laplacian operator using the Kronecker product is: $$ \Delta =\nabla^2 = \frac{\partial^2}{\partial x^2} + \frac{\partial ^2}{\partial y^2} = L_{2}\otimes I_{n_{x}} + I_{n_{y}} \otimes L_{2} $$

$\textbf{Note that I have used $L_{2}$ and kronecker product to get a matrix representation} $ of the laplacian operator.

With this in mind. I want to approximate the first derivative using central difference:

$$ \frac{du_{k}}{dx} \approx \frac{ u_{k+1}-u_{k-1} }{ 2h } = \frac{ -u_{k-1} +u_{k+1} }{ 2h } $$

Since $u(0) = u_{0} = 0$ and $ u(L) = u(x_{N}) = u_{N} = 0 $ we get the following matrix representation of the first derivative

\begin{equation}
\frac{d}{dx} \approx L_{1} = \frac{1}{2h}\left(\begin{matrix}
0 & 1 & & 0\\
-1 & \ddots & \ddots & \\
& \ddots & \ddots & 1 \\
0 & & -1 & 0 \end{matrix} \right)
\end{equation}

I want to use $L_{1}$ and kronecker product to get the matrix representation of

$$ \frac{\partial^2 }{\partial y \partial x } $$
and
$$ \frac{\partial^2 }{\partial x \partial y } $$

$\textbf{My questions are:} $

  1. Is this possible?

  2. if question 1. is affirmative, what is the matrix representation of the mixed derivatives using $L_{1}$ and kronecker product?

  3. if question 1. is negative, how can we get the matrix representation of the mixed derivatives using a simple matrix and kronecker product?

  4. Do you know a book or document( article or other ) that explain in detail this or something similar?

$\textbf{I want to use kronecker product because it is fast and easy to implement in} $ matlab or octave.

By the way I tried to use this formula

$$ \frac{\partial^2u_{k,j} }{\partial x \partial y } = \frac{ u_{k+1,j+1}+u_{k-1,j-1}-u_{k+1,j-1}-u_{k-1,j+1} }{4h^2} $$

But it was hard to see a pattern. Thank you!

Best Answer

Once you have the matrix $\bf L_1$ to represent the divided difference of $f(x)$ given as a vertical vector, then if you transpose the whole you'll get a horizontal vector for the difference.

So if $f(x,y)$ is represented as a matrix $\bf F_{\, x,\, y}$ , the matrix representing ${\partial \over {\partial x\partial y}}f(x,y)$ will be $\bf L_1 \bf F_{\, x, \,y} \bf L_1^T$

Related Question