# Why should these two functions approximate each other so well?

I am a physicist and during some of my research I realized that $\log_2 \sec(\pi x)$ is really well approximated by $\frac{6x^2}{1-x}$ for small but positive $x$. Is there any reason this should be so? After all the former function looks quite unwieldy on first sight. In particular, I am wondering whether there is some context in mathematics where these functions would arise, with the hope of understanding why they should agree so well. (Note that if I instead simply Taylor expand the former function and keep the leading term, it performs much more poorly.)

EDIT: Here is a plot from WolframAlpha: Note that at $x= \frac{1}{2}$, the former function has a singularity.

Edit: There were comments about the Taylor series and Padé approximants at $0$. The approximation is neither, and it is not exceptional at $0$, but it seems good on the interval $[0,1/3]$. • I do not see that this approximation is particularly good, nor is any reason given here. – Michael Renardy May 9 '17 at 0:26
• @MichaelRenardy Fair enough, I have added a plot to illustrate the point. – Ruben Verresen May 9 '17 at 0:33
• I don't understand the reason for the close votes. Isn't it a genuine question to ask why I can approximate such a complicated function by such a simple function, considering that the answer is not just a simple consequence of Taylor expansion? – Ruben Verresen May 9 '17 at 0:38
• I retracted my close vote. I thought this would just be a Padé approximant, but it is not the degree-$(2,1)$ approximant $\frac{\pi^2 x^2}{2 \log 2}$. Instead, this reminds me of a least-squares approximation with respect to some measure, which is not the closest possible at $0$ but which stays small for a long time. – Douglas Zare May 9 '17 at 0:41
• @T.Amdeberhan: Yes, you can read that from the Taylor series which disagree on the second term, $6x^2$ vs. $7.12x^2$. – Douglas Zare May 9 '17 at 1:06

A somewhat better rational approximation for your function with the same degrees of numerator and denominator on the interval $[0, 0.35]$ is $$\frac{-0.003425070267307+(.24505402726368+6.15039272385520 x) x}{1.26465060967883-1.51228919816475 x}$$ (obtained using the Remez algorithm in Maple). Here is a plot of the differences between $\log_2(\sec(\pi x))$ and these approximations (mine in red, yours in blue). • Remez minimizes the supremum of the difference, right? Is there something similar that would let you set the difference to be $0$ at $0$ and $1/3$ and minimize the integral of the square of the differences with respect to some measure? – Douglas Zare May 9 '17 at 1:10