I am working on systems of multiple coupled harmonic oscillators, where we might in the simplest case have a single line of masses each coupled with springs to its neighbor masses, with something like the following system of 4 ODEs:
m1 x1''[t] = k(x2[t] - x1[t]) + k( 0 - x1[t])
m2 x2''[t] = k(x3[t] - x2[t]) + k(x1[t] - x2[t])
m3 x3''[t] = k(x4[t] - x3[t]) + k(x2[t] - x3[t])
m4 x4''[t] = k( 0 - x4[t]) + k(x3[t] - x4[t])
With the two end springs attached to fixed positions, the whole line of oscillators acts like a discrete version of a stretched string. It exhibits normal modes, which are the finite-dimensional eigenvectors, oscillating at frequencies which are the corresponding eigenvalues. The eigenvalue appears as omega in the exponent of the solution vector, for example,
{x1[t_] := a1 Exp[I omega t], x2[t_]:= a2 Exp[I omega t]...} and so on.
Although DSolve works for these, I want to experiment with DEigensystem. Unfortunately almost all examples for DEigensystem in the documentation are for partial differential equations. I have looked for a good example of DEigensystem with coupled ODEs, but I can't seem to find one, and my attempts to call the function have failed with the function and its arguments returned unchanged. Can DEigensystem be used for that kind of system of ODEs? If so, does anyone have an example?
Here is a working example using DSolve:
(* Begin working code example *)
Needs["VariationalMethods`"]
\[Omega]Substitutions = First[Solve[{Sqrt[k]/Sqrt[m] == \[Omega]1, Sqrt[k + 2*kprime]/Sqrt[m] == \[Omega]2}, {k, kprime}]]
ke = (1/2)*m*Derivative[1][x1][t]^2 +(1/2)*m*Derivative[1][x2][t]^2;
pe = (1/2)*k*x1[t]^2 + (1/2)*kprime*(x2[t] - x1[t])^2 + (1/2)*k*x2[t]^2;
lagrangian = ke - pe /. \[Omega]Substitutions
eulerLagrEquations = EulerEquations[lagrangian, {x1[t], x2[t]}, t]
equationsAndInitialConditions = Join[{eulerLagrEquations, x1[0] == x10, x2[0] == x20, Derivative[1][x1][0] == v10, Derivative[1][x2][0] == v20}];
solutions = FullSimplify[DSolve[equationsAndInitialConditions, {x1[t], x2[t]}, t]]
numericSolutions = N[solutions] /. {\[Omega]1 -> 0.1, \[Omega]2 -> 0.142857, m -> 1, v10 -> 0, v20 -> 0, x10 -> 0, x20 -> 0.05};
Plot[{x1[t] /. numericSolutions, x2[t] + 0.1 /. numericSolutions}, {t, 0, 200}, PlotRange -> {-0.15, 0.15}]
EulerEquations
requires theVariationalMethods
package. You may wish to edit your code to includeNeeds["VariationalMethods`"]
. $\endgroup$