First of all, I don't have much rep to spend over here, but I gotta lot more at the DSP SE. So if you wanna earn some rep at the DSP SE, please go to my question over there because tomorrow I am gonna hang the maximum of 500 point bounty onto it. I can't get away with that here although if someone votes me up on this question (or something else I have done here), I can hang a bounty of 350 onto this question in a couple days.

So I have a function of the form:

$$ f(x) = \ln\left(\arctan\left(\alpha \, e^{x} \right) \right) - \ln\left(\arctan\left( \alpha \, e^{-x}\right) \right) $$

What I want to do is invert $f(x)$ (but I know I can't do it exactly with a nice closed form). I have already done a first-order approximation and i want to bump it up to a third-order approximation. And this has become a sorta copulating female canine, even though it should be straight forward.

Now this has something to do with the Lagrange Inversion Theorem which I asked about before and I only want to take it to one more term than I have.

We know from above that $f(x)$ is an odd-symmetry function:

$$ f(-x) = -f(x) $$

This means $f(0)=0$ and all even-order terms of the Maclaurin series will be zero:

$$ y = f(x) = a_1 x + a_3 x^3 + ... $$

The inverse function is also odd symmetry, goes through zero, and can be expressed as a Maclaurin series

$$ x = g(y) = b_1 y + b_3 y^3 + ... $$

and if we know what $a_1$ and $a_3$ are of $f(x)$, then we have a good idea what $b_1$ and $b_3$ must be:

$$ b_1=\frac{1}{a_1} \quad \quad \quad \quad b_3 = -\frac{a_3}{a_1^4} $$

Now, I am able to calculate the derivative of $f(x)$ and evaluate it at zero and I get $a_1$ and $b_1$ as a nice function of $\alpha$. But I am having a bitch of a time getting $a_3$ and therefore $b_3$. Can someone do this? I'd even settle for a solid expression for the third derivative of $f(x)$ evaluated at $x=0$.

Feel free to go over to the DSP site and earn some rep over there.

  • 1
    $\begingroup$ You can feed your function into any decent symbolic math software (mathematica, matlab, etc) and calculate the coefficients you need to apply the Lagrange inversion theorem. For example, the third derivative of $f(x)$ evaluated at $x = 0$ is given by wolframalpha.com/input/… $\endgroup$
    – levap
    Feb 19, 2017 at 1:47
  • $\begingroup$ i have basic MATLAB. didn't know that they had a symbolic function like mathematica or Derive. i also didn't know it could do this anyway. i am looking at the wolfram answer you gave. looks a little icky, but maybe not impossible to use. $\endgroup$ Feb 19, 2017 at 1:58
  • $\begingroup$ I'm actually mostly familiar with mathematica but I'm sure you can also do it with MATLAB. And yes, it's icky but this is expected. You can even ask wolfram for the series expansion of your $f$ (for example, wolframalpha.com/input/… shows you the series expansion of the derivative up to order $x^4$ so you can even get a fifth-order approximation if you want and more if you have access to a full version of mathematica). $\endgroup$
    – levap
    Feb 19, 2017 at 2:07

1 Answer 1


Here is an answer based upon a direct expansion of the odd function $f(x)$ \begin{align*} f(x)&=\ln\left(\arctan\left(\alpha e^x\right)\right)-\ln\left(\arctan\left(\alpha e^{-x}\right)\right)\\ &=f_1x+f_3x^3+O\left(x^5\right)\tag{1} \end{align*} into a series up to the third order. We will see this approach is albeit somewhat cumbersome, quite manageable.

Note: According to the series expansions \begin{align*} e^x&=\sum_{n=0}^\infty \frac{x^n}{n!}& &x\in\mathbb{C}\\ \arctan(x) &=\sum_{n=0}^\infty \frac{(-1)^n}{2n+1}x^{2n+1} & &|x|<1\\ \ln(x)&=\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}(x-1)^n & &|x-1|<1 \end{align*} the MacLaurin expansion (1) of $f(x)$ is absolut convergent for $x\in\mathbb{C}$ with \begin{align*} |\arctan(\alpha e^x)-1|&<1\\ |\arctan(\alpha e^{-x})-1|&<1\\ \alpha<e^x&<\frac{1}{\alpha} \end{align*}

At first we focus at the left-hand term $$\ln\left(\arctan\left(\alpha e^x\right)\right)$$ of $f(x)$ and start with

$$ $$

Series expansion of $\arctan$:

We obtain \begin{align*} \arctan(\alpha e^x)&=\sum_{n=0}^\infty \frac{(-1)^n}{2n+1}\alpha^{2n+1} e^{(2n+1)x}\\ &=\sum_{n=0}^\infty \frac{(-1)^n}{2n+1}\alpha^{2n+1}\sum_{j=0}^\infty \frac{1}{j!}(2n+1)^jx^j\\ &=\sum_{j=0}^\infty\frac{1}{j!}\sum_{n=0}^\infty(-1)^n(2n+1)^{j-1}\alpha^{2n+1}x^j\tag{2} \end{align*}

We now derive from (2) the coefficients up to $x^3$. Using the coefficient operator $[x^k]$ to denote the coefficient of $x^k$ in a series we obtain \begin{align*} [x^0]\arctan\left(\alpha e^x\right)&=\sum_{n=0}^\infty \frac{(-1)^n}{2n+1}\alpha^{2n+1}=\arctan \alpha\\ [x^1]\arctan\left(\alpha e^x\right)&=\sum_{n=0}^\infty (-1)^n\alpha^{2n+1}=\frac{\alpha}{1+\alpha ^2}\\ [x^2]\arctan\left(\alpha e^x\right)&=\frac{1}{2}\sum_{n=0}^\infty (-1)^n(2n+1)\alpha^{2n+1}\\ &=\frac{\alpha}{2}\cdot\frac{d}{d\alpha}\left(\sum_{n=0}^\infty (-1)^n\alpha^{2n+1}\right)\\ &=\frac{\alpha}{2}\cdot\frac{d}{d\alpha}\left(\frac{\alpha}{1+\alpha^2}\right)\\ &=\frac{\alpha(1-\alpha^2)}{2\left(1+\alpha^2\right)^2}\\ [x^3]\arctan\left(\alpha e^x\right)&=\frac{1}{6}\sum_{n=0}^\infty (-1)^n(2n+1)^2\alpha^{2n+1}\\ &=\frac{\alpha^2}{6}\sum_{n=0}^\infty (-1)^n(2n+1)(2n)\alpha^{2n-1} +\frac{\alpha}{6}\sum_{n=0}^\infty (-1)^n(2n+1)\alpha^{2n}\\ &=\frac{\alpha^2}{6}\cdot\frac{d^2}{d\alpha^2}\left(\sum_{n=0}^\infty(-1)^n\alpha^{2n+1}\right) +\frac{\alpha}{6}\cdot\frac{d}{d\alpha}\left(\sum_{n=0}^\infty(-1)^n\alpha^{2n+1}\right)\\ &=\left(\frac{\alpha^2}{6}\cdot\frac{d^2}{d\alpha^2}+\frac{\alpha}{6}\cdot\frac{d}{d\alpha}\right)\left(\frac{\alpha}{1+\alpha^2}\right)\\ &=\frac{\alpha^2}{6}\cdot\frac{2\alpha\left(\alpha^2-3\right)}{(1+\alpha^2)^3} +\frac{\alpha^2}{6}\cdot\frac{1-\alpha^2)}{(1+\alpha^2)^2}\\ &=\frac{\alpha^5-6\alpha^3+\alpha}{6(1+\alpha^2)^3} \end{align*}

We conclude \begin{align*} \arctan\left(\alpha e^x\right)&=\arctan(\alpha)+\frac{\alpha}{1+\alpha^2}x+\frac{\alpha(1-\alpha^2)}{2\left(1+\alpha^2\right)^2}x^2\\ &\qquad+\frac{\alpha^5-6\alpha^3+\alpha}{6(1+\alpha^2)^3}x^3+O(x^4)\tag{3} \end{align*}

$$ $$

Powers in logarithmic series:

In order to derive the coefficients of the logarithmic series \begin{align*} \ln\left(\arctan(\alpha e^x)\right)&=\sum_{n=1}^\infty\frac{(-1)^{n+1}}{n}(\arctan(\alpha e^x)-1)^n \end{align*} we write the expression (3) as \begin{align*} \arctan\left(\alpha e^x\right)&=a_0+a_1x+a_2x^2+a_3x^3+O(x^4) \end{align*} and we consider \begin{align*} \ln\left(\arctan(\alpha e^x)\right)&=\sum_{n=1}^\infty\frac{(-1)^{n+1}}{n}((a_0-1)+a_1x+a_2x^2+a_3x^3)^n+O(x^4)\tag{4} \end{align*}

We now set $A(x)=(a_0-1)+a_1x+a_2x^2+a_3x^3$ and extract the coeffcients of $x^0$ to $x^3$ from \begin{align*} \left(A(x)\right)^n&=((a_0-1)+a_1x+a_2x^2+a_3x^3)^n\\ &=\sum_{j=0}^n\binom{n}{j}(a_0-1)^j\left(a_1x+a_2x^2+a_3x^3\right)^{n-j}\\ &=\sum_{j=0}^n\binom{n}{j}(a_0-1)^j\sum_{k=0}^{n-j}\binom{n-j}{k}a_1^kx^k\left(a_2x^2+a_3x^3\right)^{n-j-k}\tag{5}\\ \end{align*}

We obtain from (5) \begin{align*} [x^0]\left(A(x)\right)^n&=\binom{n}{0}(a_0-1)^n=(a_0-1)^n\\ [x^1]\left(A(x)\right)^n&=\binom{n}{1}(a_0-1)^{n-1}\binom{1}{0}a_1=a_1n(a_0-1)^{n-1}\\ [x^2]\left(A(x)\right)^n&=\binom{n}{1}(a_0-1)^{n-1}\binom{1}{1}a_2+\binom{n}{2}(a_0-1)^{n-2}a_1^2\\ &=a_2n(a_0-1)^{n-1}+\frac{1}{2}n(n-1)a_1^2(a_0-1)^{n-2}\\ [x^3]\left(A(x)\right)^n&=\binom{n}{1}(a_0-1)^{n-1}\binom{1}{1}a_3+\binom{n}{2}(a_0-1)^{n-2}\binom{2}{1}a_1a_2\\ &\qquad+\binom{n}{3}(a_0-1)^{n-3}\binom{3}{0}a_1^3\\ &=na_3(a_0-1)^{n-1}+a_1a_2n(n-1)(a_0-1)^{n-2}\\ &\qquad+\frac{1}{6}n(n-1)(n-2)a_1^3(a_0-1)^{n-3}\tag{6} \end{align*}

Series expansion of logarithm:

We calculate using (6) the coefficients of $\ln(\arctan(\alpha e^x))$ in terms of $a_j, 0\leq j\leq 3$

\begin{align*} [x^0]&\ln(\arctan(\alpha e^x))=\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}[x^0]A(x)\\ &=\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}[x^0](a_0-1)^n\\ &=\ln(a_0-1)\\ [x^1]&\ln(\arctan(\alpha e^x))=\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}[x^1]A(x)\\ &=\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}[x^0]a_1n(a_0-1)^{n-1}\\ &=a_1\sum_{n=0}^\infty(-1)^n(a_0-1)^n\\ &=\frac{a_1}{a_0}\\ [x^2]&\ln(\arctan(\alpha e^x))=\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}[x^2]A(x)\\ &=\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}\left(a_2n(a_0-1)^{n-1}+\frac{1}{2}n(n-1)a_1^2(a_0-1)^{n-2}\right)\\ &=\sum_{n=0}^\infty (-1)^{n}\left(a_2(a_0-1)^{n}+\frac{1}{2}(n-1)a_1^2(a_0-1)^{n-1}\right)\\ &=\left(a_2+\frac{a_1^2}{2}\frac{d}{da_0}\right)\left(\sum_{n=0}^\infty(-1)^n(a_0-1)^n\right)\\ &=\left(a_2+\frac{a_1^2}{2}\frac{d}{da_0}\right)\left(\frac{1}{a_0}\right)\\ &=\frac{a_2}{a_0}-\frac{a_1^2}{2a_0^2}\\ [x^3]&\ln(\arctan(\alpha e^x))=\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}[x^3]A(x)\\ &=\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}\left(na_3(a_0-1)^{n-1}+a_1a_2n(n-1)(a_0-1)^{n-2}\right.\\ &\qquad\qquad\qquad\qquad\left.+\frac{1}{6}n(n-1)(n-2)a_1^3(a_0-1)^{n-3}\right)\\ &=\sum_{n=0}^\infty (-1)^{n}\left(a_3(a_0-1)^{n}+a_1a_2n(a_0-1)^{n-1}+\frac{1}{6}n(n-1)a_1^3(a_0-1)^{n-2}\right)\\ &=\left(a_3+a_1a_2\frac{d}{da_0}+\frac{a_1^3}{6}\frac{d^2}{da_0^2}\right)\left(\sum_{n=0}^\infty(-1)^n(a_0-1)^n\right)\\ &=\left(a_3+a_1a_2\frac{d}{da_0}+\frac{a_1^3}{6}\frac{d^2}{da_0^2}\right)\left(\frac{1}{a_0}\right)\\ &=\frac{a_3}{a_0}-\frac{a_1a_2}{a_0^2}+\frac{a_1^3}{3a_0^3}\tag{7} \end{align*}

$$ $$

Series expansion of $f(x)$:

Now it's time to harvest. We finally obtain with (3) and (7) respecting that $f(x)$ is odd

\begin{align*} \color{blue}{f(x)}&\color{blue}{=\ln\left(\arctan\left(\alpha e^x\right)\right)-\ln\left(\arctan\left(\alpha e^{-x}\right)\right)}\\ &=\ln(a_0-1)+\frac{a_1}{a_0}x+\left(\frac{a_2}{a_0}-\frac{a_1^2}{2a_0^2}\right)x^2 +\left(\frac{a_3}{a_0}-\frac{a_1a_2}{a_0^2}+\frac{a_1^3}{3a_0^3}\right)x^3\\ &\qquad-\ln(a_0-1)+\frac{a_1}{a_0}x-\left(\frac{a_2}{a_0}-\frac{a_1^2}{2a_0^2}\right)x^2\\ &\qquad\qquad +\left(\frac{a_3}{a_0}-\frac{a_1a_2}{a_0^2}+\frac{a_1^3}{3a_0^3}\right)x^3+O(x^5)\\ &=\frac{2a_1}{a_0}x+2\left(\frac{a_3}{a_0}-\frac{a_1a_2}{a_0^2}+\frac{a_1^3}{3a_0^3}\right)x^3+O(x^5)\\ &\color{blue}{=\frac{2\alpha}{(1+\alpha^2)\arctan(\alpha)}x +\frac{\alpha}{3(1+\alpha^2)^3\arctan(\alpha)}\Bigg(\alpha^4-6\alpha^2+1}\\ &\qquad\color{blue}{\left.-\frac{3\alpha(1-\alpha^2)}{\arctan(\alpha)}+\frac{2\alpha^2}{\left(\arctan(\alpha)\right)^2}\right)x^3+O(x^5)} \end{align*}

  • $\begingroup$ Thanks! Markus!. say, could you step over to the question at the DSP SE page and consider posting your answer there and possibly check it for consistency with Atul's answer that he got from Wolfram? if you wanna pick up some rep at the DSP SE, i would be happy to toss you some. (you don't need any here!) $\endgroup$ Feb 20, 2017 at 6:58
  • $\begingroup$ @robertbristow-johnson: You're welcome! Since this question is obviously really important to you, I will check Atui's answer and clarify differences, if any. As I'm just going to work, expect some info till tomorrow. $\endgroup$
    – epi163sqrt
    Feb 20, 2017 at 7:56
  • $\begingroup$ @robertbristow-johnson: I've checked my answer and did some corrections. Both results now coincide. $\endgroup$
    – epi163sqrt
    Feb 20, 2017 at 15:33
  • $\begingroup$ thank you Markus. the enormity of the labor (juxtaposed against the ease that the Wolfram people had in getting their answer) just amazes me. i couldn't get the same answer twice when i did this by hand (where i was simply trying to calculate $f'''(0)$, not using the repeated and layered series expansion that you had used). $\endgroup$ Feb 20, 2017 at 17:51
  • $\begingroup$ @robertbristow-johnson: You're welcome, Robert! In fact I also often use WA or do some scripting to verify intermediate results. Nevertheless I like to do some calculations also manually since this sometimes provides additional insight. When doing the essential parts manually, we also might feel the need to look for more efficient ways and this can drive our research and open up complete new ways, which we wouldn't have found otherwise. But the same holds also when playing with WA. So, I don't want to miss any of these possibilities. :-) $\endgroup$
    – epi163sqrt
    Feb 20, 2017 at 18:25

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.