1

Is there a built-in function that expresses a 2nd order ODE as 1st order ODE's? If not, how can one decouple a 2nd ODE to a first-order one using Mathematica?

I couldn't find it here: Why is NDSolve solving in term of two 1st order ODE slower than 2nd order?

MarcoB
  • 67,153
  • 18
  • 91
  • 189
l0293624
  • 11
  • 1

1 Answers1

0

Using NonlinearStateSpaceModel

fode = NonlinearStateSpaceModel[m y''[t] + c y'[t] + k y[t] == f[t], {y[t], y'[t]}, f[t], {}, t]

enter image description here

To extract the parts

With[{res = NonlinearStateSpaceModel[fode, {x1[t], x2[t]}] // Normal},
 ApplySides[MatrixForm@*Transpose@*List, D[res[[2]], t] == res[[1, 1]]]]

enter image description here

Suba Thomas
  • 8,716
  • 1
  • 17
  • 32
  • the NonlinearStateSpaceModel is really neat, thanks! But this raises the question: How come I couldn't find it in the documentation while searching for a built-in function that converts an ODE to a first-order system? – l0293624 Dec 04 '19 at 15:36