# Nonlinear finite elements/Nonlinear axial bar weak form
## Weak form of non-linear axial bar

Having discussed the equations of the non-linear axial bar, we proceed to construct a finite element approximation. The first step in obtaining the finite element approximation is to construct the weak form. To obtain the weak form we multiply the equilibrium equations discussed in the previous section with a test function (weighting function) and integrate over the whole domain $[0,L]$.
    $\int _{[0,L]}{\frac {d}{dx}}\left(AE\left(1+{\frac {du}{dx}}\right){\frac {du}{dx}}\right)\varphi +q\varphi =0$
$\varphi$ is the test function or the weighting function. Now we apply integration by parts to shift a derivative from the first term to the test function.
    $\int _{[0,L]}AE\left(1+{\frac {du}{dx}}\right){\frac {du}{dx}}{\frac {d\varphi }{dx}}+\left(AE\left(1+{\frac {du}{dx}}\right){\frac {du}{dx}}\right)|_{x=0}^{x=L}=\int _{[0,L]}q\varphi$
We consider a pure Dirichlet problem, i.e) no traction conditions are applied on the boundary of the bar, hence we ignore the boundary term. The weak form of the pure Dirichlet problem, for the non-linear axial bar is given by,
    $\int _{[0,L]}AE\left(1+{\frac {du}{dx}}\right){\frac {du}{dx}}{\frac {d\varphi }{dx}}=\int _{[0,L]}q\varphi ;\;\;\;u(0)={\bar {u}}$
${\bar {u}}$ is the displacement condition specified on the left boundary. Note that the weak form is not linear in the displacement field $u$, this is because of the non-linearity introduced in the constitutive relation. The above equation serves as the starting point for the numerical solution (FEM) of the non-linear axial bar.

## Finite element approximation

The weak form of the pure Dirichlet problem for the non-linear axial bar can be thought of as non-linear operators acting on appropriate function space, the problem is to find $u$ in an appropriate function space for a prescribed body force $q$ such that the weak form is satisfied for all test functions $\varphi$. Instead of searching a solution in an infinite dimensional function space, using finite element one approximates the solution in a finite dimensional function space. We denote the finite element approximation for the solution as $u^{h}$ and the finite dimensional approximation for functions in the trial space as $\varphi ^{h}$. Here we assume the solution space (trial space) and the test space to be same (spanned by the same set of vectors).
Any function in the test and trial space can be written as,
    $u^{h}=\sum _{j}{\tilde {u}}_{j}N_{j};\;\;\;\varphi ^{h}=\sum _{j}{\tilde {\varphi }}_{j}N_{j}$
Substituting the finite element approximation into the weak form, we get
    $\int _{[0,L]}AE\left(\left(1+\sum _{i}{\frac {dN_{i}}{dx}}{\tilde {u}}_{i}\right)\sum _{i}{\frac {dN_{i}}{dx}}{\tilde {u}}_{i}\right){\frac {dN_{j}}{dx}}{\tilde {\varphi }}_{i}=\int _{[0,L]}\sum _{j}N_{j}q{\tilde {\varphi }}$
Using the arbitrariness of the trial function we can obtain the following relationship between the nodal degrees of freedom and nodal forces.
    $\int _{[0,L]}AE\left(\left(1+\sum _{i}{\frac {dN_{i}}{dx}}{\tilde {u}}_{i}\right)\sum _{i}{\frac {dN_{i}}{dx}}{\tilde {u}}_{i}\right){\frac {dN_{j}}{dx}}=\int _{[0,L]}\sum _{j}N_{j}q$
One should note that the solution for infinite dimensional weak form is now reduced to finding the roots of a non-linear equation in $\mathbb {R} ^{n}$. In the next section we will discuss some procedures to solve this non-linear nodal displacement nodal force relation.