# Don't understand why my Taylor expansion results in a message and an unexpected result

Trying to do something simple: Taylor expand a generic function of t around a point t and substitute t0 + h for t. Here's my expression:

y1[t0_, h_] = Module[{t}, Series[y[t], {t, t0, 2}] /. t -> t0 + h]


This results the message

SeriesData::sdatv: First argument h + t0 is not a valid variable.

and it gives the result

y[t0] + y′[t0]((h + t0) - t0) + 1/2 y′′[t0] ((h + t0) - t0)^2 + O[(h + t0) - t0]^3


This is what I'm looking for, except all of the (h + t0) - t0 stuff. Why is this not simplifying to h? In fact, if I substitute 6 for t0, I get (h + 6) - 6. So there is enough information there to know that when it substitutes for t0, it substitutes for all t0, but it still treats one of the t0's as different from the other for purposes of simplification.

I sense that I'm missing something basic.

Change the argument of y to t0 + h
y1[t0_, h_] = Module[{t}, Series[y[h + t0], {h, 0, 2}]]

• Why not just y1[t0_, h_] = Series[y[h + t0], {h, 0, 2}] – m_goldberg Feb 14 '15 at 2:56
• @m_goldberg left the expression enclosed in the Module, in case the OP had some reason to have it there. You are correct that it does nothing in this toy problem. – bbgodfrey Feb 14 '15 at 2:59