31 Return coordinates of Gauss-Lobatto nodes in [-1, 1] for given polynomial degree.
32 Roots of deriv(P_{n-1}), where P_{n-1} is the Legendre polynomial and n is the number of nodal points;
33 plus endpoints of the interval.
36 use_explicit_nodes =
False
39 return np.asarray([0.0])
41 if not use_explicit_nodes:
42 poly = legendre(poly_degree)
44 inter_points = np.sort(np.roots(deriv))
45 return np.concatenate(([-1.0], inter_points, [1.0]))
49 return np.asarray([-1.0, 1.0])
50 elif poly_degree == 2:
51 return np.asarray([-1.0, 0.0, 1.0])
52 elif poly_degree == 3:
53 return np.asarray([-1.0, -0.4472135954999579, 0.4472135954999579, 1.0])
54 elif poly_degree == 4:
55 return np.asarray([-1.0, -0.6546536707079771, 0.0, 0.6546536707079771, 1.0])
56 elif poly_degree == 5:
57 return np.asarray([-1.0, -0.7650553239294647, -0.28523151648064504, 0.28523151648064504, 0.7650553239294647, 1.0])
58 elif poly_degree == 6:
59 return np.asarray([-1.0, -0.8302238962785669, -0.4688487934707142, 0.0, 0.4688487934707142, 0.8302238962785669, 1.0])
60 elif poly_degree == 7:
61 return np.asarray([-1.0, -0.87174014850960668, -0.59170018143314218, -0.20929921790247885, 0.20929921790247885, 0.59170018143314218, 0.87174014850960668, 1.0])
63 raise ValueError(f
"Add Gauss-Lobatto nodes for polynomial degree {poly_degree} or set use_explicit_nodes to False to compute them")