In the end, this is what I did:
F - cdf, f - pdf
F (5.5) = F (5.4) + F (4.5) - 2 * F (4.4) + f (5.5)
And swipe across the surface, you can get the result.
The code will look like this:
def cdf_from_pdf(pdf): if not isinstance(pdf[0], np.ndarray): original_dim = int(np.sqrt(len(pdf))) pdf = pdf.reshape(original_dim,original_dim) cdf = np.copy(pdf) xdim, ydim = cdf.shape for i in xrange(1,xdim): cdf[i,0] = cdf[i-1,0] + cdf[i,0] for i in xrange(1,ydim): cdf[0,i] = cdf[0,i-1] + cdf[0,i] for j in xrange(1,ydim): for i in xrange(1,xdim): cdf[i,j] = cdf[i-1,j] + cdf[i,j-1] - cdf[i-1,j-1] + pdf[i,j] return cdf
This is a very rough example, and you can improve the result by changing +/- equantion to integration.
As for the initial value and the field, cdf[0,:] and cdf[:,0] , you can also use integration. In my case, this is very small, so I just use the pdf value.
You can check the function by building cdf or check the value on cdf[n,n]