# Polynomial Fitting

To introduce the idea of finding coefficients to functions, let's consider simple polynomial fitting.

In polynomial fitting (or interpolation) you have a set of points and you are looking for the coefficients to a function that has the form: (1)

Where , and are scalar coefficients and , , $ are "basis functions".

Find , , , etc. such that f(x) passes through the points you are given.

More generally you are looking for: (2) where the are coefficients to be determined.

is unique and interpolary if is the same as the number of points you need to fit.

Need to solve a linear system to find the coefficients.

# Example

Define a set of points: (3)

Substitute data into the model: (4)

Leads to the following linear system for , , and : (5)

Solving for the coefficients results in: (6)

These define the solution

*function*: (7)Important! The solution is the function,

*not*the coefficients.

The coefficients themselves don't mean anything, by themselves they are just numbers.

The solution is

*not*the coefficients, but rather the*function*they create when they are multiplied by their respective basis functions and summed.The function does go through the points we were given,

*but it is also defined everywhere in between*.We can evaluate at the point , for example, by computing: or more generically: where the correspond to the coefficients in the solution vector, and the are the respective functions.

Finally, note that the matrix consists of evaluating the functions at the points.

# Finite Elements Simplified

A method for numerically approximating the solution to Partial Differential Equations (PDEs).

Works by finding a solution function that is made up of "shape functions" multiplied by coefficients and added together.

Just like in polynomial fitting, except the functions aren't typically as simple as (although they can be).

The Galerkin Finite Element method is different from finite difference and finite volume methods because it finds a piecewise continuous function which is an approximate solution to the governing PDE.

Just as in polynomial fitting you can evaluate a finite element solution anywhere in the domain.

You do it the same way: by adding up "shape functions" evaluated at the point and multiplied by their coefficient.

FEM is widely applicable for a large range of PDEs and domains.

It is supported by a rich mathematical theory with proofs about accuracy, stability, convergence and solution uniqueness.

# Weak Form

Using FE to find the solution to a PDE starts with forming a "weighted residual" or "variational statement" or "weak form". - We typically refer to this process as generating a Weak Form.

The idea behind generating a weak form is to give us some flexibility, both mathematically and numerically.

A weak form is what you need to input to solve a new problem.

Generating a weak form generally involves these steps:

Write down strong form of PDE.

Rearrange terms so that zero is on the right of the equals sign.

Multiply the whole equation by a "test" function .

Integrate the whole equation over the domain .

Integrate by parts (use the divergence theorem) to get the desired derivative order on your functions and simultaneously generate boundary integrals.

# Refresher: The divergence theorem

Transforms a volume integral into a surface integral: (8)

Slight variation: multiply by a smooth function, : (9)

In finite element calculations, for example with , the divergence theorem implies: (10)

We often use the following inner product notation to represent integrals since it is more compact: (11)

# Example: Convection Diffusion

Write the strong form of the equation: (12)

Rearrange to get zero on the right-hand side: (13)

Multiply by the test function : (14)

Integrate over the domain : (15)

Apply the divergence theorem to the diffusion term: (16)

Write in inner product notation. Each term of the equation will inherit from an existing MOOSE type as shown below. (17)