New answers tagged


This can be implemented, without needing to access the real and imaginary parts of $z$ individually, by writing $$\operatorname{Re}(z) + \operatorname{Im}(z) = \frac{(1 + i)(z^* - iz)}{2},$$ where $i$ is the imaginary unit and $z^*$ is complex conjugation. Factoring out a complex constant, $\xi = 1/2 + i/2$, turns this into a slightly tidier expression, $...

Top 50 recent answers are included