# create.FEM.basis: Create a FEM basis In fdaPDE: Functional Data Analysis and Partial Differential Equations; Statistical Analysis of Functional and Spatial Data, Based on Regression with Partial Differential Regularizations

## Description

Sets up a Finite Element basis. It requires a triangular mesh, a `MESH2D` object, as input. The basis' functions are globally continuos surfaces, that are polynomials once restricted to a triangle in the mesh. Linear if (`order = 1`) in the input `mesh` and quadratic if (`order = 2`) in the input `mesh` Finite Element are currently implemented.

## Usage

 `1` ```create.FEM.basis(mesh) ```

## Arguments

 `mesh` A `MESH2D` object representing the domain triangulation. See create.MESH.2D.

## Value

A `FEMbasis` object. This contains the `mesh`, along with some additional quantities:

 `order` Either "1" or "2". Order of the Finite Element basis. `nbasis` Scalar. The number of basis. `detJ` The determinant of the transformation from the nodes of the reference triangle to the nodes of the i-th triangle; this coincides with the double of the area of the i-th triangle. `transf` A three-dimensional array such that `transf[i,,]` is the 2-by-2 matrix that transforms the nodes of the reference triangle to the nodes of the i-th triangle. `metric` A three-dimensional array such that `metric[i,,]` is the 2-by-2 matrix `transf[i,,]^{-1}*transf[i,,]^{-T}`. This matrix is used for the computation of the integrals over the elements of the mesh.

`create.MESH.2D`

## Examples

 ```1 2 3 4 5 6 7``` ```## Creates a simple triangulated domain with a concavity; this is a MESH2D object mesh<-create.MESH.2D(nodes=rbind(c(0, 0), c(0, 1), c(0.5, 0.5), c(1, 1), c(1, 0)), segments=rbind(c(1, 2), c(2, 3), c(3, 4), c(4, 5), c(5, 1)), order=1) ## Plot it plot(mesh) ## Creates the basis FEMbasis = create.FEM.basis(mesh) ```

### Example output

```Loading required package: rgl
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE