## SimplexPoly.jl

Operations on polynomials that live on a simplex
Author eschnett
Popularity
0 Stars
Updated Last
2 Years Ago
Started In
November 2020

# SimplexPoly

Provide various operations of polynomials and polynomial differential forms that live on simplices.

## Overview

This package provides three main datatypes:

• `Poly{D,T}`: Polynomials of type `T` of `D` unknowns
• `Form{D,R,Poly{D,T}}`: Polynomial differential forms of rank `R`
• `Basis{D,R,T}`: A basis for a subspace of polynomial differential forms

This packagae provides the usual arithmetic operations (scaling, adding, multiplying) for polynomials, as well as derivative and Koszul operators. (The Koszul operator is similar to an antiderivative.) For subspaces, there is a function to determine whether a particular polynomial form is contained in it.

Differential forms are handled via the package `DifferentialForms.jl`.

This package can also calculate the PᵣΛᵏ and Pᵣ⁻Λᵏ families of finite elements for the Finite element exterior calculus (FEEC). See Periodic Table of the Finite Elements for an overview, and Periodic Table of the Finite Elements for some details.

## Examples

### Polynomial complex PᵣΛᵏ

Polynomial complex PᵣΛᵏ for polynomial order r=2 in n=2 dimensions. This complex consists of the spaces (P₂Λ⁰, P₁Λ¹, P₀Λ²) for scalars, 1-forms, and 2-forms, respectively. In this complex, higher rank forms are represented via lower degree polynomials. All polynomials depend on x and y.

```julia> using SimplexPoly

julia> pc = polynomial_complex(Val(2), Int, 2);

julia> pc
Basis{2,0,Int64}[
⟦(1 * [0, 0])⟧,
⟦(1 * [0, 1])⟧,
⟦(1 * [0, 2])⟧,
⟦(1 * [1, 0])⟧,
⟦(1 * [1, 1])⟧,
⟦(1 * [2, 0])⟧]```

These are the basis elements for scalar functions. There are 6 basis polynomials. The factor `1 *` can be ignored. The vectors describe the polynomial terms, i.e. the (quadratic) polynomials are: 1, y, y², x, xy, x².

```julia> pc
Basis{2,1,Int64}[
⟦(), (1 * [0, 0])⟧,
⟦(), (1 * [0, 1])⟧,
⟦(), (1 * [1, 0])⟧,
⟦(1 * [0, 0]), ()⟧,
⟦(1 * [0, 1]), ()⟧,
⟦(1 * [1, 0]), ()⟧]```

These are the basis elements for 1-forms. Each basis element has two components (for dx and dy). The 6 (linear) basis polynomials are: dy, y dy, x dy, dx, y dx, x dx.

```julia> pc
Basis{2,2,Int64}[⟦(1 * [0, 0])⟧]```

These is the basis element for 2-forms. The only (constant) basis polynomial is: dx ∧ dy.

### Trimmed polynomial complex Pᵣ⁻Λᵏ

Polynomial complex Pᵣ⁻Λᵏ for polynomial order r=2 in n=2 dimensions. This complex consists of the spaces (P₂⁻Λ⁰, P₂⁻Λ¹, P₂⁻Λ²) for scalars, 1-forms, and 2-forms, respectively. In this complex, forms of all ranks are represented via polynomials of approximately the same degree. All polynomials depend on x and y.

```julia> using SimplexPoly

julia> tpc = trimmed_polynomial_complex(Val(2), Int, 2);

julia> tpc
Basis{2,0,Int64}[
⟦(1 * [0, 0])⟧,
⟦(1 * [0, 1])⟧,
⟦(1 * [0, 2])⟧,
⟦(1 * [1, 0])⟧,
⟦(1 * [1, 1])⟧,
⟦(1 * [2, 0])⟧]```

This is the same space as P₂Λ⁰ described above with the (quadratic) polynomials: 1, y, y², x, xy, x².

```julia> tpc
Basis{2,1,Int64}[
⟦(), (1 * [0, 0])⟧,
⟦(), (1 * [0, 1])⟧,
⟦(), (1 * [1, 0])⟧,
⟦(1 * [0, 0]), ()⟧,
⟦(1 * [0, 1]), ()⟧,
⟦(-1 * [0, 2]), (1 * [1, 1])⟧,
⟦(1 * [1, 0]), ()⟧,
⟦(-1 * [1, 1]), (1 * [2, 0])⟧]```

These are the basis elements for 1-forms. Each basis element has two components (for dx and dy). This space contains some, but not all quadratic polynomials. The 8 basis polynomials are: dy, y dy, x dy, dx, y dx, -x² dx + x y dy, x dx, - x y dx + y² dy.

```julia> tpc
Basis{2,2,Int64}[
⟦(1 * [0, 0])⟧,
⟦(1 * [0, 1])⟧,
⟦(1 * [1, 0])⟧]```

These are the basis element for 2-forms. The 3 (linear) basis polynomials are: dx ∧ dy, y dx ∧ dy, x dx ∧ dy.