Post Reply 
Suggestion: improve readability of complex numbers with negative imaginary
12-28-2014, 07:06 PM (This post was last modified: 12-28-2014 07:33 PM by Snorre.)
Post: #1
Suggestion: improve readability of complex numbers with negative imaginary

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.
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.
Find all posts by this user
Quote this message in a reply
Post Reply 

User(s) browsing this thread: 1 Guest(s)