Consider the one-dimensional Poisson’s equation
$$−u''(x) + u(x) = f(x), \hspace{5mm} x \in (a, b),$$ with $u(a) = g_{1}$, $u'(b) = g_2$.
Discretize the equation using the finite element method with piecewise linear basis functions.
I am not sure what to do. For the discretization of f(x) I was taught to use the hat function but I am still not sure.
Any help would be greatly appreciated.
Two references that should provide all necessary information, when combined together:
Assuming that you can do yourself the details of the right hand side in $\,-u''(x)+u(x)=f(x)$ .