@sym
: cumprod (x) ¶@sym
: cumprod (x, dim) ¶Cumulative product over the rows or columns of a symbolic array.
If dim is omitted, it defaults to the first non-singleton dimension. For example:
Examples:
t = sym ('t'); Pi = sym ('pi'); T = [t; t + Pi / 2; t + Pi; t + 3 * Pi / 2; t + 2 * Pi]; C = cos (T); cumprod (C) ⇒ (sym 5×1 matrix) ⎡ cos(t) ⎤ ⎢ ⎥ ⎢-sin(t)⋅cos(t) ⎥ ⎢ ⎥ ⎢ 2 ⎥ ⎢sin(t)⋅cos (t) ⎥ ⎢ ⎥ ⎢ 2 2 ⎥ ⎢sin (t)⋅cos (t)⎥ ⎢ ⎥ ⎢ 2 3 ⎥ ⎣sin (t)⋅cos (t)⎦
Specify dimension along which to compute the product:
X = repmat (sym ('x'), 2, 3 ); cumprod (X, 1) ⇒ (sym 2×3 matrix) ⎡x x x ⎤ ⎢ ⎥ ⎢ 2 2 2⎥ ⎣x x x ⎦ cumprod (X, 2) ⇒ (sym 2×3 matrix) ⎡ 2 3⎤ ⎢x x x ⎥ ⎢ ⎥ ⎢ 2 3⎥ ⎣x x x ⎦
See also: @sym/prod, @sym/cumsum.
Package: symbolic