How to obtain antiderivative numerically with known partial derivative matrices using MATLAB?

35 Views Asked by At

assuming an unknown original function is $f(x,y)$, now I have its partial derivatives $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$ expressed by two matrices $\mathbf{A}$ and $\mathbf{B}$. How can I get the original function matrix $f(x,y)$ numerically? I am using MATLAB.

In other words, if I have artificially generated two matrices $\mathbf{A}$ and $\mathbf{B}$, how can I obtain the/an original function whose partial derivatives are $\mathbf{A}$ and $\mathbf{B}$?

1

There are 1 best solutions below

0
On

This is the problem of inverse gradient. It is famous and not so easy.

You can express the problem with linear algebra by trying to find a way to (vec)torize A and B and find numerical approximation matrices for the partial differential operators to finally solve

$$\min_C \{\|D_x vec(C) - vec(A)\| + \|D_yvec(C) - vec(B)\|\}$$

Where $D_x$, $D_y$ are matrices representing partial differentiation w.r.t. x and y, respectively

As the system is underdetermined (constant levels are free) you will do well to add some term of regularization. This is good practice or even necessary for many problems of the differential equation kind.