Why is Wolfram’s (presumably more precise) Maclaurin series a much worse approximation than the own (presumably less precise) series

approximationimplicit functiontaylor expansionwolfram alpha

I recently answered this question, concerning the existence and nature of the implicit function defined by:

$$F(x,y)=x^3-y^3-3xy+1$$

For $x$ close to $0$ – roughly the range $|x|\lt0.4$ – I showed how to obtain a fourth-order Taylor approximation of the function $\phi(x)$ implicitly defined such that $\phi(0)=1,\,F(x,\phi(x))=0$ for all $x$ near $0$. Today in school, during free time, I went through the horrendously tedious process (just because I really did have nothing better to do!) of deriving a $10$th order Maclaurin approximation.

My formula is this:

$$\phi(x)\approx1-x+\frac{2}{3}x^3+\frac{2}{3}x^4-\frac{10}{9}x^6-\frac{14}{9}x^7+\frac{274}{81}x^9+\frac{3118}{567}x^{10}$$

But WolframAlpha, which has the privilege of knowing the cubic formula, analytically solved for $x$ and gave the $10$th order Maclaurin expansion:

$$\phi(x)\approx1-x+\frac{2}{3}x^3+\frac{2}{3}x^4-\frac{10}{9}x^6-\frac{14}{9}x^7+\frac{274}{81}x^9+\frac{418}{81}x^{10}$$

I was pleased to find that my calculations had been correct up until the $10$th term; the numerical discrepancy in the $x^{10}$ coefficient is $\approx0.339$, which I suppose is significant in the range of small $x$, but the purpose of my question is this:

When I plot the approximation given by Wolfram, I find it is massively less accurate than my approximation, even though one should be able to assume Wolfram knows how to take $10$th derivatives more accurately than I do… What are the possible reasons for a more accurate (in terms of coefficients) Maclaurin series being significantly less accurate (in terms of the error $|F(x,\varphi(x))-0|$ where $\varphi$ is the truncated series)?

The graph I reference is here – ignore the irrelevant functions at the bottom.

The orange line at the bottom is the error from my approximation; the black line at the bottom is the error from Wolfram's approximation. You'll notice that the orange line is always relatively much closer to $0$ – how could this be the case? Surely Wolfram did not err?

Best Answer

The solution of the differential equation $$\tag{1}x^2=\phi^2(x)\cdot\phi'(x)+\phi(x)+x\cdot\phi'(x) \quad \text{with} \quad \phi(0)=1$$ is $$\phi(x)=\frac{\sqrt[3]{x^3+\sqrt{x^6+6 x^3+1}+1}}{\sqrt[3]{2}}-\frac{\sqrt[3]{2} x}{\sqrt[3]{x^3+\sqrt{x^6+6 x^3+1}+1}}$$ Expanded as a series around $x=0$ $$\phi(x)=\sum_{n=0}^\infty a_n\,x^n$$ the coefficients form the sequence $$\left\{1,-1,0,\frac{2}{3},\frac{2}{3},0,-\frac{10}{9},-\frac{14}{9},0,\frac{274}{81 },\frac{418}{81},0,-\frac{3058}{243},-\frac{4862}{243},0,\frac{37886}{729},\frac {61742}{729},0,-\frac{1502290}{6561}\right\}$$ which are the same as those given by @Will Jagy in comments.

Using the above expansion to $O\left(x^{19}\right)$, it is extremely good for $|x|\leq \frac 12$ and, over that range, the norm $$\Phi=\int_{-\frac 12}^{\frac 12} \Big[\phi(x)-\text{series}\Big]^2 \,dx=3.96 \times 10^{-9}$$

If we compute the norm $$\Phi_n=\int_{-\frac 12}^{\frac 12} \Big[\phi(x)-\text{series}_n\Big]^2 \,dx$$ $$\left( \begin{array}{cc} n & \log_{10}(\Phi_n) \\ 1,2 & -3.00952 \\ 3 & -4.00751 \\ 4,5 & -4.66992 \\ 6 & -5.41389 \\ 7,8 & -5.70164 \\ 9 & -6.38166 \\ 10,11 & -6.50545 \\ 12 & -7.15209 \\ 13,14 & -7.18720 \\ 15 & -7.81232 \\ 16,17 & -7.79253 \\ 18 & -8.40241 \\ 19,20 & -8.34550 \\ 21 & -8.94398 \\ 22,23 & -8.86038 \\ 24 & -9.45000 \\ 25,26 & -9.34632 \\ 27 & -9.92883 \\ 28,29 & -9.80953 \\ 30 & -10.3862 \end{array} \right)$$ there is a very strong impact of $n$ on the result.

Edit

Looking at the absolute value of the non-zero coefficients $a_n$, they grow exponentially (faster than $e^{\frac n 2}$).

If we compute

$$F(x,\phi(x))=x^3-\phi(x)^3-3x\phi(x)+1$$ Wolfram Alpha expansion gives $$F(x,\phi(x))=-\frac{3058 }{81}x^{12}+O\left(x^{13}\right)$$ while your gives $$F(x,\phi(x))=-\frac{64 }{63}x^{10}+O\left(x^{11}\right)$$ and I agree with you that for $|x|\leq \frac 12$ $$\frac{3058 }{81}x^{12} \geq \frac{64 }{63}x^{10} \quad \text{if}\quad |x| \geq \sqrt{\frac{288}{10703}}=0.164$$

Addendum

Not considering them as Taylor series, let $$\phi_1(x)=1-x+\frac{2}{3}x^3+\frac{2}{3}x^4-\frac{10}{9}x^6-\frac{14}{9}x^7+\frac{274}{81}x^9+\frac{418}{81}x^{10}$$ $$\phi_2(x)=1-x+\frac{2}{3}x^3+\frac{2}{3}x^4-\frac{10}{9}x^6-\frac{14}{9}x^7+\frac{274}{81}x^9+\frac{3118}{567}x^{10}$$

$$F_i=x^3-\phi_i(x)^3-3x\phi_i(x)+1$$ $$F_1-F_2=\frac{64 }{63}x^{10}\, P_{20}(x)$$ and $P_{20}(x)$ does not show any real root. Since its leading coefficient is positive $\Big[\frac{9135556}{321489}\Big]$, $F_1 \geq F_2 ~~\forall ~x$ and you are right !.

We could even play with $$\phi_3(x)=1-x+\frac{2}{3}x^3+\frac{2}{3}x^4-\frac{10}{9}x^6-\frac{14}{9}x^7+\frac{274}{81}x^9+\left(\frac{418}{81}+\epsilon\right)x^{10}$$ $$F_1-F_3=3x^{10}\,Q_{20}(x)\,\epsilon+3x^{20} \,R_{10}(x)\,\epsilon^2+x^{30}\, \epsilon^3$$ The two polynomials have positive leading coefficients and do not show any real root. So, if $\epsilon >0$, which is the case in your problem $(\epsilon=\frac{64}{189})$, $F_1 \geq F_3 ~~\forall ~x$

Related Question