Mathematical notation programming looping for array element assignment, no summation or product

663 Views Asked by At

I am looking for the appropriate mathematical notation that will represent this code.

for(X = 0; X < ACA_Bin.size; X++) {
   ACA_CORRECTION[X] = ACA_Bin[X] + ACA_OFFSET
}

This is not a summation or product that would require a Sigma Notation

So is there an assignment Notation?

1

There are 1 best solutions below

3
On BEST ANSWER

If you write ACA_Correction and ACA_Bin as vectors, say x and y:

x = (x1, x2, ..., xN)

y = (y1, y2, ..., yN)

where xi is the ith element of x and yi is the ith element of y.

The loop could be represented as:

x = y + offset

where offset is ACA_OFFSET in your code.

You can think of x and y as collections of elements. 'x = y + offset' is simply saying 'x is the result of adding offset to every element in y'. This is equivalent to your loop.

You can find more about vector notation here.