Commits

Matthew Turk committed a8809ea

Thanks to nscudder for pointing out an extra sum() here!

Comments (0)

Files changed (1)

source/orientation/first_steps.rst

 sphere do not have to be in memory.  For instance, to calculate the center of
 mass, one could imagine doing something like this::
 
-   >>> M_i = my_sphere["CellMassMsun"].sum()
+   >>> M_i = my_sphere["CellMassMsun"]
    >>> M = M_i.sum()
-   >>> com_x = (my_sphere["x"] * M_i)/M
-   >>> com_y = (my_sphere["y"] * M_i)/M
-   >>> com_z = (my_sphere["z"] * M_i)/M
+   >>> com_x = (my_sphere["x"] * M_i).sum()/M
+   >>> com_y = (my_sphere["y"] * M_i).sum()/M
+   >>> com_z = (my_sphere["z"] * M_i).sum()/M
 
 But for this to work, all of the arrays listed would have to be held in memory,
 even though the algorithm operates on each element individually.  Clearly, the