Checking something is a solution

Consider the ODE \(y” – 3y’ -4y = t^2 +2\). In class we came up with a particular solution: \( Y(t) = -1/4*t + 2/8*t – 29/32\). Here’s how you can get Sage to check quickly that you are correct.

t = var('t');
Y = -1/4*t^2 + 3/8*t - 29/32;
Y.diff(2) - 3*Y.diff() -4*Y

If you enter this in Sage, your output will be \(t^2 + 2\), which means \(Y(t)\) is a solution to the ODE given above.