projection module#
Created on Sat Aug 17 10:36:51 2024
@author: Pavan Pranjivan Mehta
- class projection.coefficient#
Bases:
object
- legendre(degree)#
Comuptes the coeffients for L2 projection over Legendre basis over [-1, 1]
Parameters#
- farray, float
values of f(x) at quadrature points.
- degreeint
highest degree of the polynomial
Returns#
- a: numpy array
coefficient for Galkerkin projection over Legendre Basis
- q: numpy array
quadrature points required for inner product computation via Gauss quadrature.
- shift_legendre(degree)#
Comuptes the coeffients for L2 projection over shifted Legendre basis over [0,1]
Parameters#
- farray, float
values of f(x) at quadrature points.
- degreeint
highest degree of the polynomial
Returns#
- a: numpy array
coefficient for Galkerkin projection over Shited Legendre Basis over [0,1]
- q: numpy array
quadrature points required for inner product computation via Gauss quadrature.
- jacobi(alpha, beta, degree)#
Comuptes the coeffients for L2 projection over Jacobi basis over [-1,1]
Parameters#
- farray, float
values of f(x) at quadrature points.
- alphafloat
Paramter of Jacobi polynomials, alpha > -1
- betafloat
Paramter of Jacobi polynomials, beta > -1
- degreeint
highest degree of the polynomial
Returns#
- a: numpy array
coefficient for Galkerkin projection over Jacobi Basis over [-1,1]
- q: numpy array
quadrature points required for inner product computation via Gauss quadrature.
- shift_jacobi(alpha, beta, degree)#
Comuptes the coeffients for L2 projection over shifted Jacobi basis over [0,1]
Parameters#
- farray, float
values of f(x) at quadrature points.
- alphafloat
Paramter of Jacobi polynomials, alpha > -1
- betafloat
Paramter of Jacobi polynomials, beta > -1
- degreeint
highest degree of the polynomial
Returns#
- a: numpy array
coefficient for Galkerkin projection over Shited Jacobi Basis over [0,1]
- q: numpy array
quadrature points required for inner product computation via Gauss quadrature.
- shift_arbitary_jacobi(a, b, alpha, beta, degree)#
Comuptes the coeffients for L2 projection over shifted (arbitary) Jacobi basis on interval [a, b]
Parameters#
- farray, float
values of f(x) at quadrature points.
- afloat
min. of interval [a, b]
- bfloat
max. of interval [a, b]
- alphafloat
Paramter of Jacobi polynomials, alpha > -1
- betafloat
Paramter of Jacobi polynomials, beta > -1
- degreeint
highest degree of the polynomial
Returns#
- a1: numpy array
coefficient for Galkerkin projection over Shited Jacobi Basis over [a,b]
- q: numpy array
quadrature points required for inner product computation via Gauss quadrature.
Note#
For the interval [a, b], we have -1 <= a < b <= 1.
- Q_poly(alpha, beta, degree)#
Comuptes the coeffients for L2 projection over Q basis over the inverval [0,1]
Parameters#
- farray, float
values of f(x) at quadrature points.
- alphafloat
Paramter of Jacobi polynomials, alpha > -1
- betafloat
Paramter of Jacobi polynomials, beta > -1
- degreeint
highest degree of the polynomial
Returns#
- a: numpy array
coefficient for Galkerkin projection over Q Basis over [0,1]
- q: numpy array
quadrature points required for inner product computation via Gauss quadrature.
Note#
Q_n ^{alpha, beta} (x) := P_n^{alpha, beta} (1 - 2x)
- class projection.expansion#
Bases:
object
Reconstruct the function as,
- f(x) = SUM_i^N a_i P_i (x),
where, a_i is the coefficents and P_i Basis function (ith-order polynomial)
Input : “a_i” coefficients obatined via Galerkin projection
- legendre(x, degree)#
Reconstruct the function, using Legendre basis for x in [-1, 1] by supplying the coefficients, a_i
Parameters#
- aarray, float
coefficients obatined via Galerkin projection
- xarray, float
x in [-1, 1]
- degreeint
highest degree of the polynomial
Returns#
- f: numpy array
values of f(x) at supplied x
- shift_legendre(x, degree)#
Reconstruct the function, using Shited Legendre basis for x in [0, 1] by supplying the coefficients, a_i
Parameters#
- aarray, float
coefficients obatined via Galerkin projection
- xarray, float
x in [0, 1]
- degreeint
highest degree of the polynomial
Returns#
- f: numpy array
values of f(x) at supplied x
- jacobi(x, alpha, beta, degree)#
Reconstruct the function, using Jacobi basis for x in [-1, 1] by supplying the coefficients, a_i
Parameters#
- aarray, float
coefficients obatined via Galerkin projection
- xarray, float
x in [-1, 1]
- alphafloat
Paramter of Jacobi polynomials, alpha > -1
- betafloat
Paramter of Jacobi polynomials, beta > -1
- degreeint
highest degree of the polynomial
Returns#
- f: numpy array
values of f(x) at supplied x
- shift_jacobi(x, alpha, beta, degree)#
Reconstruct the function, using Shited Jacobi basis for x in [0, 1] by supplying the coefficients, a_i
Parameters#
- aarray, float
coefficients obatined via Galerkin projection
- xarray, float
x in [0, 1]
- alphafloat
Paramter of Jacobi polynomials, alpha > -1
- betafloat
Paramter of Jacobi polynomials, beta > -1
- degreeint
highest degree of the polynomial
Returns#
- f: numpy array
values of f(x) at supplied x
- shift_arbitary_jacobi(x, a, b, alpha, beta, degree)#
Reconstruct the function, using Shited Jacobi basis for x in [a, b] by supplying the coefficients, a1_i
Parameters#
- a1array, float
coefficients obatined via Galerkin projection
- xarray, float
x in [a, b]
- afloat
min. of the interval [a, b]
- bfloat
max. of the interval [a, b]
- alphafloat
Paramter of Jacobi polynomials, alpha > -1
- betafloat
Paramter of Jacobi polynomials, beta > -1
- degreeint
highest degree of the polynomial
Returns#
- f: numpy array
values of f(x) at supplied x
- Q_poly(x, alpha, beta, degree)#
Reconstruct the function, using Q basis for x in [0, 1] by supplying the coefficients, a_i
Parameters#
- aarray, float
coefficients obatined via Galerkin projection
- xarray, float
x in [0, 1]
- alphafloat
Paramter of Q polynomials, alpha > -1
- betafloat
Paramter of Q polynomials, beta > -1
- degreeint
highest degree of the polynomial
Returns#
- f: numpy array
values of f(x) at supplied x
Notes#
The Q basis function are defines as,
Q_n^{alpha, beta} (x) := P_n^{alpha, beta} (1-2x)
- class projection.galerkin#
Bases:
object
Performs the Projection as,
- f(x) = SUM_i^N a_i P_i (x),
where, a_i is the coefficents and P_i Basis function (ith-order polynomial)
Input : f(x) at quadature points.
- legendre(x, degree)#
Reconstruct the function, using Legendre basis for x in [-1, 1] by supplying the function values at quadrature points
Parameters#
- fqarray, float
f(q), function values at quadrature points, q.
- xarray, float
x in [-1, 1]
- degreeint
highest degree of the polynomial
Returns#
- f: numpy array
values of f(x) at supplied x
- shift_legendre(x, degree)#
Reconstruct the function, using shifted Legendre basis for x in [0, 1] by supplying the function values at quadrature points
Parameters#
- fqarray, float
f(q), function values at quadrature points, q.
- xarray, float
x in [0, 1]
- degreeint
highest degree of the polynomial
Returns#
- f: numpy array
values of f(x) at supplied x
- jacobi(x, alpha, beta, degree)#
Reconstruct the function, using Jacobi basis for x in [-1, 1] by supplying the function values at quadrature points
Parameters#
- fqarray, float
f(q), function values at quadrature points, q.
- xarray, float
x in [-1, 1]
- alphafloat
Paramter of Q polynomials, alpha > -1
- betafloat
Paramter of Q polynomials, beta > -1
- degreeint
highest degree of the polynomial
Returns#
- f: numpy array
values of f(x) at supplied x
- shift_jacobi(x, alpha, beta, degree)#
Reconstruct the function, using shifted Jacobi basis for x in [0, 1] by supplying the function values at quadrature points
Parameters#
- fqarray, float
f(q), function values at quadrature points, q.
- xarray, float
x in [0, 1]
- alphafloat
Paramter of Q polynomials, alpha > -1
- betafloat
Paramter of Q polynomials, beta > -1
- degreeint
highest degree of the polynomial
Returns#
- f: numpy array
values of f(x) at supplied x
- shift_arbitary_jacobi(x, a, b, alpha, beta, degree)#
Reconstruct the function, using shifted Jacobi basis for x in [a, b] by supplying the function values at quadrature points
Parameters#
- fqarray, float
f(q), function values at quadrature points, q.
- xarray, float
x in [0, 1]
- afloat
min. of the interval [a, b]
- bfloat
max. of the interval [a, b]
- alphafloat
Paramter of Q polynomials, alpha > -1
- betafloat
Paramter of Q polynomials, beta > -1
- degreeint
highest degree of the polynomial
Returns#
- f: numpy array
values of f(x) at supplied x
- Q_poly(x, alpha, beta, degree)#
Reconstruct the function, using Q basis for x in [0, 1] by supplying the function values at quadrature points
Parameters#
- fqarray, float
f(q), function values at quadrature points, q.
- xarray, float
x in [0, 1]
- alphafloat
Paramter of Q polynomials, alpha > -1
- betafloat
Paramter of Q polynomials, beta > -1
- degreeint
highest degree of the polynomial
Returns#
- f: numpy array
values of f(x) at supplied x
Notes#
The Q basis function are defines as,
Q_n^{alpha, beta} (x) := P_n^{alpha, beta} (1-2x)