Product : product mul

### 2.37.31 Product : `product mul`

See also 2.37.31, 2.42.6 and 2.42.8).

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

`product(expr,var,a,b,p)` or `mul(expr,var,a,b,p)` returns the product of values of an expression `ex` when the variable `var` goes from `a` to `b` with a step `p` (by default p=1) : this syntax is for compatiblity with Maple.
Input :

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

Or:

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

Output :

`1700`

Indeed 2*5*10*17=1700
Input :

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

Or:

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

Output :

`520`

Indeed 2*10*26=520

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

`product` or `mul` takes as argument a list `l` of reals (or floating numbers) or two lists of the same size (see also 2.37.31, 2.42.6 and 2.42.8).

- if `product` or `mul` has a list `l` as argument, `product` or `mul` returns the product of the elements of `l`.
  Input :
  `product([2,3,4])`
  Input :
  `mul([2,3,4])`
  Output :
  `24`
  Input :
  `product([[2,3,4],[5,6,7]])`
  Output :
  `[10,18,28]`
- if `product` or `mul` takes as arguments `l1` and `l2` (two lists or two matrices), `product` or `mul` returns the term by term product of the elements of `l1` and `l2`.
  Input :
  `product([2,3,4],[5,6,7])`
  Or :
  `mul([2,3,4],[5,6,7])`
  Output :
  `[10,18,28]`
  Input :
  `product([[2,3,4],[5,6,7]],[[2,3,4],[5,6,7]])`
  Or :
  `mul([[2,3,4],[5,6,7]],[[2,3,4],[5,6,7]])`
  Output :
  `[[4,9,16],[25,36,49]]`