ie_circle package

class ie_circle.ArrayFunction(*args, **kwargs)[source]

Bases: Protocol

class ie_circle.CircleShape(rho: float)[source]

Bases: Shape

Circle of radius rho centered at the origin.

ddx(t: Array, /) Array[source]
dx(t: Array, /) Array[source]
rho: float
x(t: Array, /) Array[source]
class ie_circle.KernelFunction(*args, **kwargs)[source]

Bases: Protocol

class ie_circle.KressShape[source]

Bases: Shape

Shape of x(t) = (cos(t) + 0.65 cos(2t) - 0.65, 1.5 sin(t)).

References

Kress, R. (1991). Boundary integral equations in time-harmonic acoustic scattering. Mathematical and Computer Modelling, 15(3), 229–243. https://doi.org/10.1016/0895-7177(91)90068-I

ddx(t: Array, /) Array[source]
dx(t: Array, /) Array[source]
x(t: Array, /) Array[source]
class ie_circle.NystromInterpolant(*args, **kwargs)[source]

Bases: Protocol

sol: Array
class ie_circle.PowerQuadratureRule(*args, **kwargs)[source]

Bases: Protocol

class ie_circle.QuadratureRule(*args, **kwargs)[source]

Bases: Protocol

class ie_circle.QuadratureType(*values)[source]

Bases: StrEnum

COT_POWER = 'cot_power'

\[ K_{\cot,n}(x, y) \cot^n\!\left(\frac{x - y}{2}\right) \]

If n is odd, be careful about the order of x and y, as

\[ \cot \left(\frac{x - y}{2}\right) = -\cot \left(\frac{y - x}{2}\right). \]

If n is 0, same as NO_SINGULARITY.

LOG_COT_POWER = 'log_cot_power'

$$ K_{log,n}(x, y) logleft(4sin^2frac{x - y}{2}right)cot^n!left(frac{x - y}{2}right)

If n is odd, be careful about the order of x and y, as

\[ \cot \left(\frac{x - y}{2}\right) = -\cot \left(\frac{y - x}{2}\right). \]

NO_SINGULARITY = 'no_singularity'

\[ K_{\mathrm{reg}}(x, y) \]

class ie_circle.Shape(*args, **kwargs)[source]

Bases: Protocol

ddx(t: Array, /) Array[source]
dx(t: Array, /) Array[source]
x(t: Array, /) Array[source]
class ie_circle.SympyShape(x_expr: Expr, y_expr: Expr, t_symbol: Symbol)[source]

Bases: Shape

Shape defined by SymPy expressions.

The derivatives are computed at initialization.

ddx(t: Array, /) Array[source]
dx(t: Array, /) Array[source]
t_symbol: Symbol
x(t: Array, /) Array[source]
x_expr: Expr
y_expr: Expr
ie_circle.cot_power_fourier_integral_coefficients(n_harmonics: int, power: int, /, *, xp: ArrayNamespaceFull, device: Any, dtype: Any) Array[source]

Fourier coefficients of the finite-part integral of \(\cot^{\mathrm{power}}(t/2)\).

Returns \(I_{m,\mathrm{power}}\) for \(m = -(n_harmonics-1), \ldots, n_harmonics-1\).

If power is 0, the coefficients are $ 2pi delta_{m,0}$ corresponding to the Fourier coefficients of the constant function 1.

Parameters:
  • n_harmonics (int) – Harmonics with order less than n_harmonics.

  • power (int) – The exponent n in \(I_{m,n}\).

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any) – The device.

  • dtype (Any) – The dtype.

Returns:

Complex-valued coefficients \(I_{m,\mathrm{power}}\) of shape (2*n_harmonics - 1,).

Return type:

Array

ie_circle.cot_power_quadrature(n_harmonics: int, power: int, /, *, t_start: float | None = None, t_start_factor: float | None = None, xp: ArrayNamespaceFull, device: Any, dtype: Any) tuple[Array, Array][source]

Shifted finite-part trapezoidal rule for \(\cot^{\mathrm{power}}(t/2)\).

Let \(N' := 2 N - 1\) and \(t_j := 2\pi j / N'\). For $t_s := t_mathrm{start}$, the rule matches the Typst statement

\[ \int_0^{2\pi}{}^\dash f(t)\,\cot^{\mathrm{power}}(t/2)\,dt = \sum_{j=0}^{N'-1} f(t_j + t_s)\,P_j^{(N',\mathrm{power})}, \]

with

$$ P_j^{(N’,mathrm{power})} := frac{1}{N’} sum_{|m|<N} I_{m,mathrm{power}} e^{-i m (t_j + t_s)}. $$

The returned weights correspond to \(P_j^{(N',\mathrm{power})}\) evaluated at $t_s = t_\mathrm{start}\(, and the returned nodes are \)t_j + t_mathrm{start}$.

If power is 0, the quadrature corresponds to the trapezoidal rule.

Parameters:
  • n_harmonics (int) – Harmonics with order less than n_harmonics are integrated exactly.

  • power (int) – Exponent in \(\cot^{\mathrm{power}}\).

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\) (sets \(t_s\) in the Typst formula).

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Mutually exclusive with t_start.

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any) – The device.

  • dtype (Any) – The dtype.

Returns:

  • Array – Nodes $t_j + t_mathrm{start}$ of shape (2*n_harmonics - 1,).

  • Array – Weights \(P_j\) of shape (2*n_harmonics - 1,).

ie_circle.example_13_19(a: float, b: float, n: int, /, *, xp: ArrayNamespaceFull, device: Any = None, dtype: Any = None, t_start_sol: float | None = None, t_start_factor_sol: float | None = None, t_start: float | None = None, t_start_factor: float | None = None) NystromInterpolant[source]

Solves the integral equation.

\[ \frac{1}{2\pi} \int_0^{2\pi} \left[ \cot\left(\frac{\tau - t}{2}\right) + K(t, \tau) \right] \phi(\tau) \, d\tau = f(t) \]

where

\[ K(t, \tau) = 2 - \frac{(a^2 - b^2) \sin(t + \tau)}{a^2 + b^2 - (a^2 - b^2) \cos(t + \tau)} \]
and
\[ f(t) = e^{c \cos t} \sin(c \sin t) + e^{\cos t} \sin(\sin t), \qquad c = \frac{a - b}{a + b}. \]

The exact solution is

\[ \phi(t) = \text{example\_13\_19\_answer}(t) = 1 - e^{\cos t} \cos(\sin t). \]

Parameters:
  • a (float) – The parameter a.

  • b (float) – The parameter b.

  • n (int) – The maximum order - 1.

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any, optional) – The device.

  • dtype (Any, optional) – The dtype.

  • t_start_sol (float | None) – Grid shift \(t_\mathrm{start}\). Applied to column points.

  • t_start_factor_sol (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Applied to column points.

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\). Applied to row points.

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Applied to row points.

Returns:

The interpolant for the solution of the integral equation.

Return type:

NystromInterpolant

ie_circle.example_13_19_answer(t: Array, /) Array[source]

Returns the exact solution of the example integral equation.

Parameters:

t (Array) – The evaluation points of shape (…,).

Returns:

The exact solution \(\phi(t) = 1 - e^{\cos t} \cos(\sin t)\) of shape (…,).

Return type:

Array

ie_circle.example_13_23(a: float, b: float, n: int, /, *, xp: ArrayNamespaceFull, device: Any = None, dtype: Any = None, t_start_sol: float | None = None, t_start_factor_sol: float | None = None, t_start: float | None = None, t_start_factor: float | None = None) NystromInterpolant[source]

Solves the integral equation for Example 13.23.

\[ S_0 \phi - A \phi = f \]

where

\[ (S_0 \phi)(t) := \frac{1}{2\pi} \int_0^{2\pi} \left\{ \ln\left(4 \sin^2 \frac{t - \tau}{2}\right) - 2 \right\} \phi(\tau) \, d\tau \]
and
\[ (A \phi)(t) := \frac{1}{2\pi} \int_0^{2\pi} \left\{ K(t, \tau) \ln\left(4 \sin^2 \frac{t - \tau}{2}\right) + L(t, \tau) \right\} \phi(\tau) \, d\tau. \]

For this example, \(K(t, \tau) = 0\) and

\[ L(t, \tau) = -\ln\{a^2 + b^2 - (a^2 - b^2)\cos(t + \tau)\} - 3. \]

The exact solution is

\[ \phi(t) = \text{example\_13\_23\_answer}(t) = e^{\cos t} \cos(t + \sin t) \]
and the right-hand side is
\[ f(t) = 2 - e^{\cos t} \cos(\sin t) - e^{c \cos t} \cos(c \sin t), \qquad c = \frac{a - b}{a + b}. \]

Parameters:
  • a (float) – The parameter a.

  • b (float) – The parameter b.

  • n (int) – The maximum order - 1.

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any, optional) – The device.

  • dtype (Any, optional) – The dtype.

  • t_start_sol (float | None) – Grid shift \(t_\mathrm{start}\). Applied to column points.

  • t_start_factor_sol (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Applied to column points.

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\). Applied to row points.

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Applied to row points.

Returns:

The interpolant for the solution of the integral equation.

Return type:

NystromInterpolant

ie_circle.example_13_23_answer(t: Array, /) Array[source]

Returns the exact solution of the example 13.23 integral equation.

Parameters:

t (Array) – The evaluation points of shape (…,).

Returns:

The exact solution \(\phi(t) = e^{\cos t} \cos(t + \sin t)\) of shape (…,).

Return type:

Array

ie_circle.example_simple(n: int, /, *, xp: ArrayNamespaceFull, device: Any = None, dtype: Any = None, t_start_sol: float | None = None, t_start_factor_sol: float | None = None, t_start: float | None = None, t_start_factor: float | None = None) NystromInterpolant[source]

Solves the simple test integral equation.

\[ \phi(t) + \int_0^{2\pi} \cos(t - \tau) \phi(\tau) \, d\tau = (1 + \pi) \cos(t) \]

The exact solution is

\[ \phi(t) = \text{example\_simple\_answer}(t) = \cos(t). \]

Parameters:
  • n (int) – The maximum order - 1.

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any, optional) – The device.

  • dtype (Any, optional) – The dtype.

  • t_start_sol (float | None) – Grid shift \(t_\mathrm{start}\). Applied to column points.

  • t_start_factor_sol (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Applied to column points.

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\). Applied to row points.

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Applied to row points.

Returns:

The interpolant for the solution of the integral equation.

Return type:

NystromInterpolant

ie_circle.example_simple_answer(t: Array, /) Array[source]

Returns the exact solution of the simple test integral equation.

Parameters:

t (Array) – The evaluation points of shape (…,).

Returns:

The exact solution \(\phi(t) = \cos(t)\) of shape (…,).

Return type:

Array

ie_circle.fourier_coeff_to_quadrature(coeff: Array, n_harmonics: int, /, *, t_start: float | None = None, t_start_factor: float | None = None, xp: ArrayNamespaceFull, device: Any, dtype: Any) tuple[Array, Array][source]

Build quadrature nodes and weights from Fourier integral coefficients.

Parameters:
  • coeff (Array) – Fourier coefficients \(I_m\) of shape (2*n_harmonics - 1,).

  • n_harmonics (int) – Harmonics with order less than n_harmonics are integrated exactly.

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\) (sets \(t_s\) in the Fourier sum).

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n_harmonics-1)\). Mutually exclusive with t_start.

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any) – The device.

  • dtype (Any) – The dtype.

Returns:

  • Array – Nodes $t_j + t_mathrm{start}$ of shape (2*n_harmonics - 1,).

  • Array – Weights derived from coeff of shape (2*n_harmonics - 1,).

ie_circle.garrick_wittich_quadrature(n: int, /, *, t_start: float | None = None, t_start_factor: float | None = None, xp: ArrayNamespaceFull, device: Any, dtype: Any) tuple[Array, Array][source]

Garrick-Wittich quadrature.

Returns \(x_j\) and \(T_j\), where

Let \(n' := 2n - 1\) and $x_j := t_mathrm{start} + 2pi j / n’$.

\[ p.v. \int_0^{2\pi} \cot \frac{t}{2} f'(t) dt \approx \sum_{j=0}^{n'-1} T_j f(x_j) \]

Parameters:
  • n (int) – Harmonics which order is less than n are integrated exactly.

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\).

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Mutually exclusive with t_start.

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any) – The device.

  • dtype (Any) – The dtype.

Returns:

The roots \(x_j\) of shape (2n - 1,). and weights \(T_j\) of shape (2n - 1,).

Return type:

Array

ie_circle.harmonic_number(n: int, /) float[source]

Return the harmonic number \(H_n = \sum_{k=1}^n 1/k\).

ie_circle.kussmaul_martensen_kress_quadrature(n: int, /, *, t_start: float | None = None, t_start_factor: float | None = None, xp: ArrayNamespaceFull, device: Any, dtype: Any) tuple[Array, Array][source]

Kussmaul-Martensen (Kress) quadrature.

Returns \(x_j\) and \(R_j\), where

Let \(n' := 2n - 1\) and $x_j := t_mathrm{start} + 2pi j / n’$.

\[ \int_0^{2\pi} \log \left(4 \sin^2 \frac{t}{2}\right) f(t) dt \approx \sum_{j=0}^{n'-1} R_j f(x_j) \]

Parameters:
  • n (int) – Harmonics which order is less than n are integrated exactly.

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\).

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Mutually exclusive with t_start.

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any) – The device.

  • dtype (Any) – The dtype.

Returns:

The roots \(x_j\) of shape (2n - 1,). and weights \(R_j\) of shape (2n - 1,).

Return type:

Array

ie_circle.log_cot_power_fourier_integral_coefficients(n_harmonics: int, power: int, /, *, xp: ArrayNamespaceFull, device: Any, dtype: Any) Array[source]

Fourier coefficients of the finite-part integral of \(\log(4\sin^2(t/2))\,\cot^{\mathrm{power}}(t/2)\).

Returns \(J_{m,\mathrm{power}}\) for \(m = -(n_harmonics-1), \ldots, n_harmonics-1\).

Parameters:
  • n_harmonics (int) – Harmonics with order less than n_harmonics.

  • power (int) – The exponent n in \(J_{m,n}\).

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any) – The device.

  • dtype (Any) – The dtype.

Returns:

Complex-valued coefficients \(J_{m,\mathrm{power}}\) of shape (2*n_harmonics - 1,).

Return type:

Array

ie_circle.log_cot_power_quadrature(n_harmonics: int, power: int, /, *, t_start: float | None = None, t_start_factor: float | None = None, xp: ArrayNamespaceFull, device: Any, dtype: Any) tuple[Array, Array][source]

Shifted finite-part trapezoidal rule for \(\log(4\sin^2(t/2))\,\cot^{\mathrm{power}}(t/2)\).

Let \(N' := 2 N - 1\) and \(t_j := 2\pi j / N'\). For $t_s := t_mathrm{start}$, the rule matches the Typst statement

\[ \int_0^{2\pi}{}^\dash f(t)\,\log(4\sin^2(t/2))\,\cot^{\mathrm{power}}(t/2)\,dt = \sum_{j=0}^{N'-1} f(t_j + t_s)\,Q_j^{(N',\mathrm{power})}, \]

with

$$ Q_j^{(N’,mathrm{power})} := frac{1}{N’} sum_{|m|<N} J_{m,mathrm{power}} e^{-i m (t_j + t_s)}. $$

The returned weights correspond to \(Q_j^{(N',\mathrm{power})}\) evaluated at $t_s = t_\mathrm{start}\(, and the returned nodes are \)t_j + t_mathrm{start}$.

Parameters:
  • n_harmonics (int) – Harmonics with order less than n_harmonics are integrated exactly.

  • power (int) – Exponent in \(\cot^{\mathrm{power}}\).

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\) (sets \(t_s\) in the Typst formula).

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Mutually exclusive with t_start.

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any) – The device.

  • dtype (Any) – The dtype.

Returns:

  • Array – Nodes $t_j + t_mathrm{start}$ of shape (2*n_harmonics - 1,).

  • Array – Weights \(Q_j\) of shape (2*n_harmonics - 1,).

ie_circle.nystrom(a: ArrayFunction, kernels: dict[tuple[QuadratureType, int], KernelFunction], rhs: ArrayFunction, /, *, n: int, xp: ArrayNamespaceFull, device: Any, dtype: Any, t_start_sol: float | None = None, t_start_factor_sol: float | None = None, t_start: float | None = None, t_start_factor: float | None = None) NystromInterpolant[source]

Solves integral equations using the Nyström method.

\[ a(x) \phi (x) + \int_0^{2\pi} \Bigg( K_{\mathrm{reg}}(x, y) + \sum_{n\ge 0} K_{\log,n}(x, y) \log\left(4\sin^2\frac{x - y}{2}\right)\cot^n\!\left(\frac{x - y}{2}\right) + \sum_{n\ge 0} K_{\cot,n}(x, y) \cot^n\!\left(\frac{x - y}{2}\right) \Bigg)\,\phi (y)\,dy = \text{rhs} (x) \]

Parameters:
  • a (ArrayFunction) – Multiplicative term \(a(x)\) of (…) -> (…, …(B), C) where C is the number of circles and B is the batch shape for equations.

  • kernels (Kernel) – Kernel functions keyed by (QuadratureType, order) of shape (…), (…) -> (…, …(B), C(x), C(y)) where C is the number of circles and B is the batch shape for equations.

  • rhs (ArrayFunction) – Right-hand side function \(\mathrm{rhs}(x)\).

  • n (int) – Number of discretization points / 2.

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any) – The device.

  • dtype (Any) – The dtype.

  • t_start_sol (float | None) – Grid shift \(t_\mathrm{start}\). Applied to column points.

  • t_start_factor_sol (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Applied to column points.

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\). Applied to row points.

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Applied to row points.

Returns:

An object with sol of shape (…(B), C) where C is the number of circles and B is the batch shape for equations, and callable to evaluate the Nyström interpolant at arbitrary points of (…) -> (…, …(B), C).

Return type:

NystromInterpolant

ie_circle.nystrom_lhs(a: ArrayFunction, kernels: dict[tuple[QuadratureType, int], KernelFunction], *, n: int, xp: ArrayNamespaceFull, device: Any, dtype: Any, t_start_sol: float | None = None, t_start_factor_sol: float | None = None, t_start: float | None = None, t_start_factor: float | None = None) Array[source]

Returns the left-hand side matrix \(A\) of the Nystrom method for the integral equation.

\[ a(x) \phi (x) + \int_0^{2\pi} \Bigg( K_{\mathrm{reg}}(x, y) + \sum_{n\ge 0} K_{\log,n}(x, y) \log\left(4\sin^2\frac{x - y}{2}\right)\cot^n\!\left(\frac{x - y}{2}\right) + \sum_{n\ge 0} K_{\cot,n}(x, y) \cot^n\!\left(\frac{x - y}{2}\right) \Bigg)\,\phi (y)\,dy = \text{rhs} (x) \]

If n is odd, be careful about the order of x and y, as

\[ \cot \left(\frac{x - y}{2}\right) = -\cot \left(\frac{y - x}{2}\right). \]

Parameters:
  • a (ArrayFunction) – Multiplicative term \(a(x)\) of (…) -> (…, …(B), C) where C is the number of circles and B is the batch shape for equations.

  • kernels (Kernel) – Kernel functions keyed by (QuadratureType, order) of shape (…), (…) -> (…, …(B), C(x), C(y)) where C is the number of circles and B is the batch shape for equations.

  • n (int) – The maximum order - 1.

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any) – The device.

  • dtype (Any) – The dtype.

  • t_start_sol (float | None) – Grid shift \(t_\mathrm{start}\). Applied to column points.

  • t_start_factor_sol (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Applied to column points.

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\). Applied to row points.

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Applied to row points.

Returns:

The left-hand side matrix \(A\) of shape (…(B), Q(x), C(x), Q(y), C(y)).

Return type:

Array

ie_circle.nystrom_rhs(rhs: ArrayFunction, *, n: int, xp: ArrayNamespaceFull, device: Any, dtype: Any, t_start: float | None = None, t_start_factor: float | None = None) Array[source]

Returns the quadrature nodes and right-hand side vector.

Parameters:
  • rhs (ArrayFunction) – Right-hand side function \(\mathrm{rhs}(x)\) of (…) -> (…, …(B), C) where C is the number of circles and B is the batch shape for equations.

  • n (int) – The maximum order - 1.

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any) – The device.

  • dtype (Any) – The dtype.

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\).

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\).

Returns:

The RHS vector of shape (…(B), Q, C) where C is the number of circles and B is the batch shape for equations.

Return type:

tuple[Array, Array]

ie_circle.shift_quadrature_singularity(quadrature: QuadratureRule, t_singularity: float) QuadratureRule[source]
ie_circle.shift_quadrature_singularity(quadrature: PowerQuadratureRule, t_singularity: float) PowerQuadratureRule

Return a quadrature wrapper shifted so the singularity is at t_singularity.

Since

\[ \int_0^{2\pi} w(t - t_{\mathrm{singularity}}) f(t) dt &= \int_0^{2\pi} w(t) f(t + t_{\mathrm{singularity}}) dt, &= \sum_j w_{j,t'_{\mathrm{start}}} f(t_j + t_{\mathrm{singularity}} + t'_{\mathrm{start}}), \]

By setting \(t'_{\mathrm{start}} = t_{\mathrm{start}} - t_{\mathrm{singularity}}\), the returned quadrature rule evaluates f with nodes starting at \(t_{\mathrm{start}}\).

ie_circle.trapezoidal_basis(x: Array, /, *, t_start: float | None = None, t_start_factor: float | None = None, n: int, xp: ArrayNamespaceFull, device: Any, dtype: Any) Array[source]

Evaluates the basis.

$ 1/N’ sum_(abs(m) < N) exp(-im(t_j + t_mathrm{start})) * exp(imx) $

Parameters:
  • x (Array) – The points to evaluate of shape (…,).

  • n (int) – The maximum order - 1.

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\).

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\).

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any) – The device.

  • dtype (Any) – The dtype.

Returns:

The basis evaluated at x of shape (…, n).

Return type:

Array

ie_circle.trapezoidal_quadrature(n: int, /, *, t_start: float | None = None, t_start_factor: float | None = None, xp: ArrayNamespaceFull, device: Any, dtype: Any) tuple[Array, Array][source]

Trapezoidal quadrature for [0, 2π].

Returns \(x_j\) and \(w_j\), where

\[ \int_0^{2\pi} f(x) dx \approx \sum_{j=0}^{2n-1} w_j f(x_j) \]

Parameters:
  • n (int) – Harmonics which order is less than n are integrated exactly.

  • t_start (float | None) – Grid shift \(t_\mathrm{start}\), with $x_j := t_mathrm{start} + 2pi j / (2n-1)$.

  • t_start_factor (float | None) – Grid shift as a multiple of \(h = 2\pi/(2n-1)\). Mutually exclusive with t_start.

  • xp (ArrayNamespaceFull) – The array namespace.

  • device (Any) – The device.

  • dtype (Any) – The dtype.

Returns:

The roots \(x_j\) of shape (2n - 1,). and weights \(w_j\) of shape (2n - 1,).

Return type:

Array