Function for cosine transformation around $\pi/2$ Given the cosine of an angle $x$ relatively close to $\pi/2$, is there a function $f$ such as: $f(cos(x))=cos((x+\pi/2)/2)$ ?

It seems like you just want a function $f$ so that $f(\cos(x))=\cos((x+\pi/2)/2)$ for $x$ close to $\pi/2$. First do the following using trigonometric identities:
$$
f(\cos(x)) = \cos\left(\frac{x}{2} + \frac{\pi}{4}\right) = \cos\left(\frac{x}{2}\right)\cos\left(\frac{\pi}{4}\right) - \sin\left(\frac{x}{2}\right)\sin\left(\frac{\pi}{4}\right) \\
f(\cos(x)) = \frac{1}{\sqrt{2}}\cos\left(\frac{x}{2}\right) - \frac{1}{\sqrt{2}}\sin\left(\frac{x}{2}\right)
$$
So if we can write $\cos(x/2)$ and $\sin(x/2)$ in terms of $\cos(x)$, then we can write $f$ explicitly. But this is simple remembering the half angle formula (or we can just derive it using the cosine double angle formula since I don't remember the half angle one hehe) For $\cos$, we have
$$
\cos(2x) = 2\cos^2(x) - 1 \implies \cos(x) = 2\cos^2\left(\frac{x}{2}\right) - 1 \implies \cos\left(\frac{x}{2}\right) = \sqrt{\frac{1 + \cos(x)}{2}}
$$ taking the positive root since $\cos(x/2)$ is positive assuming $x$ is close to $\pi/2$. For $\sin$, we have
$$
\cos(2x) = 1- 2\sin^2(x) \implies \cos(x) = 1 - 2\sin^2\left(\frac{x}{2}\right) \implies \sin\left(\frac{x}{2}\right) = \sqrt{\frac{1 -\cos(x)}{2}}
$$ since $\sin(x/2)$ is positive for $x$ near $\pi/2$. So, going back to the actual function, we have
$$
f(\cos(x)) = \frac{1}{\sqrt{2}}\sqrt{\frac{1 + \cos(x)}{2}} - \frac{1}{\sqrt{2}}\sqrt{\frac{1 -\cos(x)}{2}} = \frac{1}{2}\sqrt{1 + \cos(x)} - \frac{1}{2}\sqrt{1 - \cos(x)}
$$
So now we can just replace $\cos(x)$ with $u$ to get
$$
f(u) = \frac{1}{2}\sqrt{1 + u} - \frac{1}{2}\sqrt{1 - u}
$$
