Next: ptoc, Previous: projectmap, Up: Internal Routines [Contents][Index]

`psum(`

`data`, `powers` [, `axes`, `class`, /onedim,
/vnormalize, /cnormalize, /single]

Returns a weighted sum of

. The weights are equal to
the coordinates in the dimensions given in `data`

to the
integer powers given in `axes`

. `powers`

and
`powers`

may be scalars or arrays and must have the same number
of elements. If `axes`

is not specified, then
`axes``indgen(`

is assumed. If `powers`)

is
defined, then it must contain a class number for each element of
`class`

and the results will be gathered for each class
separately. Keyword `data``/onedim`

indicates that

should be treated as a 1d array. Keyword `data``/vnormalize`

forces
normalization with the total of the values for each result, and keyword
`/cnormalize`

with the total of the coordinate weights for each
results. Keyword `/single`

returns a single (weighted) sum - if

was not specified. All calculations are performed in
double precision and the result has data type `axis``double`

.

If `w = indgen(data, 0)`

then `psum(data, n, 0)`

is equal to
`total(data*w^n,0)`

, and `psum(data, n, 1, /cnormalize`

is
equal to `total(data*w^n)/total(w^n)`

.