Product: product mul

### 6.40.27 Product: product mul

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

#### Product of values of an expression: product

The product command can find the product of the values of an expression as the variable changes.
Here, mul is a synonym for product.

- 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(exprx,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.

- Input:
  product(x^2+1,x,1,4)
  or:
  mul(x^2+1,x,1,4)
  Output:

  1700

  Indeed (12+1)·(22+1)·(32+1)·(42+1)=1700
- Input:
  product(x^2+1,x,1,5,2)
  or:
  mul(x^2+1,x,1,5,2)
  Output:

  520

  Indeed (12+1)·(32+1)·(52+1)=520

#### Product of elements of a list: product

The product command can find the products of elements of a list.
For this, mul is a synonym for product.

- 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 6.45.8.)

Examples.

- Input:
  product([2,3,4])
  or:
  mul([2,3,4])
  Output:

  24

- Input:
  product([[2,3,4],[5,6,7]])
  Output:

  ⎡ ⎣ | 10,18,28 | ⎤ ⎦

- Input:
  product([2,3,4],[5,6,7])
  or:
  mul([2,3,4],[5,6,7])
  Output:

  ⎡ ⎣ | 10,18,28 | ⎤ ⎦