product

From DavinciWiki
Jump to: navigation, search

Description

Product of array elements

Arguments and Return Values

Arguments: One numeric array

Return Value: The product of all elements in that array

Usage

Syntax: product(X)

If any element in the array is zero, the product will be zero, but the function will not warn you.

Currently there is no option to take the product by row, by column, or anything else like that, so the size of the array doesn't matter. It returns the product of everything in the array.

Returned format is double if input is double; float otherwise.

If no arguments are input, product() prints its description, as shown below.

Examples

dv> product()

Computes product of all elements in an array
S.Marshall 10-27-2009

0
dv> a = create(3, 2, start=1)
3x2x1 array of int, bsq format [24 bytes]
1       2       3
4       5       6
dv> product(a)
720.000000000000
dv> a = create(2, 3, start=1)
2x3x1 array of int, bsq format [24 bytes]
1       2
3       4
5       6
dv> product(a)
720.000000000000

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Major Sub-Functions

Related Functions

Recent Library Changes

Created On: 11-18-2009
Modified On: 11-19-2009

Personal tools