Infer function from 3d plot

49 Views Asked by At

So, I'm trying to find the function that produces this plot.
I have all the points available but I'm not sure how can I utilise them to infer the function if I don't even know the form of the function.
Here is the plot

[Edit] The dataset is generated by applying the xor operation onto a mxn matrix (e.g. row=2, column=2 maps to 2 xor 2 onto the corresponding matrix) and then getting the sum of the xor generated matrix. I run experiments with random mxn matrices and then I get the sum for each generated matrix.

[Edit]

Code that generates the dataset:
import numpy as np
import pandas as pd

def xor_calc(m,n):
    xor = np.zeros([n,m]).astype(int)
    for i in range(n):
        for j in range(m):
            xor[i][j] = i^j
    row_sum = xor.sum(axis=0)
    return row_sum

row_sums = []
ms = []
ns = []
for i in range(0,1000):
    m = random.randint(1,800)
    n = random.randint(1,800)
    row_sum = xor_calc(m,n)
    row_sums.append(sum(row_sum))
    ms.append(m)
    ns.append(n)

df = pd.DataFrame(
    {
        'ms': ms,
        'ns': ns,  
        'row_sums': row_sums,
    })
1

There are 1 best solutions below

0
On

I think it should be something proportional to $n\cdot m\cdot \max(m,n)$. By using the xor operation, you are basically shuffling bits around, without changing the number of ones and zeros. So your sum is on average the number of cells in your matrix ($n\cdot m$) times the average value of your cell, which should be proportional to $\max(m,n)$.

This is not a proof, just an intuition which you can check with python.