Solution (source code)

= Solution

Multiply numerator and denominator by the <complex conjugate> of the denominator:
$$
\frac{2+i}{-1+i}=\frac{(2+i)(-1-i)}2=\frac{-1-3i}{2}.
$$
Squaring gives $(-1-3i)^2/4=(-8+6i)/4$. Thus the <real part> and <imaginary part> are
$$
\boxed{\Re z=-2,\qquad\Im z=\frac32.}
$$