I am trying to integrate a piecewise defined function twice. It represents the acceleration of a projectile. I am obtaining it's position as a function of time if it starts from rest at the ground, accelerates upward with a constant acceleration of 2.25 and then falls freely after 21.6 seconds. The code I am using to represent the scenario,
a[t_] := Piecewise[{{2.25, t < 21.6}, {-9.8, t > 21.60}}]
v[t_] := Integrate[a[s], {s, 0, t}]
x[t_] := Integrate[v[x], {x, 0, t}]
Plot[a[t], {t, 0, 30}]
Plot[v[t], {t, 0, 30}]
Plot[x[t], {t, 0, 30}]
Sometimes it will give me all three graphs, but usually it will just give me the first two, without the third. It then tells me,
Integrate::pwrl: Unable to prove that integration limits {0,x} are real. Adding assumptions may help. >>
I noticed that if I usually let Mathematica run long enough it will eventually spit out the last graph. I am just curious what is going on. I imagine it has something to do with an integration constant and Mathematica not able to tell what interval the piecewise function is on, but I am not quite sure if I can pint it down.
Any ideas? Or is there a better way to do what I am trying to do?
Integrate[v[x], {x,0,t}, Assumptions->{t \[Element] Reals}]
to make it assume the variable argument is a real number. $\endgroup$