HP Forums
Suggestion: improve readability of complex numbers with negative imaginary - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Suggestion: improve readability of complex numbers with negative imaginary (/thread-2721.html)



Suggestion: improve readability of complex numbers with negative imaginary - Snorre - 12-28-2014 07:06 PM

Hello,

Sometimes I prefer complex numbers displayed as a+bi if (a,b) becomes hard to read because of too many parentheses already within an expression -- e.g. f(g((u,v)),h(w,x),(y,z)) vs f(g(u+vi),h(w,x),y+zi).

The negative sign is quite hard to distinguish from the subtraction minus.
This can lead to some confusion if a literal complex number with negative imaginary part occurs as a factor in some bigger expression.
[attachment=1366]
In this screenshot you can see in the first two lines that square operator has higher precedence to negation -- which I'm fine with.
The next two lines show results with literal complex numbers -- no problem here.
But the last two lines are quite confusing because you've to recognize the dash in front of the imaginary part as a negation sign (not a subtraction) to read this as (-7,-22)*a.
Despite the readability problem this seems contradictionary to the precedence rules (as in first two lines) where a negation is weak.
And finally, the CAS itself exchanges subtraction and negation signs quite arbitrarily, which would be no problem as long there wasn't this little exceptional case where the sign-type becomes semantically important.

I'd suggest that complex numbers as factors should always be enclosed in parentheses, i.e. (-7−22*i)*a or -(7+22*i)*a instead of -7-22*i*a.