basis module#

Created on Thu Aug 31 13:56:13 2023

@author: Pavan Pranjivan Mehta

class basis.polynomials#

Bases: object

Returns orthogonal polynomials of a degree “n”.

legendre(degree)#

Legendre Polynomials

Parameters#

xfloat array

Spatial points in [-1,1]

degreeint

degree of the polynomial

Returns#

Legendre polynomials within the interval [-1,1]

jacobi(alpha, beta, degree)#

Jacobi Polynomials, P_n^{alpha, beta}; alpha, beta > -1

Parameters#

xfloat, array

Spatial points in [-1,1]

alphafloat

Paramter for Jacobu polynomial, alpha > -1

betafloat

Paramter for Jacobu polynomial, beta > -1

degreeint

degree of the polynomial

Returns#

Jacobi polynomials within the interval [-1,1]

Q_ploy_legendre(degree)#

Q Ploynomials based on Legendre Polynomials

Q_n (x) := P_n (1 - 2x) is orthogonal wrt to convolution product

Parameters#

xfloat

Spatial points in [0,1]

degreeint

degree of the polynomial

Returns#

Q Legendre polynomials within the interval [0,1]

Q_ploy(alpha, beta, degree)#

Q Ploynomials based on Jacobi Polynomials

Q_n (x) := P_n (1 - 2x) is orthogonal wrt to convolution product

Parameters#

xfloat

Spatial points in [0,1]

alphafloat

Paramter for Jacobu polynomial, alpha > -1

betafloat

Paramter for Jacobu polynomial, beta > -1

degreeint

degree of the polynomial

Returns#

Q Jacobi polynomials within the interval [0,1]

chebyshev_first_kind(degree)#

Chebyshev Polynomials of first kind

Parameters#

xfloat

Spatial points in [-1,1]

degreeint

degree of the polynomial

Returns#

Chebyshev polynomials of first kind within the interval [-1,1]

chebyshev_second_kind(degree)#

Chebyshev Polynomials of second kind

Parameters#

xfloat

Spatial points in [-1,1]

degreeint

degree of the polynomial

Returns#

Chebyshev polynomials of second kind within the interval [-1,1]

shift_legendre(degree)#

Shifted Legendre Polynomials

Parameters#

xfloat

Spatial points in [0,1]

degreeint

degree of the polynomial

Returns#

Shifted Legendre polynomials within the interval [0,1]

shift_jacobi(alpha, beta, degree)#

Shifted Jacobi Polynomials, P_n^{lpha, eta} on interval [0,1], where lpha, eta > -1

Parameters#

xfloat

Spatial points in [0,1]

alphafloat

Paramter for Jacobi polynomial, lpha > -1

betafloat

Paramter for Jacobi polynomial, eta > -1

degreeint

degree of the polynomial

Returns#

Shifted Jacobi polynomials within the interval [0,1]

Q_poly(alpha, beta, degree)#

Q Polynomials, Q_n^{lpha, eta} on interval [0,1], where lpha, eta > -1

Q_n^{lpha, eta} (x) := P_n^{lpha, eta} ( 1 - 2x)

Parameters#

xfloat

Spatial points in [0,1]

alphafloat

Paramter for Q polynomial, lpha > -1

betafloat

Paramter for Q polynomial, eta > -1

degreeint

degree of the polynomial

Returns#

Shifted Jacobi polynomials within the interval [0,1]

shift_arbitary_jacobi(a, b, alpha, beta, degree)#

Shifted (arbitary) Jacobi Polynomials, P_n^{lpha, eta} on interval [a,b], where lpha, eta > -1

Parameters#

xfloat

Spatial points in [a,b]

afloat

min of interval [a, b]

bfloat

max of interval [a, b]

alphafloat

Paramter for Jacobu polynomial, lpha > -1

betafloat

Paramter for Jacobu polynomial, eta > -1

degreeint

degree of the polynomial

Returns#

Shifted (arbitary) Jacobi polynomials within the interval [a, b]

class basis.homogeneous_basis#

Bases: object

Construct basis functions (phi_i), such that phi_i = 0 at the boundaries

legendre(degree)#

Construct homogenous basis functions using Legendre Polynomials

phi_i = l_{k+2} - l_{k}, where l is legendre polynomial in [-1,1] of degree k

Parameters#

xfloat

Spatial points in [-1,1]

degreeint

degree of the polynomial atleast of order 2

Returns#

Homogenous Basis function using shifted legendre polynomials within the interval [0,1]

shift_legendre(degree)#

Construct homogenous basis functions using Shifted Legendre Polynomials

phi_i = l_{k+2} - l_{k}, where l is shifted legendre polynomial in [0,1] of degree k

Parameters#

xfloat

Spatial points in [0,1]

degreeint

degree of the polynomial atleast of order 2

Returns#

Homogenous Basis function using shifted legendre polynomials within the interval [0,1]

class basis.first_derivatives#

Bases: object

compututes deriavties of Polynomials and Basis functions

legendre(degree)#

First derivative of Legendre Polynomials computed via analytical formula,

frac{d}{dx} P_n^{alpha, beta} = frac{1}{2} (n + alpha + beta + 1) P_{n-1}^{alpha+1, beta+1}; n > 1 (integer)

where, alpha, beta = 0 for legendre ploynomials.

Since, $n = 0$ is a constant function, the function returns an array of zero’s.

Parameters#

xfloat

Spatial points in [-1,1]

degreeint

degree of the polynomial

Returns#

First derivative of Legendre polynomials within the interval [-1,1]

shift_legendre(degree)#

First derivative of Shifted Legendre Polynomials computed computed via analytical formula,

rac{d}{dx} P_n^{lpha, eta} = rac{1}{2} (n + lpha + eta + 1) P_{n-1}^{lpha+1, eta+1}; n > 1 (integer)

where, lpha, eta = 0 for legendre ploynomials.

Since, $n = 0$ is a constant function, the function returns an array of zero’s.

xfloat

Spatial points in [0,1]

degreeint

degree of the polynomial

First derivative of Shifted Legendre polynomials within the interval [0,1]

homogenous_legendre_basis(degree)#

First derivative of Homognoous basis using Legendre Polynomials

Homogenous basis functions using Legendre Polynomials comstrcted as,

phi_n = l_{n+2} - l_{n}, where l is legendre polynomial in [-1,1] of degree n

Parameters#

xfloat

Spatial points in [-1,1]

degreeint

degree of the polynomial

Returns#

First derivative of Homognoous basis using Legendre polynomials within the interval [-1,1]

Reference#

computed using the function call, first_derivatives.legendre(x, degree+2)

homogenous_shift_legendre_basis(degree)#

First derivative of Homognoous basis using Shifted Legendre Polynomials computed using finite diff (order 1)

Homogenous basis functions using Shifted Legendre Polynomials comstrcted as,

phi_n = l_{n+2} - l_{n}, where l is legendre polynomial in [0,1] of degree n

Parameters#

xfloat

Spatial points in [0,1]

degreeint

degree of the polynomial

Returns#

First derivative of Shifted Homognoous basis using Legendre polynomials within the interval [0,1]

Reference#

computed using the function call, first_derivatives.shift_legendre(x, degree)

jacobi(alpha, beta, degree)#

First derivative of Jacobi Polynomials computed via analytical formula,

frac{d}{dx} P_n^{alpha, beta} = frac{1}{2} (n + alpha + beta + 1) P_{n-1}^{alpha+1, beta+1}; n > 1 (integer)

where, alpha, beta > -1 for Jacobi ploynomials.

Since, $n = 0$ is a constant function, the function returns an array of zero’s.

Parameters#

xfloat

Spatial points in [-1,1]

degreeint

degree of the polynomial

Returns#

First derivative of Jacobi polynomials within the interval [-1,1]

shift_jacobi(alpha, beta, degree)#

First derivative of shifted Jacobi Polynomials on [0,1] computed via analytical formula,

frac{d}{dx} P_n^{alpha, beta} = frac{1}{2} (n + alpha + beta + 1) P_{n-1}^{alpha+1, beta+1}; n > 1 (integer)

where, alpha, beta > -1 for Jacobi ploynomials.

Since, $n = 0$ is a constant function, the function returns an array of zero’s.

Parameters#

xfloat

Spatial points in [0,1]

degreeint

degree of the polynomial

Returns#

First derivative of shifted Jacobi polynomials within the interval [0,1]

Q_ploy(alpha, beta, degree)#

First derivative of Q Polynomials on [0,1] computed via analytical formula,

Q_n^{alpha, beta} (x) : = P_n^{alpha, beta} (1 - 2x), and

frac{d}{dx} P_n^{alpha, beta} = frac{1}{2} (n + alpha + beta + 1) P_{n-1}^{alpha+1, beta+1}; n > 1 (integer)

where, alpha, beta > -1 for Jacobi ploynomials.

Since, $n = 0$ is a constant function, the function returns an array of zero’s.

Parameters#

xfloat

Spatial points in [0,1]

degreeint

degree of the polynomial

Returns#

First derivative of Q polynomials within the interval [0,1]

class basis.second_derivatives#

Bases: object

compututes second deriavties of Polynomials and Basis functions

legendre(degree)#

Second derivative of Legendre Polynomials computed via analytical formula - applied twice

frac{d}{dx} P_n^{alpha, beta} = frac{1}{2} (n + alpha + beta + 1) P_{n-1}^{alpha+1, beta+1}; n > 1 (integer)

where, alpha, beta = 0 for legendre ploynomials.

Since, $n = 0$ is a constant function, the function returns an array of zero’s.

Parameters#

xfloat

Spatial points in [-1,1]

degreeint

degree of the polynomial

Returns#

Second derivative of Legendre polynomials within the interval [-1,1]

chebyshev_first_kind(degree)#

Second derivative of chebyshev_first_kind Polynomials computed via analytical formula - applied twice

Since, $n = 0$ is a constant function, the function returns an array of zero’s.

Parameters#

xfloat

Spatial points in [-1,1]

degreeint

degree of the polynomial

Returns#

Second derivative of chebyshev_first_kind polynomials within the interval [-1,1]

shift_legendre(degree)#

Second derivative of Shifted Legendre Polynomials computed computed via analytical formula - applied twice

rac{d}{dx} P_n^{lpha, eta} = rac{1}{2} (n + lpha + eta + 1) P_{n-1}^{lpha+1, eta+1}; n > 1 (integer)

where, lpha, eta = 0 for legendre ploynomials.

Since, $n = 0$ is a constant function, the function returns an array of zero’s.

xfloat

Spatial points in [0,1]

degreeint

degree of the polynomial

Second derivative of Shifted Legendre polynomials within the interval [0,1]

homogenous_legendre_basis(degree)#

Second derivative of Homognoous basis using Legendre Polynomials

Homogenous basis functions using Legendre Polynomials comstrcted as,

phi_n = l_{n+2} - l_{n}, where l is legendre polynomial in [-1,1] of degree n

Parameters#

xfloat

Spatial points in [-1,1]

degreeint

degree of the polynomial

Returns#

Second derivative of Homognoous basis using Legendre polynomials within the interval [-1,1]

Reference#

computed using the function call, Second_derivatives.legendre(x, degree+2)

homogenous_shift_legendre_basis(degree)#

Second derivative of Homognoous basis using Shifted Legendre Polynomials computed using finite diff (order 1)

Homogenous basis functions using Shifted Legendre Polynomials comstrcted as,

phi_n = l_{n+2} - l_{n}, where l is legendre polynomial in [0,1] of degree n

Parameters#

xfloat

Spatial points in [0,1]

degreeint

degree of the polynomial

Returns#

Second derivative of Shifted Homognoous basis using Legendre polynomials within the interval [0,1]

Reference#

computed using the function call, second_derivatives.shift_legendre(x, degree)

jacobi(alpha, beta, degree)#

Second derivative of Jacobi Polynomials computed via analytical formula - applied twice

frac{d}{dx} P_n^{alpha, beta} = frac{1}{2} (n + alpha + beta + 1) P_{n-1}^{alpha+1, beta+1}; n > 1 (integer)

where, alpha, beta > -1 for Jacobi ploynomials.

Since, $n = 0$ is a constant function, the function returns an array of zero’s.

Parameters#

xfloat

Spatial points in [-1,1]

degreeint

degree of the polynomial

Returns#

Second derivative of Jacobi polynomials within the interval [-1,1]

shift_jacobi(alpha, beta, degree)#

Second derivative of shifted Jacobi Polynomials on [0,1] computed via analytical formula - applied twice

frac{d}{dx} P_n^{alpha, beta} = frac{1}{2} (n + alpha + beta + 1) P_{n-1}^{alpha+1, beta+1}; n > 1 (integer)

where, alpha, beta > -1 for Jacobi ploynomials.

Since, $n = 0$ is a constant function, the function returns an array of zero’s.

Parameters#

xfloat

Spatial points in [0,1]

degreeint

degree of the polynomial

Returns#

Second derivative of shifted Jacobi polynomials within the interval [0,1]

Q_ploy(alpha, beta, degree)#

Second derivative of Q Polynomials on [0,1] computed via analytical formula - applied twice

Q_n^{alpha, beta} (x) : = P_n^{alpha, beta} (1 - 2x), and

frac{d}{dx} P_n^{alpha, beta} = frac{1}{2} (n + alpha + beta + 1) P_{n-1}^{alpha+1, beta+1}; n > 1 (integer)

where, alpha, beta > -1 for Jacobi ploynomials.

Since, $n = 0$ is a constant function, the function returns an array of zero’s.

Parameters#

xfloat

Spatial points in [0,1]

degreeint

degree of the polynomial

Returns#

Second derivative of Q polynomials within the interval [0,1]

class basis.test#

Bases: object

legendre()#
shifted_legendre()#
shifted_jacobi(beta, N)#
chebyshev_first_kind()#
chebyshev_second_kind()#
legendre_homogenous_basis()#
shift_legendre_homogenous_basis()#
second_der_legendre()#
second_der_chebyshev_first_kind()#
second_der_shift_legendre()#
second_der_jacobi(beta, N)#
second_der_shift_jacobi(beta, N)#