Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- l = 0.6 (1 + 0.00 I); g = 9.8;
- x0 = 0.01;
- coord[n_] := Table[Subscript[x, i][t], {i, n}];
- vel[n_] := D[coord[n], t];
- mass[1] = {x0 Cos[[Omega] t], 0};
- mass[i_] :=
- mass[i - 1] + {l Sin[Subscript[x, i - 1][t]], -l Cos[
- Subscript[x, i - 1][t]]};
- ke[i_] := With[{v = D[mass[i + 1], t]}, v.v/2];
- pe[i_] := g mass[i + 1][[2]];
- L[n_] := Sum[ke[i] - pe[i], {i, n}];
- eq[n_] :=
- Table[D[D[L[n], vel[n][[m]]], t] - D[L[n], coord[n][[m]]] == 0, {m,
- n}];
- ic[n_] :=
- Table[{Subscript[x, i][0] == 0, Subscript[x, i]'[0] == 0}, {i, n}] //
- Flatten;
- SOL[n_] :=
- NDSolve[{FullSimplify[eq[n]] /. [Omega] -> 1, ic[n]} // Flatten,
- Table[Subscript[x, i][t], {i, n}], {t, 0, 100},
- Method -> {"EquationSimplification" -> "Residual"}]
- NDSolve::icfail: Unable to find initial conditions that satisfy the residual function within specified tolerances. Try giving initial conditions for both values and derivatives of the functions. >>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement