# Last edited on 2021-07-31 16:32:06 by jstolfi from gauss_bell import gauss_bell def basis_2d_gauss_eval(c, r, A, p): # Evaluats at the point {p} the linear combination of with coefficients {A[...]} # of the Gauss bell basis functions whose centroids are in {c} and whose radii are in {r}. # # Both the point {p} and the centroid and radius of each basis element # must be 2-tuples of floats. The parameter {A} must be a list of floats # with the same length as {c} and {r}. nb = len(c); sum = 0 for i in range(nb): cxi,cyi = c[i] rxi,ryi = r[i] Ai = A[i] gx = gauss_bell((p[0]-cxi)/rxi) gy = gauss_bell((p[1]-cyi)/ryi) sum += Ai*gx*gy return sum # ----------------------------------------------------------------------