[PYTHON MATRIX-SIG] printing complexes

P. Dubois dubois@kristen.llnl.gov
Fri, 3 Nov 1995 11:49:54 +0800

That was an excellent point you just made about str() and repr().
I think. I'm so new to Python I'm not sure which is which (:->

The reason I was worried about the precision being the same on the two sides
(and controllable) is simply the issue of making nice output where you
want things to line up for comparison. It is jarring if you have a list
and successive elements are all different in appearance, and it makes
it harder to make a nice table.

I didn't know about the J/APL2 convention, thanks for explaining it.

FYI, in Basis I don't have complex constants, just IMAGINARY ones. 
You do things like:

1i       = (   0.00000D+00,   1.00000D+00)
Basis> 3 + 2.5i
3+2.5i   = (   3.00000D+00,   2.50000D+00)

As you see, I use the Fortran printing convention which is, of course,
unacceptable in Python.  But in array printing I don't, I use spacing:

iota(10) + 2i
iota(10)+2i        shape: (10)
  1:        1.00000D+00,  2.00000D+00    2.00000D+00,  2.00000D+00
  3:        3.00000D+00,  2.00000D+00    4.00000D+00,  2.00000D+00
  5:        5.00000D+00,  2.00000D+00    6.00000D+00,  2.00000D+00
  7:        7.00000D+00,  2.00000D+00    8.00000D+00,  2.00000D+00
  9:        9.00000D+00,  2.00000D+00    1.00000D+01,  2.00000D+00

MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org