intprod

From DavinciWiki
Jump to: navigation, search

Description

Product of consecutive integers

Arguments and Return Values

Arguments: Two scalar numeric inputs

Return Value: The product of all integers between the two inputs (inclusive)

Usage

Syntax: intprod(a, b)

intprod(1, n) = fact(n)

If the first input is negative and the second is positive, the product will be zero (since the range includes zero), but the function will not warn you.

The function finds an upper boundary for the product by taking double(b)^(b - a + 1). If the value of that upper limit is less than intmax (2,147,483,647), the returned value will be integer format. If it is greater, the returned value will be double format.

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

Examples

dv> intprod()

Returns product of consecutive integers
intprod(a, b) returns product of integers a through b (inclusive)
 Both inputs must be scalar (1x1x1).
S.Marshall 11-18-2009

0
dv> intprod(1, 7)
5040
dv> intprod(-1, 7)
0
dv> intprod(1, 6//7)

Error! Both inputs must be scalar.

0
dv> intprod(133, 138)
6186268559520.00

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-18-2009

Personal tools