Contents Previous Next Subchapters Current Chapters-> prctile ftail tpdf ttail ittail cnormal inormal rand snormal seed colmad colmse colrange colmode kurtosis skewness randperm ranseed unifm0v1 unirnd normrnd exprnd gamrnd cauchyrnd gumbelrnd laplacernd lognrnd wblrnd binornd poissrnd exppdf expcdf normpdf unifpdf unifcdf wblpdf wblcdf colcor colcov colmean colstd colmax rowmax colsum rowsum colnorm rownorm median colmedian colmead colvar corr conv conv2 sum cumsum prod cumprod Parent Chapters-> Omatrix6 statistics prod Search Tools-> contents reference index search

Product of Elements of a Matrix
 Syntax p` = prod(`x`)` p` = prod(`x`, `d`)` See Also cumprod , cumsum , rowsum , colsum , sum , colrange

Description
Returns the product of the elements of the matrix x where x is an integer, real, double-precision or complex matrix and p has the same type as x.

Vectors
If x is a vector, p is a scalar and ```      p = x  * x  * ... * x           1    2          n ```where `n` is the number of elements in x. If you enter ```      x = [ 1, 2, 3 ]      prod(x) ``` O-Matrix will respond ```      6 ``` If you enter ```      x = { 1, 2, 3 }      prod(x) ``` O-Matrix will respond ```      6 ```
Matrices
If x is not a vector, p is a row vector with the same column dimension as x and ```      p  =  x    * x     * ... * x       j     1,j    2,j           m,j ```where `m` is the number of rows in the matrix x. If you enter ```      x = { [ 1, 2, 3 ], [3, 4, 5] }      prod(x) ``` O-Matrix will respond ```      {      [ 3 , 8 , 15 ]      } ```
Dimension
If the argument d is present, it specifies which dimension the product is taken with respect to. It must be an integer, real, or double-precision scalar equal to 1 or 2. If you enter ```      x = { [ 1, 2, 3 ], [3, 4, 5] }      prod(x, 2) ``` O-Matrix will respond ```      {      6      60      } ```