2
$\begingroup$

I am a programmer (not a mathematicians), and I am encountering a problem in my software which, if possibly solved mathematically would save a lot of performance issues.

I have an array of arrays (A):

[0,0] [1,0][1,1] [2,0] [3,0][3,1],[3,2] [4,0][4,1] 

the notation [x,y] is exactly the kind of notation used by the system I am working on.

Besides I have another array (B) containing the same 'kind of ordered' objects but disposed at root level:

[0,0] formerly [0,0]  [0,1] formerly [1,0] [0,2] formerly [1,1] [0,3] formerly [2,0] [0,4] formerly [3,0] [0,5] formerly [3,1] ....... 

The problem I am facing is, given the A array index, how can I retrieve the index of the same element in B ? Which is, if my hypothetical function f(x,y) is accepting [2,0]

A-index = [2,0] 

I would like to have in return

B-index = [0,3] 

The instruments I have at hand are a function f(x) that return objects count in A at specific index, say:

f(2)=1 object count f(3)=3 objects count ... 

I also know the total number of object, in A and B which are the same.

I am posting here also because some suggested to use an integral, but honestly, I am a bit lost, and I do not have any instruments to verify this possible suggested solution.

Please feel free to correct the question in its syntax (especially the subject), or help me to rephrase in a more scientific way, and if you think this it's not a mathematical question, you can delete it anytime.

I did tried to search in forum, but due to my lack of knowledge I didn't manage to recognize a post with same problem.

1 Answers 1

0

Let $F$ denote the result of summing up $f$, i.e.

$ F(n)=\sum_{k=0}^{n-1}f(k)\;. $

Then the B-index for A-index $[i,j]$ is $[0,F(i)+j]$.