docs: def train(self, ftrain):
          '''Trains the polynomial expansion.
  
          :param numpy.ndarray/function ftrain: output values corresponding to the
              quadrature points given by the getQuadraturePoints method to
              which the expansion should be trained. Or a function that should be evaluated
              at the quadrature points to give these output values.
  
          *Sample Usage*::
  
              >>> thePC = PolySurrogate(dimensions=2)
              >>> thePC.train(myFunc)
              >>> predicted_q = thePC.predict([0, 1])
  
              >>> thePC = PolySurrogate(dimensions=2)
              >>> U = thePC.getQuadraturePoints()
              >>> Q = [myFunc(u) for u in U]
              >>> thePC.train(Q)
              >>> predicted_q = thePC.predict([0, 1])
  
          '''
          self.coeffs = 0*self.coeffs
  
          upoints, wpoints = self.getQuadraturePointsAndWeights()
  
          try:
              fpoints = [ftrain(u) for u in upoints]
          except TypeError:
              fpoints = ftrain
  
          for ipoly in np.arange(self.N_poly):
  
              inds = tuple(self.index_polys[ipoly])
              coeff = 0.0
              for (u, q, w) in zip(upoints, fpoints, wpoints):
                  coeff += eval_poly(u, inds, self.J_list)*q*np.prod(w)
  
              self.coeffs[inds] = coeff
          return None