Lagrange_and_edge_polynomials.py

Lagrange polynomials and edge polynomials in the 1d reference element \Omega_{\mathrm{ref}}=[-1,1].

⭕ To access the source code, click on the [source] button at the right side or click on [Lagrange_and_edge_polynomials.py]. Dependence may exist. In case of error, check import and install required packages or download required scripts. © mathischeap.com

Lagrange_and_edge_polynomials.Lagrange_polynomials(nodes, xi)[source]

Compute the Lagrange polynomials l^{i}(\xi) built on nodes. They are then evaluated at xi.

Parameters:
  • nodes (1d np.array) – The nodes on which the Lagrange polynomials are built.

  • xi (1d np.array) – The points to evaluate the Lagrange polynomials.

Returns:

A 2d numpy.array whose 0-dimension refers to the indexes of the polynomials and 1-dimension refers to the values evaluated at xi.

Example:

>>> nodes = np.array([-1., -0.4472136,  0.4472136,  1.])
>>> x = np.linspace(-1, 1, 50)
>>> lp = Lagrange_polynomials(nodes, x)
>>> lp[0,:] # l^0(xi) 
array([ 1.        ,  0.88167345,  0.77142177,  0.66898996,...
Lagrange_and_edge_polynomials.edge_polynomials(nodes, xi)[source]

Compute the edge polynomials e^{i}(\xi) built on nodes. They are then evaluated at xi.

Parameters:
  • nodes (1d np.array) – The nodes on which the edge polynomials are built.

  • xi (1d np.array) – The points to evaluate the edge polynomials.

Returns:

A 2d numpy.array whose 0-dimension refers to the indexes of the polynomials and 1-dimension refers to the values evaluated at xi.

Example:

>>> nodes = np.array([-1., -0.65465367,  0.,  0.65465367,  1.])
>>> x = np.linspace(-1, 1, 50)
>>> ep = edge_polynomials(nodes, x)
>>> ep[2,:]  # e^3(xi) 
array([ 0.91016418,  0.60853048,  0.34702611,  0.12374712, ...

↩️ Back to Ph.D. thesis complements (ptc).