daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Feb 19th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. deqns = {Subscript[m, 1] x1''[
  2.   t] == ([Lambda]1[t]/Subscript[l, 1]) x1[
  3.    t] - ([Lambda]2[t]/Subscript[l, 2]) (x2[t] - x1[t]),
  4.   Subscript[m, 1] y1''[
  5.   t] == ([Lambda]1[t]/Subscript[l, 1]) y1[
  6.    t] - ([Lambda]2[t]/Subscript[l, 2]) (y2[t] - y1[t]) -
  7.   Subscript[m, 1] g,
  8.   Subscript[m, 2] x2''[
  9.   t] == ([Lambda]2[t]/Subscript[l, 2]) (x2[t] - x1[t]),
  10.   Subscript[m, 2] y2''[
  11.   t] == ([Lambda]2[t]/Subscript[l, 2]) (y2[t] - y1[t]) -
  12.   Subscript[m, 2] g};
  13.  
  14. aeqns = {x1[t]^2 + y1[t]^2 ==
  15.   Subscript[l, 1]^2, (x2[t] - x1[t])^2 + (y2[t] - y1[t])^2 ==
  16.   Subscript[l, 2]^2};
  17.  
  18. ics = {x1[0] == 1, y1[0] == 0, y1'[0] == 0, x2[0] == 1, y2[0] == -1,
  19.   y2'[0] == 0};
  20.  
  21. params = {g -> 9.81, Subscript[m, 1] -> 1, Subscript[m, 2] -> 1,
  22.   Subscript[l, 1] -> 1, Subscript[l, 2] -> 1};
  23.  
  24. soldp = First[
  25.   NDSolve[{deqns, aeqns, ics} /. params, {x1, y1, x2,
  26.   y2, [Lambda]1, [Lambda]2}, {t, 0, 15000},
  27.   Method -> {"IndexReduction" -> {"Pantelides",
  28.     "ConstraintMethod" -> "Projection"}}]];
  29.      
  30. SmoothDensityHistogram[
  31.   Map[Function[Evaluate[{x2[#], y2[#]} /. soldp]],
  32.    Range[0, 15000, 0.025]], Mesh -> 5,
  33.   PlotRange -> {{-2, 2}, {-2, 0.1}}]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top