Inserts an operator between every observation of a series, evaluating it to an expression and reducing it to a scalar.

REDUCE(series, "op", opcode)

series |
- |
Any series, table, or expression resulting in a series or table. |

"op" |
- |
Optional. A string, the binary operator in quotes. |

opcode |
- |
Optional. An integer, the binary operator function code. |

A scalar.

reduce({2, 4, 6}, "*")

expands to the expression 2*4*6, which evaluates to the scalar result 48.

reduce({2, 4, 6}, "+")

expands to the expression 2+4+6 which evaluates to the scalar result 12.

reduce({2, 4, 6}, 1)

returns 12.

Binary operators include the arithmetic and logical operators. The logical "Exclusive OR" operator is represented by the string "XOR".

The function also accepts an explicit function code instead of an operator string. Either an operator string or function code must be supplied.

The following function codes are supported:

Code |
Operator |
Function |
Description |

1 |
+ |
ADD |
add |

2 |
- |
SUB |
subtract |

3 |
* |
MULT |
multiply |

4 |
/ |
DIV |
divide |

5 |
^ |
POW |
raise to power |

6 |
> |
GREATER |
greater than |

7 |
< |
LESS |
less than |

8 |
>= |
GREATEREQ |
greater or equal to |

9 |
<= |
LESSEREQ |
less or equal to |

10 |
== |
EQUAL |
equal to |

11 |
!= |
NOTEQUAL |
not equal to |

12 |
&& |
AND |
logical and |

13 |
|| |
OR |
logical or |

14 |
XOR |
XOR |
logical exclusive or |

15 |
FLIPFLOP |
FLIPFLOP |
dual pad flipflop |

16 |
ATAN2 |
ATAN2 |
inverse tangent |

17 |
& |
BITAND |
bit and |

18 |
<< |
BITLSHIFT |
bit left shift |

19 |
>> |
BITRSHIFT |
bit right shift |

20 |
|+ |
BITOR |
bit or |

21 |
% |
MOD |
modulo |

22 |
|^ |
BITXOR |
bit exclusive or |

23 |
~ |
BITCOMP |
bit complement |

24 |
MAKECART |
MAKECART |
convert to Cartesian form |

25 |
MAKEPOLAR |
MAKEPOLAR |
convert to polar form |

26 |
MAX |
MAX |
maximum |

27 |
MIN |
MIN |
minimum |

&& || ! AND OR NOT XOR (Logical Operators)