How to define this function so that it is continuous?

I have a function $$f(x)=\frac{\arctan(2 \tan (x))}{x}$$

or in general for some $$c\in \mathbb{R}$$ $$f(x)=\frac{\arctan(c \tan (x))}{x}$$

Is there a way to define it so that it is continuous on interval $$0\le x \le 2\pi$$ avoiding piecewise definition?

Here is the plot of it:

But if I plot all instances of multivalued function $$\tan ^{-1}(x)=\{\arctan(x)+\pi k\mid k\in \mathbb {Z} \}$$ I get this:

I want the definition of the middle orange-green-blue-red-violet curve.

• @Math Attack: Can you she me that representation? Is the series convergent on $0\le x \le 2\pi$? Commented Nov 24, 2023 at 12:43
• Try representing $y = \arctan(2 \tan x)$ in that fashion first. It is simpler and your function can be obtained just by dividing by $x$. Depending on the representation, this might still leave you with an anomaly at $0$, but even so, that is a relavitely trivial issue. The Taylor series for $y$ at $0$ can be obtained implicitly from $\tan y = 2\tan x$, but is very likely to have radius of convergence of $\frac\pi 2$. Commented Nov 25, 2023 at 15:25

Maybe better to leave it in its original implicit form, so that the range is continuous.

Converted to its implicit function $$\tan (x~y)= 2~\tan(x)$$ and directly plotted on ContourPlot on Mathematica.

However transitions at domain points

$$\pm (\pi/2,3\pi/2,...)$$

are still discontinuous.

In other CASs, $$~atan2(...)~$$is available

The question is about the simplest value for the multi-valued function

$$y = f(x) := \text{arctan}(2\tan(x))/x. \tag1$$

A natural place to start is to define the two-variable function

$$g(x, y) = \tan(x\,y)-2\tan(x) \tag2$$

so that

$$0 = g(x, f(x)). \tag3$$

Notice that $$\,f(0) = 2\,$$ and that $$\,f(n\pi/2) = 0\,$$ for all integer $$\,n.\,$$

The power series expansions centered at the multiples of $$\,\pi/2\,$$ can be found using equation $$(3)$$ and the method of undetermined coefficients.

Some examples:

$$f(x) = 2 - 2x^2 + 4x^4 - \frac{142}{15}x^6 + \frac{4612}{189}x^8 - \frac{312644}{4725}x^{10} + \dots. \tag4$$

\begin{align*} f\Big(\frac{\pi}2(1+x)\Big) &= 1 - \frac{1-x}2\Big(x + (1-p)x^3 + (1-p-p^2)x^5 \\ &+\Big(1-p-p^2 -\frac{11}{15}p^3\Big)x^7 + \Big(1-p-p^2-\frac{11}{15}p^3-\frac{25}{189}p^4\Big)x^9 +\dots\Big) \tag5 \end{align*}

where $$\,p := (\pi/4)^2.\,$$

\begin{align*} f(\pi(1+x)) &= 1 + (1-x)\Big(x + (1-2p)x^3 +(1-2p+4p^2)x^5 \\ &+\Big(1-2p+4p^2-\frac{142}{15}p^3\Big)x^7 +\Big(1-2p+4p^2-\frac{142}{15}p^3+\frac{4612}{189}\Big)x^9 \dots\Big) \tag6 \end{align*}

where $$\,p := \pi^2.\,$$

The series expansions for other multiples of $$\,\pi/2\,$$ are very similar. For example the series expansion for $$\,3\pi/2\,$$ is the same as equation $$(5)$$ with $$\,p := (3\pi/4)^2.\,$$ This is due to the period $$\,\pi\,$$ for the tangent function.

By the way, a Wolfram Mathematica nice plot of the implicit equation is

ContourPlot[ Tan[x*y] == 2*Tan[x], {x, -8, 8}, {y, .8, 2.1},
PlotPoints->100, MaxRecursion->3, AspectRatio->1/5]


I found a definition with floor function that makes the function continuous on entire real line, but this definition is only disguise of a piecewise definition.

$$f(x)=\frac{\arctan(2 \tan (x))+\pi \lfloor \frac{x}{\pi }+\frac{1}{2}\rfloor}{x}$$

For $$x=0$$ and $$x=(2 k+1) \frac{\pi}{2}$$ a limit should be used.

$$\underset{x\to 0}{\text{lim}}f(x)=2$$ $$\underset{x\to (2 k+1) \frac{\pi}{2}}{\text{lim}}f(x)=1$$