About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/sum.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 sum Context: slangrtl

Synopsis

Sum over the elements of an array

Syntax

result = sum (Array_Type a [, Int_Type dim])

Description

The sum function sums over the elements of a numeric array and returns its result. If a second argument is given, then it specifies the dimension of the array to be summed over. In this case, an array of dimension one less than that of the input array will be returned.

If the input array is an integer type, then the resulting value will be a Double_Type. If the input array is a Float_Type, then the result will be a Float_Type.

Example

The mean of an array a of numbers is

    sum(a)/length(a)
Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.