0
$\begingroup$

I have this differential equation:

$$\ddot{x}-\frac{1}{6} \dot{x} - \frac{1}{6}x = e^t$$

When I DSolve it looks like this:

DSolve[x''[t] - 1/6 x'[t] - 1/6 x[t] == Exp[t], x[t], t]

Which gives me the correct answer. With that, we know I have the characteristic polynomial:

z^2 - 1/6 z - 1/6

I also find the roots:

Root[%,1]
Root[%%,2]

So all the results are correct. My question is, how can make this more easy for me, so I don't need to type manually the characteristic polynomial with its roots? I have tried with the function StringReplace to rewrite my differential equation into the characteristic polynomial, but it was messy and not functioning properly.

$\endgroup$
3
$\begingroup$

Let the ODE

ode=x''[t] - 1/6*x'[t] - 1/6*x[t] == Exp[t]

to get the characteristic polynomial we follow the literature:

cpoly = Simplify[(ode[[1]]/.x->(Exp[r*#]&))/Exp[r*t]]

now we calculate the roots:

{Root[cpoly,1], Root[cpoly,2]}

or

Solve[cpoly==0, r]

Also for the odes of the form

 ode=t^2*x''[t] - 1/6*t*x'[t] - 1/6 x[t] == Exp[t]

the only change is on the substitution:

cpoly2 = Simplify[(ode[[1]]/.x->(#^r&))/t^r]

Finally, if you want to have the multiplicity of the root handy you can use Tally:

Tally[Solve[cpoly==0, r]//Flatten]

| improve this answer | |
$\endgroup$
  • $\begingroup$ what if the characteristic polynomial has a different number of roots than 2? It might have 1, 3 or 4? $\endgroup$ – Jens Jensen Apr 17 '13 at 8:28
  • 2
    $\begingroup$ Thats why I gave also Solve. $\endgroup$ – Spawn1701D Apr 17 '13 at 8:38
1
$\begingroup$

First,

t1 = x''[t] - x'[t]/6 - x[t]/6 /. {Derivative[k_Integer][x][__] :> z^k, x[__] :> 1}
   -1/6 - z/6 + z^2

t2 = x'''[t] - 5 x'[t]/6 - 3 x[t] /. {Derivative[k_Integer][x][__] :> z^k, x[__] :> 1}
   -3 - 5 z/6 + z^3

Then,

z /. Solve[t1 == 0, z]
   {-1/3, 1/2}


z /. Solve[t2 == 0, z, Cubics -> False]
   {Root[-18 - 5 #1 + 6 #1^3 &, 1], Root[-18 - 5 #1 + 6 #1^3 &, 2],
    Root[-18 - 5 #1 + 6 #1^3 &, 3]}

Remove Cubics -> False to see the actual Cardano solution.

$\endgroup$
  • $\begingroup$ Thank you. But it only answer half of my question. It doesn't write the roots. {Root[%, 1], Root[%, 2]}could be added the line under. However I don't have 2 roots every time. Other times I have 1, 3 or 4. $\endgroup$ – Jens Jensen Apr 17 '13 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.