Why doesn't LaplaceTransform work?

LaplaceTransform[y’‘[t] - 2 y’[t] + y[t] == 1 + t, t,
s] /. {y[0] → 1, y’[0] → 0}

I get

LaplaceTransform[
  y[t] - 2 Derivative[1][y][t] + (y^\[Prime]\[Prime])[t], t, s] == 
 1/s^2 + 1/s

LaplaceTransform works on functions rather than equation. Taking a guess at what you want, we can solve for this Laplace transform in a couple of steps as below.

laplaceratfun = 
 LaplaceTransform[y''[t] - 2 y'[t] + y[t] - (1 + t), t, 
   s] /. {y[0] -> 1, y'[0] -> 0}

(* Out[1285]= -(1/s^2) - 1/s - s + LaplaceTransform[y[t], t, s] + 
 s^2 LaplaceTransform[y[t], t, s] - 
 2 (-1 + s LaplaceTransform[y[t], t, s]) *)

Solve[laplaceratfun == 0, LaplaceTransform[y[t], t, s]]

(* Out[1286]= {{LaplaceTransform[y[t], t, s] -> (
   1 + s - 2 s^2 + s^3)/((-1 + s)^2 s^2)}} *)

This procedure does not work for Mathematica 12.2 and later.

What procedure does not work in version 12.2 and later? Certainly what I showed works in 13; that’s where I ran it.

Mariano,

This procedure does not work …

could it be that there is something wrong with your installation of Mathematica? Because not only Daniels code is working, but also your very first code above as well! Here a combination with Daniels code:

ClearAll["Global`*"]
eq = y''[t] - 2 y'[t] + y[t] == 1 + t;
(* transformed equation: *)
lteq = LaplaceTransform[eq, t, s] /. {y[0] -> 1, y'[0] -> 0};
(* solution of transformed equation: *)
ltsol = First@SolveValues[lteq, LaplaceTransform[y[t], t, s]];
(* solution - transformed back: *)
y[t_] = InverseLaplaceTransform[ltsol, s, t];
(* check: *)
eq // Simplify
(*   Out:   True   *)