I have the following 1-dimensional Poisson's problem with the corresponding boundary conditions:
$$ u_{xx} = -f(x) ; \quad u(1) = g, \quad -u_x(0) = h $$ on a open domain $$ \Omega = (0,1) $$
Is it correct to represent an analytical solution as follows?
First, integrating with respect to $x$ once from $0$ to $y$:
$$ \int_0^y u_{xx} dx = -\int_0^y f(x)dx $$
to obtain: $$ u_x(y) - u_x(0) = -\int_0^y f(x)dx $$ Applying the BC, $$ u_x(y) = -\int_0^y f(x)dx + h $$ Let $$ f(z) = \int_0^y f(x)dx $$
and then integrating the previous equation with respect to $y$ from $x$ to $1$: $$ u(1) - u(x) = \int_x^1 f(z)dy + hy|_x^1 $$ Applying the boundary condition $u(1)=g$ and then putting $f(z)$ back to its original form: $$ u(x) = g + h(1-x) + \int_x^1 \left[ \int_0^y f(x)dx \right]dy $$ I'm doing this since I require the representation of the exact solution to compare with the solution obtained from the Galerkin approximation. Is there anything wrong with the steps I've shown above? Please criticize.
You can just check it.
$$u(x)=g+h\cdot (1-x)+\int_{x}^1\int_0^y f(t)\mathrm dt \mathrm dy \\ u'(x)=-h+\frac{\mathrm d}{\mathrm dx}\left(\int_{x}^1\int_0^y f(t)\mathrm dt \mathrm dy\right) \\ =-h-\int_0^x f(t)\mathrm dt$$ $$u''(x)=-\frac{\mathrm d}{\mathrm dx}\int_0^x f(t)\mathrm dt=-f(x)$$
And, $$u(1)=g+\underbrace{h\cdot(1-1)}_{=0}+\underbrace{\int_1^1\cdots}_{=0}=g$$ $$u'(0)=-h-\underbrace{\int_{0}^0\cdots}_{=0}$$
Everything looks good.
In regards to the second line.
Let $F(y)=\int_0^y f(t)\mathrm dt$. Then, $$u'(x)=-h+\frac{\mathrm d}{\mathrm dx}\int_x^1 F(y)\mathrm dy \\ =-h-\frac{\mathrm d}{\mathrm dx}\int_1^x F(y)\mathrm dy$$ By the FTC, this is $$u'(x)=-h-F(x) \\ =-h-\int_0^x f(t)\mathrm dt$$ The rest follows.