### 6.3.27 Products

The product command can find the products of elements of an expression (see Section 6.3.27), the elements of a list (see Section 6.3.27), the elements of the columns of a matrix (see Section 14.3.6), and the term-by-term (Hadamard) product of two matrices (see Section 14.3.8).

##### Product of values of an expression.

The product or mul command can find the product of the values of an expression as the variable changes.

- product takes four mandatory arguments and one optional argument:
  - expr, an expression.
  - x, the name of a variable.
  - a and b, real numbers.
  - Optionally p, a real number representing a step size. (By default p=1).
- product(expr x,a,b⟨ p ⟩) returns the product of the values of expr as x goes from a to b in steps of p.

  This syntax is for compatibility with Maple.

#### Examples

product(x^2+1,x,1,4)

or:

mul(x^2+1,x,1,4)

1700 |  |  |  |  |  |  |  |  |  |

Indeed, (12+1)(22+1)(32+1)(42+1)=1700.

product(x^2+1,x,1,5,2)

or:

mul(x^2+1,x,1,5,2)

520 |  |  |  |  |  |  |  |  |  |

Indeed, (12+1)(32+1)(52+1)=520.

##### Product of elements of a list.

The product or mul command can find the products of elements of a list.

- product takes one mandatory and one optional argument:
  - L, a list of numbers.
  - Optionally, L2, another list of numbers the same length as L.
- product(L) returns the product of the elements of L.
- product(L,L2) returns the term by term product of the elements of L and L2.

(See also Section 14.3.8.)

#### Examples

product([2,3,4])

or:

mul([2,3,4])

24 |  |  |  |  |  |  |  |  |  |

product([[2,3,4],[5,6,7]])

| ⎡ ⎣ | 10,18,28 | ⎤ ⎦

product([2,3,4],[5,6,7])

or:

mul([2,3,4],[5,6,7])

| ⎡ ⎣ | 10,18,28 | ⎤ ⎦