0
$\begingroup$

I have found the two similar questions:

  1. Numerical derivative of composite function

  2. Partial derivative of composite function

but don't know how to combine them properly.

I have

$x=[x_1,x_2]^T$

and

$F(x) = g(f_1(x), f_2(x)) = g(f_1(x_1,x_2), f_2(x_1, x_2))$

The goal is to compute $\frac{\partial F}{\partial x_1}$

My assumption is: $ \frac{\partial F}{\partial x_1} =\frac{F(x_1+h)-F(x_1-h)}{2h}=\frac{g(f_1(x_1+h,x_2),f_2(x_1+h,x_2))-g(f_1(x_1-h,x_2),f_2(x_1-h,x_2))}{2h}$, given the fact that $x_2$ is constant while $F$ is being differentiated by $x_1$.

Is this formula correct?

$\endgroup$
2
  • $\begingroup$ $∂F/∂𝑥_1$ = $∂g/∂f*∂f/∂𝑥_1$ $\endgroup$ – Äres Dec 24 '19 at 12:14
  • $\begingroup$ Sure but i need numerical solution while you provide analytical. $\endgroup$ – Elia Dec 24 '19 at 12:24
1
$\begingroup$

Your formular is correct, you are using central finite differences applied to $F(x)$.

(There are many other possibilities to approximation the derivatives as well. It always depends on the application what is needed and what is useful.

In some applications, when the derivatives of $f$ and $g$ are known functions, it is useful to employ $$ \frac{d F}{d x_1} = \frac{\partial g}{ \partial y_1} \frac{\partial f_1}{ \partial x_1} + \frac{\partial g}{ \partial y_2} \frac{\partial f_2}{ \partial x_1} $$ Here I use the notation $g(y_1,y_2)$. Using this chain rule iteratively allows to get exact derivatives in the computer and it is called automatic differentiation.)

$\endgroup$
1
  • $\begingroup$ Great, thanks, it works. $\endgroup$ – Elia Dec 24 '19 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.