Find the limit of the complex function.

\begin{align*} \log\left(2-\frac{x}{a}\right)^{\tan(\pi x/2a)}&=\left(\tan\frac{\pi x}{2a}\right)\left(\log\left(2-\frac{x}{a}\right)\right)\\ &=\sin\left(\frac{\pi x}{2a}\right)\frac{\log\left(1+\left(1-\dfrac{x}{a}\right)\right)}{\cos\left(\dfrac{\pi}{2}\left(\dfrac{x}{a}-1\right)+\dfrac{\pi}{2}\right)}\\ &=\sin\left(\frac{\pi x}{2a}\right)\frac{\left(1-\dfrac{x}{a}\right)-\dfrac{1}{2}\left(1-\dfrac{x}{a}\right)^{2}+\cdots}{\dfrac{\pi}{2}\left(1-\dfrac{x}{a}\right)-\dfrac{1}{3!}\left(\dfrac{\pi}{2}\left(1-\dfrac{x}{a}\right)\right)^{3}+\cdots}\\ &=\sin\left(\frac{\pi x}{2a}\right)\frac{1-\dfrac{1}{2}\left(1-\dfrac{x}{a}\right)+\cdots}{\dfrac{\pi}{2}-\dfrac{1}{3!}\left(\dfrac{\pi}{2}\right)^{3}\left(1-\dfrac{x}{a}\right)^{2}+\cdots}, \end{align*} taking limit as $x\rightarrow a$, then $\log\left(2-\dfrac{x}{a}\right)^{\tan(\pi x/2a)}\rightarrow\dfrac{2}{\pi}$.


$$ \lim_{x\to a} \left(2- \frac{x}{a}\right)^{\tan \frac{\pi x}{2a}}= \lim_{x\to a} \left(1+1- \frac{x}{a}\right)^{\frac{1}{1-\frac{x}{a}}\cdot\left(1-\frac{x}{a}\right)\tan \frac{\pi x-\pi a+\pi a}{2a}}=$$ $$=e^{\frac{2}{\pi}\lim\limits_{x\rightarrow a}\left(\frac{\frac{\pi}{2a}(a-x)}{\sin\frac{\pi}{2a}(a-x)}\cdot\cos\frac{\pi}{2a}(a-x)\right)}=e^{\frac{2}{\pi}}.$$


Suppose $y \triangleq \frac{\pi x}{2a}$. Then, we have

$$\lim_{t \rightarrow \pi/2} \tan(y) (1-\frac{2y}{\pi})$$

Then, using the Taylor series expansion and simple manipulations we have:

$$\lim_{t \rightarrow \pi/2} \frac{1}{\pi} \Big(-\frac{1}{y-\pi/2}+\frac{1}{3}(y-\pi/2) + \ldots \Big)(\pi - 2y)= \frac{2}{\pi}.$$

Then: $$ \lim_{x\to a} \left(2- \frac{x}{a}\right)^{\left(\tan \frac{\pi x}{2a}\right)} = e^{\frac{2}{\pi}}$$