Alignment arithmetic operations

Description:

Generate a new sequence by performing Arithmetic Operations, Mod operation or integer division between members in the same position in two sequences which are of the same length, such as alignment addition, alignment subtraction, alignment multiplication, and so on.

Syntax:

A++B

[A(1)+B(1),A(2)+B(2),…], alignment addition

A--B

[A(1)-B(1),A(2)-B(2),…], alignment subtraction

A**B

[A(1)*B(1),A(2)*B(2),…], alignment multiplication

A//B

[A(1)/B(1),A(2)/B(2),…], alignment division

A%%B

[A(1)%B(1),A(2)%B(2),…], mod operation

A\\B

[A(1)\B(1),A(2)\B(2),…], integer division

Note:

Alignment Arithmetic Operations are performed between members in the same position in two sequences A and B, and thus generate new members for the new sequence. For example, A++B indicates [A(1)+B(1),A(2)+B(2),…].

Parameters:

A

An integer sequence

B

An integer sequence

Return value:

A new sequence created through alignment arithmetic operations

Example:

 

A

 

1

=[4,2,3,3]++[5,10,2,1]

[9,12,5,4]

2

=[4,2,3,3]--[5,10,2,1]

[-1,-8,1,2]

3

=[4,2,3,3]**[5,10,2,1]

[20,20,6,3]

4

=[4,2,3,3]//[5,10,2,1]

[0.8,0,2,1.5,3.0]

5

=[7,12,3,3]%%[5,10,2,1]

[2,2,1,0]

6

=[7,12,3,3]\\[5,10,2,1]

[1,1,1,3]

Related functions:

Difference between sequences

Intersection of sequences

Union of sequences

Multiplication of sequences

Concatenation of sequences

cmp()