$$\DeclareMathOperator{\abs}{abs}$$

Let's solve a 2nd order nonhomogeneous equation $$y''-y'-2y=\cos(x)$$, $$y(0)=-1$$, $$y'(0)=2$$.

 (%i1) eq: 'diff(y,x,2)-'diff(y,x)-2*y = cos(x);
$(eq)\frac{{{d}^{2}}}{d\,{{x}^{2}}}\cdot y-\frac{d}{d\,x}\cdot y-2\cdot y=\mathrm{cos}\left( x\right)$
 (%i2) gsol: ode2(eq,y,x);
$(gsol)y=-\frac{\mathrm{sin}\left( x\right) +3\cdot \mathrm{cos}\left( x\right) }{10}+\mathit{\%k1}\cdot {{\%e}^{2\cdot x}}+\mathit{\%k2}\cdot {{\%e}^{-x}}$
 (%i3) psol:ic2(gsol,x=0,y=-1,'diff(y,x)=2);
$(psol)y=-\frac{\mathrm{sin}\left( x\right) +3\cdot \mathrm{cos}\left( x\right) }{10}+\frac{7\cdot {{\%e}^{2\cdot x}}}{15}-\frac{7\cdot {{\%e}^{-x}}}{6}$

Now let's verify the solution by plugging it in.

 (%i4) diff(rhs(psol),x,2)-diff(rhs(psol),x)-2*rhs(psol);
$\mathrm{\tt (\%o4) }\quad -2\cdot \left( -\frac{\mathrm{sin}\left( x\right) +3\cdot \mathrm{cos}\left( x\right) }{10}+\frac{7\cdot {{\%e}^{2\cdot x}}}{15}-\frac{7\cdot {{\%e}^{-x}}}{6}\right) -\frac{-\mathrm{sin}\left( x\right) -3\cdot \mathrm{cos}\left( x\right) }{10}+\frac{\mathrm{cos}\left( x\right) -3\cdot \mathrm{sin}\left( x\right) }{10}+\frac{14\cdot {{\%e}^{2\cdot x}}}{15}-\frac{7\cdot {{\%e}^{-x}}}{3}$
 (%i6) factor(%o4);
$\mathrm{\tt (\%o6) }\quad \mathrm{cos}\left( x\right)$

Now for a picture of the solution, noting that the $$e^{2x}$$ will make the solution blow up as $$x$$ grows:

 (%i9) wxplot2d(rhs(psol),[x,0,2]);
$\mathrm{\tt (\%t9) }\quad$ $\mathrm{\tt (\%o9) }\quad$
Created with wxMaxima. The source of this maxima session can be downloaded here.