<s>[INST] $y''+y=x^2+1, y(\pi)=\pi^2, y'(\pi)=2\pi$ - By Laplace Transform I am solving the following IVP by Laplace Transform:
$$y''+y=x^2+1,\qquad y(\pi)=\pi^2, \qquad y'(\pi)=2\pi$$
Let $f(x)=u_{\pi}(x)y(x-\pi).$ Then,
$$f''(x)+f'(x)=u_{\pi}(x)(x-\pi)^2+u_{\pi}(x), \qquad f(0)=\pi ^2, \qquad f'(0)=2\pi.$$
Using the Laplace Transform and writing $F:=\mathcal{L}\{f\}(s)$, we have
$$s^2F-sf(0)-f'(0)+F=e^{-\pi s}\dfrac{s+1}{s^2},$$
$$(s^2+1)F-(s+1)\pi^2-2\pi=e^{-\pi s}\dfrac{s+1}{s^2},$$
$$F=e^{-\pi s}\dfrac{s+1}{s^2(s^2+1)}+\dfrac{(s+1)\pi^2}{(s^2 +1)}+\dfrac{2\pi}{(s^2+1)}.$$
Be
$$\dfrac{s+1}{s^2(s^2+1)}=\dfrac{As+B}{s^2}+\dfrac{Cs+D}{s^2+1}. $$
We have
$$As^3+As+Bs^2+B+Cs^3+Ds^2=s+1,$$
$$A+C=0, B+D=0, A=1, B=1,$$
$$C=-1, D=-1, A=1, B=1.$$
So,
$$\dfrac{s+1}{s^2(s^2+1)}=\dfrac{s+1}{s^2}-\dfrac{s+1}{s^2+1}= \dfrac{1}{s}+\dfrac{1}{s^2}-\dfrac{s}{s^2+1}-\dfrac{1}{s^2+1}.$$
Then,
$$F=e^{-\pi s}\left(\dfrac{1}{s}+\dfrac{1}{s^2}-\dfrac{s}{s^2+1}-\dfrac {1}{s^2+1}\right)+\pi^2\left(\dfrac{s}{s^2+1}+\dfrac{1}{s^2+1}\right)+ 2\pi\dfrac{1}{s^2+1}.$$
By the inverse transform,
$$f(x)=u_\pi(x)\left(1+(x-\pi)-\cos(x-\pi)-\sin(x-\pi)\right)+\pi^2 \left(\cos(x)+\sin(x)\right)+2\pi\sin(x).$$
Returning to the variable $y$ and remembering that $\cos(x+\pi)=-\cos(x)$ and $\sin(x+\pi)=-\sin(x)$, we have
$$y(x)=1+x-\cos(x)-\sin(x)+\pi^2(-\cos(x)-\sin(x))-2\pi \sin (x) .$$

However, the Wolfram's solution is $y(x)=-1 + x^2 - \cos(x)$.

Thank you in advance!
 [/INST] After Laplace transformation we have
$$
Y(s) = \frac{s^2+y_0s^4+s^3y'_0+2}{s^3(s^2+1)}
$$
with inverse
$$
y(x) = x^2+\sin (x) y'_0+y_0 \cos (x)+\cos (x)-1
$$
here $y_0$ and $y'_0$ are generic constants so imposing the initial conditions we have
$$
\cases{
y(\pi) = \pi^2-y_0-2=\pi^2\\
y'(\pi) = 2\pi-y'_0=2\pi
}
$$
and solving we have $y_0 = -2,\ y'_0 = 0$
hence
$$
y(x) = x^2-\cos x-1
$$
</s>