# Nonlinear finite elements/Choosing weight function

## Choice of weighting functions

As you have seen, we need to know the weighting functions (also called test functions) in order to define the weak (or variational) statement of the problem more precisely.

Consider the second model problem (3). If ${\displaystyle w(x)}$ is a weighting function, then the weak form of equation (3) is

${\displaystyle {\text{(17)}}\qquad {\int _{0}^{1}\left[-{\frac {d^{2}}{dx^{2}}}[u(x)]+u(x)-x\right]~w(x)~dx=0}}$

Let the possible weighting functions ${\displaystyle w(x)}$ for this equation be such that they satisfy the boundary conditions, that is ${\displaystyle w(0)=0}$ and ${\displaystyle w(1)=0}$. This set of weighting functions will be denoted by the symbol ${\displaystyle {\mathcal {H}}}$.

The exact weak form of the problem can then be stated as:

{\displaystyle {\begin{aligned}{\text{Find}}~u(x)~&~{\text{such that}}\\&\int _{0}^{1}\left[-{\frac {d^{2}}{dx^{2}}}[u(x)]+u(x)-x\right]w(x)~dx\qquad {\text{for all}}~w(x)\in {\mathcal {H}}\\&u(0)=0,u(1)=0~;~~\qquad w(0)=0,w(1)=0~.\end{aligned}}}


To get to an approximate weak form, we need to choose trial functions. Let these trial functions (${\displaystyle u_{h}}$) reside in the function space ${\displaystyle {\mathcal {S}}}$. The approximate weak form of the problem is

{\displaystyle {\begin{aligned}{\text{Find}}~u_{h}(x)\in {\mathcal {S}}~&~{\text{such that}}\\&\int _{0}^{1}\left[-{\frac {d^{2}}{dx^{2}}}[u_{h}(x)]+u_{h}(x)-x\right]w(x)~dx\qquad {\text{for all}}~w(x)\in {\mathcal {H}}\\&u_{h}(0)=0,u_{h}(1)=0~;~~\qquad w(0)=0,w(1)=0~.\end{aligned}}}


One requirement that these trial functions (${\displaystyle u_{h}}$) have to satisfy is that

${\displaystyle \int _{0}^{1}\left({\cfrac {d^{2}u_{h}}{dx^{2}}}\right)w(x)~dx<\infty ~.}$

The trial functions also have to satisfy the boundary conditions.

If you look at the weak form shown above, you will notice that the highest derivatives of ${\displaystyle u_{h}}$ are of the second order while there are no derivatives of ${\displaystyle w}$. This leads to a lack of symmetry in the formulation that is usually avoided for numerical reasons.

To get a symmetric weak form, we integrate the first term inside the integral by parts to get

${\displaystyle \int _{0}^{1}{\frac {d^{2}u_{h}}{dx^{2}}}~w(x)~dx=\left.{\frac {du_{h}}{dx}}~w(x)\right|_{0}^{1}-\int _{0}^{1}{\frac {du_{h}}{dx}}{\frac {dw}{dx}}~dx~.}$

(Recall that the formula for integration by parts is ${\displaystyle \int a~db=ab-\int b~da}$.)

Applying the boundary conditions on ${\displaystyle w(x)}$, we get

${\displaystyle \int _{0}^{1}{\frac {d^{2}u_{h}}{dx^{2}}}~w(x)~dx=-\int _{0}^{1}{\frac {du_{h}}{dx}}{\frac {dw}{dx}}~dx~.}$

Therefore the problem can be restated in symmetric form as :

{\displaystyle {\text{(18)}}\qquad {\begin{aligned}{\text{Find}}~u_{h}(x)\in {\mathcal {H}}_{0}^{1}~&~{\text{such that}}\\&\int _{0}^{1}\left({\frac {du_{h}}{dx}}{\frac {dw}{dx}}+u_{h}~w-x~w\right)~dx=0\qquad ~{\text{for all}}~w(x)\in {\mathcal {H}}_{0}^{1}\\&u_{h}(0)=0,u_{h}(1)=0~;~~\qquad w(0)=0,w(1)=0\end{aligned}}}


Since the same order of derivatives appear in both the trial and the weighting functions, we can choose our functions from the same set ${\displaystyle {\mathcal {H}}_{0}^{1}}$, where ${\displaystyle {\mathcal {H}}={\mathcal {S}}={\mathcal {H}}_{0}^{1}}$. As you can see, the smoothness requirements on ${\displaystyle w}$ are further weakened. This boundary value problem is also called the variational boundary value problem.

The variational boundary value problem (18) can be (and often is) written using bilinear function notation as

{\displaystyle {\text{(19)}}\qquad {\begin{aligned}{\text{Find}}~u_{h}(x)\in {\mathcal {H}}_{0}^{1}~&~{\text{such that}}\\&a(u_{h},w)+(u_{h},w)-(x,w)=0\qquad ~{\text{for all}}~w(x)\in {\mathcal {H}}_{0}^{1}\\&u_{h}(0)=0,u_{h}(1)=0~;~~\qquad w(0)=0,w(1)=0\end{aligned}}}


where

${\displaystyle {a(u_{h},w)=\int _{0}^{1}{\frac {du_{h}}{dx}}{\frac {dw}{dx}}~dx~;\qquad (u_{h},w)=\int _{0}^{1}u_{h}~w~dx~;\qquad (x,w)=\int _{0}^{1}x~w~dx~.}}$

### Characteristics of ${\displaystyle {\mathcal {H}}_{0}^{1}}$

Let us now characterize ${\displaystyle {\mathcal {H}}_{0}^{1}}$, the class of admissible functions for the problem. We know that if ${\displaystyle u_{h}}$ and ${\displaystyle w}$ are irregular then their derivatives are even more irregular. Therefore, the most irregular term in the problem statement is

${\displaystyle \int _{0}^{1}{\frac {du_{h}}{dx}}{\frac {dw}{dx}}~dx~.}$

Now, both ${\displaystyle u_{h}}$ and ${\displaystyle w}$ are functions in the space ${\displaystyle {\mathcal {H}}_{0}^{1}}$. So we can choose ${\displaystyle w}$ to be equal to ${\displaystyle u_{h}}$. Hence the minimum requirement for ${\displaystyle w}$ is

${\displaystyle {\int _{0}^{1}\left({\frac {dw}{dx}}\right)^{2}~dx<\infty \qquad w(0)=w(1)=0~.}}$

Functions like the above are called square integrable.

Thus, our weighting functions have to be square integrable. This is a stricter condition than just requiring ${\displaystyle w}$ to be piecewise continuous, and reduces the number of functions that you can choose from.

There are two other interesting properties of the space ${\displaystyle {\mathcal {H}}_{0}^{1}}$. These are :

• It is a linear space which means that if ${\displaystyle w_{1}}$ and ${\displaystyle w_{2}}$ are two arbitrary functions in this space, then the following operations hold :
{\displaystyle {\begin{aligned}&w_{1}+w_{2}\in {\mathcal {H}}_{0}^{1}\\&\alpha w_{1}+\beta w_{2}\in {\mathcal {H}}_{0}^{1},\alpha ,\beta ~{\text{are scalars}}\end{aligned}}}
• It is an infinite dimensional space. This means that an infinity of parameters are needed to uniquely determine a weighting function ${\displaystyle w~\in {\mathcal {H}}_{0}^{1}}$. Thus,
${\displaystyle w(x)=\sum _{i=1}^{\infty }a_{i}N_{i}(x)}$
where, ${\displaystyle N_{i}}$ are linearly independent functions (also called basis functions) and ${\displaystyle a_{i}}$ are constants. If we choose only ${\displaystyle n}$ of these basis functions ${\displaystyle \{N_{1},N_{2},\dots ,N_{n}\}}$ then this is a ${\displaystyle n}$-dimensional (i.e., finite dimensional) subspace of ${\displaystyle {\mathcal {H}}_{0}^{1}}$ and we denote this as ${\displaystyle {\mathcal {H}}_{0}^{n}}$.