2

I need a Taylor series approximation for $x(t)$, which is defined by the following differential equation.

$\frac{dx}{dt}=-k_1 x+(1-x)k_2 e^{-k_3 t}$, $x(0)=0$

     {
     D[x[t], t] == -k1 x[t] + (1 - x[t]) k2 Exp[-k2 t]
     , x[0] == 0
     }

How do I get the coefficients $x^{''}(0)$, $x^{'''}(0)$ from Mathematica?

rhermans
  • 36,518
  • 4
  • 57
  • 149
Bravo
  • 283
  • 1
  • 11
  • 2
    Have you tried to search this site for Taylor series? Series features prominently in the results... – Yves Klett Sep 16 '14 at 10:10
  • 1
    You ask questions in a way that gives the idea that you are nor even trying yourself. You are expected to at least try to search the documentation by yourself and also include Mathematica code with a minimal working formatted code example of your problem or your efforts. Only good questions are likely to get great answers. – rhermans Sep 16 '14 at 10:34

2 Answers2

3

Looks like homework, but anyway. The idea is to take derivatives, substituting from lower derivatives to rewrite e.g. x'' in terms of x' (which you can already rewrite in terms of x). Below I show this for x''[0]. Similar substitutuins, keeping track of past derivative rewrites, can be used to get higher derivatives to evaluate at t=0.

xprime[t] := -k1 x[t] + (1 - x[t]) k2 Exp[-k2 t]
substrule = x'[t] -> xprime[t];
x[0] = 0;

In[203]:= D[xprime[t], t] /. substrule /. t -> 0

(* Out[203]= -k1 k2 - 2 k2^2 *)
Daniel Lichtblau
  • 58,970
  • 2
  • 101
  • 199
2

Search the documentation for Taylor, first hit is Series.

Solve Differential equation,

sol = x[t] /. First@DSolve[
    {
     D[x[t], t] == -k1 x[t] + (1 - x[t]) k2 Exp[-k2 t]
     , x[0] == 0
     }
    , x[t], t];

You can get the series by Series[sol, {t, 0, 3}] but you are interested only in the 2nd and 3rd order coefficients, so you see at the bottom of the documentation the related functions and you find SeriesCoefficient

The Series 2nd order coefficient is:

SeriesCoefficient[sol, {t, 0, 2}]

-((k1 k2)/2) - k2^2

Third order:

SeriesCoefficient[sol, {t, 0, 3}]

1/6 (k1^2 k2 + 3 k1 k2^2 + 5 k2^3)

rhermans
  • 36,518
  • 4
  • 57
  • 149