Ideas about Finite Difference Method Applications

74 Views Asked by At

By using the finite difference method, we can calculate the finite difference coefficients. And we can construct a matrix $D$ such that multiplying a vector of $\mathbf{y}$ values would lead to a second order approximation of the First derivative for the given data.

If we define the two vectors $\mathbf{x}=[x_0, x_1,\ldots,x_N]^T$ and $\mathbf{y}=[y_0, y_1,\ldots,y_N]^T$ such that

$$\mathbf{y} = f(\mathbf{x})$$

for some scalar function $f$, we can find a matrix $D$ such that

$$ f'(\mathbf{x}) \approx D\mathbf{y} $$

For example, if all points are evenly separated we can construct based on finite difference formula where $h$ is the difference between $x$ $$ D = \begin{bmatrix} -3 & 4 & & -1 & 0 & 0 & \dots & 0 & 0 & 0 & 0 \\ -1 & 0 & & 1 & 0 & 0 & \dots & 0 & 0 & 0 & 0 \\ 0 & -1 & & 0 & 1 & 0 & \dots & 0 & 0 & 0 & 0 \\ 0 & 0 & & -1 & 0 & 1 & \dots & 0 & 0 & 0 & 0 \\ \vdots \\ 0 & 0 & & 0 & 0 & 0 & \dots & -1 & 0 & 1 & 0 \\ 0 & 0 & & 0 & 0 & 0 & \dots & 0 & -1 & 0 & 1 \\ 0 & 0 & & 0 & 0 & 0 & \dots & 0 & 1 & -4 & 3 \end{bmatrix} \times \frac{1}{2 h} $$

However, I'm considering from another direction. If we already known the first derivative of a function $f(x)$ at some discrete points and wanted to solve for the discrete function itself. Suppose given $D$ and vector $\mathbf{y} = f'(\mathbf{x})$, we can solve the linear algebra problem

$$ D\mathbf{f} = \mathbf{y} $$

for $\mathbf{f}\approx f(\bf{x})$. Is this idea reasonable? Will there be some issues if I use this idea to solve problems?