Ejemplo n.º 1
0
def lobatto_shape_functions(points):
    """Returns a list of Polynomial objects representing the Lobatto
    shape functions for a set of Gauss-Lobatto quadrature points."""
    f = []
    for point in points:
        # The Lobatto shape function corresponding to a point is simply a
        # Lagrange basis polynomial with roots at all the other points:
        other_points = points[points!=point]
        f_i = Polynomial.fromroots(other_points)/np.prod(point - other_points)
        f.append(f_i)
    return f
Ejemplo n.º 2
0
 def update(self):
     if len(self.roots)>0:
         self.poly = Polynomial.fromroots(self.roots)
     else:
         self.poly = Polynomial([0])