Why does this function involving trigonometric functions produce $f(10^{-2n})\approx \{10^n, 0<n<8 \text{ and } \sqrt{2}\cdot 10^n,n\geq 8\}$?

74 Views Asked by At

Why does the function $$f(\gamma)=\sqrt{2}\left[\ln\left( 1+ \frac{2}{\cot (\gamma/2)-1} \right) + \sec \gamma \tan \gamma\right]^{-1/2}$$ produce $$f(10^{-2n})\approx \cases{10^n \hspace{1.35cm} , \; 0<n<8 \\ \sqrt{2}\cdot10^n \quad , \; n\geq 8} \quad ?$$

I stumbled upon this by accident, and I cannot for the life of me figure out what would produce such a behavior!

Here are some results from Mathematica:

In = Table[N[f[10^(-2 n)]], {n, 1, 20}]
Out = {9.99975, 100., 1000., 10000., 100000., 999978., 1.0002*10^7, 
1.41421*10^8, 1.41421*10^9, 1.41421*10^10, 1.41421*10^11, 
1.41421*10^12, 1.41421*10^13, 1.41421*10^14, 1.41421*10^15, 
1.41421*10^16, 1.41421*10^17, 1.41421*10^18, 1.41421*10^19, 
1.41421*10^20}

This clearly shows the "transition" of the coefficients $1 \rightarrow \sqrt{2}$. The ratio between consecutive terms seems to stabilize (the exception being that pesky sixth to last $4.59372$), so it behaves somewhat exponentially for $\gamma \rightarrow 0$:

In = Table[N[f[10^(-(n + 1))]/f[10^(-n)]], {n, 1, 20}]
Out = {3.17014, 3.16236, 3.16228, 3.16228, 3.16228, 3.16228, 3.16228, \
3.16228, 3.16228, 3.16228, 3.16221, 3.16298, 3.16228, 3.07797, \
4.59372, 3.16228, 3.16228, 3.16228, 3.16228, 3.16228}

Thanks!

EDIT: Here is the syntax for f[x_], as requested:

f[t_] = Sqrt[2/(Log[1 + 2/(-1 + Cot[t/2])] + Sin[t]/Cos[t]^2)]
2

There are 2 best solutions below

0
On BEST ANSWER

As told, I went to university and a former colleague of mine compared

 f[t_] = Sqrt[2/(Log[1 + 2/(-1 + Cot[t/2])] + Sin[t]/Cos[t]^2)]
 data1 = Table[N[f[10^(-2 n)]], {n, 1, 50}]
 data2 = Table[N[f[10^(-2 n)],6], {n, 1, 50}]

The first data contains your surprizing results while the second one does not and produced the expected result which correspond to $$f(t)=\frac 1{\sqrt t}-\frac 14 t^{3/2}+ O(t^{7/2})$$ $$f(10^{-2n})\approx10^n$$

Similarly, using

 Table[N[f[10^(-(n + 1))]/f[10^(-n)],6], {n, 1, 20}] 

generates the correct numbers.

7
On

Because $\ln\left( 1+ \frac{2}{\cot (\gamma/2)-1} \right)$ is computed as $\ln(1)=0$ in floating point for larger $n$. Use the function $\mathrm{ln1p}$ or $\mathrm{log1p}$ if available. If not write your own function $\ln(1+x)$, see e.g. Theorem 4 in D. Goldberg, What Every Computer Scientist Should Know About Floating-Point Arithmetic, 1991 (extended and edited reprint via http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.22.6768)