percentChange#

swordfish.function.percentChange()#

For each element Xi in X, return (Xi / Xi-n) - 1, representing the percentage changes between elements.

Parameters:
  • X (Constant) – A vector or matrix.

  • n (Constant, optional) – An integer specifying the step to shift when comparing elements in X. The default value is 1, meaning to compare the current element with the adjacent element at left.

Returns:

A vector or matrix with the same shape as X.

Return type:

Constant