# Last edited on 2021-07-31 11:47:13 by jstolfi def basis_sample(nb, basis, s): # Evaluates {nb} elements of a function basis on a given # list {s} of sample points. The basis function {i} on point {p} # is supposed to be given bt {basis(i,p)}. # Returns the basis in matrix form. Specifically, return a list {B} of # {nb} lists. Each list {B[i]} has {len(s)} elements. Element # {B[i][j]} is the value {basis(i,s[j])} B = []; for i in range(nb): Bi = [] for sj in s: Bij = basis(i, sj) Bi.append(Bij) B.append(Bi) return B # ----------------------------------------------------------------------