2
$\begingroup$

cannot delete my own question, so I try to overwrite it instead...

$\endgroup$
2
  • $\begingroup$ Do you have an idea what the maximum orders of derivatives needed will be? $\endgroup$
    – hardmath
    Jan 22 '16 at 3:13
  • 1
    $\begingroup$ This is to be used for a compiler. Thus the max. order of derivatives depends on the input source code written by the user. $\endgroup$
    – user7098
    Jan 22 '16 at 17:23
3
$\begingroup$

One approach is to use the Faà di Bruno formula: $$ \big((1+x^M)^{1/M}\big)^{(n)} = \sum \frac{n!}{m_1!1!^{m_1}\cdots m_n! n!^{m_n}} (1/M)^{\underline{m_1+\cdots+m_n}}(1+x^M)^{1/M-m_1-\cdots-m_n} \prod_{j=1}^{n} \big(M^{\underline{\phantom{,}j}} x^{M-j}\big)^{m_j}, \qquad M\notin\mathbb{Z} $$ Here $a^{\underline{b}}$ is the falling factorial, and the sum is over all $n$-tuples of integers $m_1,\ldots,m_n\geq0$ such that $\sum_k km_k = n$. This formula is likely to be unstable for very large values of $n$.

A decent alternative is to evaluate the contour integral $$ \frac{n!}{2\pi \mathrm{i}}\int_\gamma (1+z^M)^{1/M}\frac{dz}{(z-x)^{n+1}}, $$ where the contour $\gamma$ is a circle of some radius $R$ surrounding $x$, $z = x+Re^{\mathrm{i}t}$, with $R$ chosen such that all the branch points of $(1+x^M)^{1/M}$ in the complex plane are outside the circle. The choice of $R$ affects the stability of this formula. This is a straightforward Fourier integral, so one can directly use an existing library to compute it, and one can also evaluate many derivatives at once efficiently using FFT.

$\endgroup$
5
  • $\begingroup$ I don't see how the first method avoids calculating the derivative vs. M at x==0. The problem is, that I always end up with a log(0.0)... $\endgroup$
    – user7098
    Jan 22 '16 at 18:53
  • $\begingroup$ @GrapschKnutsch In the first formula, when $M$ is an integer, $x^{M-j}$ should be replaced with $x^{M-j}[M\geq j]$ because it's really $(x^M)^{(j)}$ (see the full formula). At $x=0$, one just has $0^0=1, 0^k=0$. Not sure where you get $\log$. When $M$ is not an integer, the function is not infinitely differentiable at $x=0$, anyway, so the formula has to break down. The second (Cauchy integral) formula is usually slower, but more robust, and doesn't need such tinkering. $\endgroup$
    – Kirill
    Jan 22 '16 at 19:07
  • $\begingroup$ "the function is not infinitely differentiable at x=0": Does this mean, that this function should not be part of a transistor model or it should not be calculated a x=0 when being part of such a model? $\endgroup$
    – user7098
    Jan 22 '16 at 19:28
  • $\begingroup$ @GrapschKnutsch You lost me there, I have no idea what you mean. What model? Can you perhaps create a separate question about what you actually want to do? $\endgroup$
    – Kirill
    Jan 22 '16 at 19:37
  • $\begingroup$ This function is part of some famous transistor model (a mathematical description of electrical currents as a function of voltages) used in simulation of electrical circuits. Can I assume, that this function is not suitable for this purpose, as it is not physical. $\endgroup$
    – user7098
    Jan 22 '16 at 19:48

Your Answer

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