On 12/15/10 7:16 AM, liji.ma...@gmail.com wrote:
Hi Sage group:
I have met a problem.
The code is as follow.
import numpy as np
A = np.mat([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
print A[:, 1].shape
for i in range(0, 3):
print A[:, i].shape
the result is
(1, 3)
(3, 1)
(3, 1)
(3, 1)
Is there any difference between "print A[:, 1]" and "print A[:, i]"?
A[:,i] gives back the ith column. A[:,1] gives back the column with
index 1 (i.e., the second column, since the columns are numbered
starting with zero). We support the same syntax for Sage matrices [1].
I'd point you to the numpy documentation (you might try typing "numpy
tutorial" in google), but scipy.org (where the tutorial is located)
seems to be down at the moment.
Thanks,
Jason
[1] http://sagemath.org/doc/reference/sage/matrix/docs.html#indexing
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org