I need to evaluate the following derivative:

$$\frac{1}{\prod_i \xi_i!}\frac{1}{\prod_j \eta_j!} \left.\frac{\partial^{\xi_1 + \cdots + \xi_m}}{\partial\alpha_1^{\xi_1}\ldots\partial\alpha_m^{\xi_m}} \frac{\partial^{\eta_1 + \cdots + \eta_n}}{\partial\beta_1^{\eta_1}\ldots\partial\beta_n^{\eta_n}} \exp\left(\sum_{ij} a_{ij} \alpha_i \beta_j\right) \right|_{\alpha_1 = \cdots = \alpha_m = \beta_1 = \cdots = \beta_n = 0}$$

where the $\xi_i$ and $\eta_j$ are non-negative integers, with $i = 1...m$ and $j = 1...n$, and the $a_{ij}$ are non-negative real numbers.

Is there a good numerical algorithm to do this? Is it efficient?

(See also: https://math.stackexchange.com/a/430925/10063)


2 Answers 2


Do it by hand or, if you're lazy, do it symbolically with Maple or Mathematica. This is certainly going to be more accurate than trying to do high-order derivatives numerically.

  • $\begingroup$ $m$ and $n$ are large numbers. And I need to evaluate this expression iteratively many times, with different values of $\xi_i$ and $\eta_j$. I think symbolically would be too slow. $\endgroup$
    – becko
    Jun 28, 2013 at 3:42
  • 4
    $\begingroup$ Calculating derivatives numerically becomes increasingly inaccurate as the order of the derivative increases, and expensive as both the order and number of variables increases. Automatic differentiation would probably also break down. A spectral approach with the right sort of basis could be accurate, but given the number of variables and high order derivatives, you probably require too many points to be practical. Symbolically is probably the best bet in terms of a combination of accuracy and speed, even for large $m$ and $n$, when the expression is simple and closed-form. $\endgroup$ Jun 28, 2013 at 7:26
  • 2
    $\begingroup$ Well, it is closed form. Take the beta-derivatives and you get something of the form polynomial in alpha times existing exponential. That is easy to take the alpha-derivative of. $\endgroup$ Jun 28, 2013 at 12:53
  • $\begingroup$ @GeoffOxberry okay. I'll try it symbolically. I'll let you know if it works. $\endgroup$
    – becko
    Jul 1, 2013 at 12:36

Here's the easy part. Define $$A = \prod_i A_i = \prod_i \frac{1}{\xi_i!} \left(\frac{\partial}{\partial \alpha_i} \right)^{\xi_i}$$ $$B = \prod_j B_j = \prod_j \frac{1}{\eta_j!} \left(\frac{\partial}{\partial \beta_j} \right)^{\eta_j}$$ $$f = \exp \sum_{ij} a_{ij} \alpha_i \beta_j = \prod_{ij} f_{ij} = \prod_{ij} e^{a_{ij} \alpha_i \beta_j}$$ We have $$ \frac{\partial}{\partial \alpha_k} f_{ij} = \begin{cases} a_{ij} \beta_j f_{ij} & i=k \\ 0 & i \ne k \end{cases}$$ $$ A_i f = \frac{f}{\xi_i!}\left(\sum_j a_{ij} \beta_j \right)^{\xi_i}$$ $$ A f = f \prod_i \frac{\left(\sum_j a_{ij} \beta_j \right)^{\xi_i}}{\xi_i!}$$ Unfortunately, the next step is harder. :)


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.