I am not sure if this is on-topic here, but I am trying.
Let $x,y$ be positive real numbers. I am trying to find $$ \min_{\sqrt{a}+\sqrt{b}=\sqrt{2}}(x-a)^2+(y-b)^2$$
I tried using Mathematica for this, by running
Minimize[{(x - a)^2 + (y - b)^2, Sqrt[a] + Sqrt[b] == Sqrt[2]}, {a,
b}]
but the computation didn't terminate. I am not experienced in using computational software tools. What are good suggestions to handle this problem? (e.g. Will Python be a good choice here? what should I try?).
I guess approximations for the optimum will also be interesting for me.
It seems that to solving this problem analytically won't be feasible.
Comment:
I am not sure if it matters, but in my case I also know that $x,y$ satisfy $xy \le \frac{1}{4}$. Since, $\sqrt{a}+\sqrt{b}=\sqrt{2}$, the arithmetic-geometric inequality implies that $ab \le \frac{1}{4}$. Maybe these facts can be used here somehow, I am not sure.