Determine all complex numbers $w$ such that

$$
10|w|^{2}=2|w+2|^{2}+\left|w^{2}+1\right|^{2}+20 .
$$
Let $w=a+b i$, where $a$ and $b$ are real. The equation becomes

$$
\begin{aligned}
10\left(a^{2}+b^{2}\right) & =2\left[(a+2)^{2}+b^{2}\right]+\left(a^{2}-b^{2}+1\right)^{2}+(2 a b)^{2}+20 \\
& =2 a^{2}+8 a+8+2 b^{2}+\left(a^{4}-2 a^{2} b^{2}+b^{4}\right)+2\left(a^{2}-b^{2}\right)+1+4 a^{2} b^{2}+20 \\
& =4 a^{2}+8 a+\left(a^{2}+b^{2}\right)^{2}+29 .
\end{aligned}
$$

If we set $r=a^{2}+b^{2}$, this becomes

$$
r^{2}-10 r+4 a^{2}+8 a+29=(r-5)^{2}+4(a+1)^{2}=0 .
$$

The only way we get equality is if $r=5$ and $a=-1$, which means $b= \pm 2$. Thus the solutions are $w=-1 \pm 2 i$.