Yukterez

Gravity & Charge, 4 Body Simulator

Feb 16th, 2019 (edited)
132
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (* |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| *)
  2. (* ||| Mathematica Syntax || yukterez.net || 4 Body Newtonian Mass & Charge Simulator ||| *)
  3. (* |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| *)
  4.  
  5. ClearAll["Global`*"]; ClearAll["Local`*"];
  6. Needs["DifferentialEquations`NDSolveProblems`"];
  7. Needs["DifferentialEquations`NDSolveUtilities`"];
  8.  
  9. Amp = 1; kg = 1; m = 1; sek = 1; km = 1000 m; (* SI Einheiten *)
  10.  
  11. mt1 = {"StiffnessSwitching", Method-> {"ExplicitRungeKutta", Automatic}};
  12. mt2 = {"ImplicitRungeKutta", "DifferenceOrder"-> 20};
  13. mt3 = {"EquationSimplification"-> "Residual"};
  14. mt0 = Automatic;
  15. mta = mt2;
  16. wp = MachinePrecision;
  17.  
  18. (* Plot Optionen *)
  19.  
  20. Tmax = 2π sek;
  21. tMax = Min[Tmax, plunge];
  22. trail = π/3 sek;
  23. point = 0.015;
  24. thk = 0.004;
  25. plotrange = 1.2 m {{-1, +1}, {-1, +1}, {-1, +1}};
  26. viewpoint = {0, Infinity, 0};
  27. imagesize = 430;
  28. startpos = 0;
  29.  
  30. (* Konstanten *)
  31.  
  32. G = 667384/10^16 m^3/kg/sek^2;
  33. Λ = 11056*^-56/m^2;
  34. ε0 = 8854187817*^-21 Amp^2 sek^4/kg/m^3;
  35. c = 299792458 m/sek;
  36. Au = 149597870700 m;
  37. dy = 24*3600 sek;
  38. yr = 36525*dy/100;
  39.  
  40. (* Körper 1 *)
  41.  
  42. m1 = 1 m^3/sek^2/G;
  43. q1 = 0 Amp sek;
  44.  
  45. x1x = 1.00231488346205 m;
  46. y1y = 0 m;
  47. z1z = 0 m;
  48.  
  49. v1x = 0 m/sek;
  50. v1y = 0 m/sek;
  51. v1z = -0.293790277732029 m/sek;
  52.  
  53. (* Körper 2 *)
  54.  
  55. m2 = 1 m^3/sek^2/G;
  56. q2 = 0 Amp sek;
  57.  
  58. x2x = -0.52869409402363 m;
  59. y2y = 0 m;
  60. z2z = 0.567125954067238 m;
  61.  
  62. v2x = -0.175826619093916 m/sek;
  63. v2y = 0 m/sek;
  64. v2z = 1.02361310165052 m/sek;
  65.  
  66. (* Körper 3 *)
  67.  
  68. m3 = 1 m^3/sek^2/G;
  69. q3 = 0 Amp sek;
  70.  
  71. x3x = 0.0550733045852099 m;
  72. y3y = 0 m;
  73. z3z = 0 m;
  74.  
  75. v3x = 0 m/sek;
  76. v3y = 0 m/sek;
  77. v3z = -1.75343592556901 m/sek;
  78.  
  79. (* Körper 4 *)
  80.  
  81. m4 = 1 m^3/sek^2/G;
  82. q4 = 0 Amp sek;
  83.  
  84. x4x = -0.528694094023634 m;
  85. y4y = 0 m;
  86. z4z = -0.567125954067235 m;
  87.  
  88. v4x = 0.175826619093915 m/sek;
  89. v4y = 0 m/sek;
  90. v4z = 1.02361310165051 m/sek;
  91.  
  92. (* Differentialgleichung *)
  93.  
  94. nds=NDSolve[{
  95.  
  96. x1'[t] == vx1[t], y1'[t] == vy1[t], z1'[t] == vz1[t],
  97. x2'[t] == vx2[t], y2'[t] == vy2[t], z2'[t] == vz2[t],
  98. x3'[t] == vx3[t], y3'[t] == vy3[t], z3'[t] == vz3[t],
  99. x4'[t] == vx4[t], y4'[t] == vy4[t], z4'[t] == vz4[t],
  100.  
  101. vx1'[t] ==
  102. (G m2 (x2[t]-x1[t]))/Sqrt[((x2[t]-x1[t])^2+(y2[t]-y1[t])^2+(z2[t]-z1[t])^2)^3]+
  103. (G m3 (x3[t]-x1[t]))/Sqrt[((x3[t]-x1[t])^2+(y3[t]-y1[t])^2+(z3[t]-z1[t])^2)^3]+
  104. (G m4 (x4[t]-x1[t]))/Sqrt[((x4[t]-x1[t])^2+(y4[t]-y1[t])^2+(z4[t]-z1[t])^2)^3]+
  105. If[q1 == 0, 0,
  106. (-q1*q2/(4Pi ε0 )/m1 (x2[t]-x1[t]))/Sqrt[((x2[t]-x1[t])^2+(y2[t]-y1[t])^2+(z2[t]-z1[t])^2)^3]+
  107. (-q1*q3/(4Pi ε0 )/m1 (x3[t]-x1[t]))/Sqrt[((x3[t]-x1[t])^2+(y3[t]-y1[t])^2+(z3[t]-z1[t])^2)^3]+
  108. (-q1*q4/(4Pi ε0 )/m1 (x4[t]-x1[t]))/Sqrt[((x4[t]-x1[t])^2+(y4[t]-y1[t])^2+(z4[t]-z1[t])^2)^3]]+
  109. Λ*c^2*x1[t]^2/Sqrt[x1[t]^2+y1[t]^2+z1[t]^2],
  110.  
  111. vy1'[t] ==
  112. (G m2 (y2[t]-y1[t]))/Sqrt[((x2[t]-x1[t])^2+(y2[t]-y1[t])^2+(z2[t]-z1[t])^2)^3]+
  113. (G m3 (y3[t]-y1[t]))/Sqrt[((x3[t]-x1[t])^2+(y3[t]-y1[t])^2+(z3[t]-z1[t])^2)^3]+
  114. (G m4 (y4[t]-y1[t]))/Sqrt[((x4[t]-x1[t])^2+(y4[t]-y1[t])^2+(z4[t]-z1[t])^2)^3]+
  115. If[q1 == 0, 0,
  116. (-q1*q2/(4Pi ε0 )/m1 (y2[t]-y1[t]))/Sqrt[((x2[t]-x1[t])^2+(y2[t]-y1[t])^2+(z2[t]-z1[t])^2)^3]+
  117. (-q1*q3/(4Pi ε0 )/m1 (y3[t]-y1[t]))/Sqrt[((x3[t]-x1[t])^2+(y3[t]-y1[t])^2+(z3[t]-z1[t])^2)^3]+
  118. (-q1*q4/(4Pi ε0 )/m1 (y4[t]-y1[t]))/Sqrt[((x4[t]-x1[t])^2+(y4[t]-y1[t])^2+(z4[t]-z1[t])^2)^3]]+
  119. Λ*c^2*y1[t]^2/Sqrt[x1[t]^2+y1[t]^2+z1[t]^2],
  120.  
  121. vz1'[t] ==
  122. (G m2 (z2[t]-z1[t]))/Sqrt[((x2[t]-x1[t])^2+(y2[t]-y1[t])^2+(z2[t]-z1[t])^2)^3]+
  123. (G m3 (z3[t]-z1[t]))/Sqrt[((x3[t]-x1[t])^2+(y3[t]-y1[t])^2+(z3[t]-z1[t])^2)^3]+
  124. (G m4 (z4[t]-z1[t]))/Sqrt[((x4[t]-x1[t])^2+(y4[t]-y1[t])^2+(z4[t]-z1[t])^2)^3]+
  125. If[q1 == 0, 0,
  126. (-q1*q2/(4Pi ε0 )/m1 (z2[t]-z1[t]))/Sqrt[((x2[t]-x1[t])^2+(y2[t]-y1[t])^2+(z2[t]-z1[t])^2)^3]+
  127. (-q1*q3/(4Pi ε0 )/m1 (z3[t]-z1[t]))/Sqrt[((x3[t]-x1[t])^2+(y3[t]-y1[t])^2+(z3[t]-z1[t])^2)^3]+
  128. (-q1*q4/(4Pi ε0 )/m1 (z4[t]-z1[t]))/Sqrt[((x4[t]-x1[t])^2+(y4[t]-y1[t])^2+(z4[t]-z1[t])^2)^3]]+
  129. Λ*c^2*z1[t]^2/Sqrt[x1[t]^2+y1[t]^2+z1[t]^2],
  130.  
  131. vx2'[t] ==
  132. (G m1 (x1[t]-x2[t]))/Sqrt[((x1[t]-x2[t])^2+(y1[t]-y2[t])^2+(z1[t]-z2[t])^2)^3]+
  133. (G m3 (x3[t]-x2[t]))/Sqrt[((x3[t]-x2[t])^2+(y3[t]-y2[t])^2+(z3[t]-z2[t])^2)^3]+
  134. (G m4 (x4[t]-x2[t]))/Sqrt[((x4[t]-x2[t])^2+(y4[t]-y2[t])^2+(z4[t]-z2[t])^2)^3]+
  135. If[q2 == 0, 0,
  136. (-q2*q1/(4Pi ε0 )/m2 (x1[t]-x2[t]))/Sqrt[((x1[t]-x2[t])^2+(y1[t]-y2[t])^2+(z1[t]-z2[t])^2)^3]+
  137. (-q2*q3/(4Pi ε0 )/m2 (x3[t]-x2[t]))/Sqrt[((x3[t]-x2[t])^2+(y3[t]-y2[t])^2+(z3[t]-z2[t])^2)^3]+
  138. (-q2*q4/(4Pi ε0 )/m2 (x4[t]-x2[t]))/Sqrt[((x4[t]-x2[t])^2+(y4[t]-y2[t])^2+(z4[t]-z2[t])^2)^3]]+
  139. Λ*c^2*x2[t]^2/Sqrt[x2[t]^2+y2[t]^2+z2[t]^2],
  140.  
  141. vy2'[t] ==
  142. (G m1 (y1[t]-y2[t]))/Sqrt[((x1[t]-x2[t])^2+(y1[t]-y2[t])^2+(z1[t]-z2[t])^2)^3]+
  143. (G m3 (y3[t]-y2[t]))/Sqrt[((x3[t]-x2[t])^2+(y3[t]-y2[t])^2+(z3[t]-z2[t])^2)^3]+
  144. (G m4 (y4[t]-y2[t]))/Sqrt[((x4[t]-x2[t])^2+(y4[t]-y2[t])^2+(z4[t]-z2[t])^2)^3]+
  145. If[q2 == 0, 0,
  146. (-q2*q1/(4Pi ε0 )/m2 (y1[t]-y2[t]))/Sqrt[((x1[t]-x2[t])^2+(y1[t]-y2[t])^2+(z1[t]-z2[t])^2)^3]+
  147. (-q2*q3/(4Pi ε0 )/m2 (y3[t]-y2[t]))/Sqrt[((x3[t]-x2[t])^2+(y3[t]-y2[t])^2+(z3[t]-z2[t])^2)^3]+
  148. (-q2*q4/(4Pi ε0 )/m2 (y4[t]-y2[t]))/Sqrt[((x4[t]-x2[t])^2+(y4[t]-y2[t])^2+(z4[t]-z2[t])^2)^3]]+
  149. Λ*c^2*y2[t]^2/Sqrt[x2[t]^2+y2[t]^2+z2[t]^2],
  150.  
  151. vz2'[t] ==
  152. (G m1 (z1[t]-z2[t]))/Sqrt[((x2[t]-x1[t])^2+(y2[t]-y1[t])^2+(z2[t]-z1[t])^2)^3]+
  153. (G m3 (z3[t]-z2[t]))/Sqrt[((x3[t]-x2[t])^2+(y3[t]-y2[t])^2+(z3[t]-z2[t])^2)^3]+
  154. (G m4 (z4[t]-z2[t]))/Sqrt[((x4[t]-x2[t])^2+(y4[t]-y2[t])^2+(z4[t]-z2[t])^2)^3]+
  155. If[q2 == 0, 0,
  156. (-q2*q1/(4Pi ε0 )/m2 (z1[t]-z2[t]))/Sqrt[((x2[t]-x1[t])^2+(y2[t]-y1[t])^2+(z2[t]-z1[t])^2)^3]+
  157. (-q2*q3/(4Pi ε0 )/m2 (z3[t]-z2[t]))/Sqrt[((x3[t]-x2[t])^2+(y3[t]-y2[t])^2+(z3[t]-z2[t])^2)^3]+
  158. (-q2*q4/(4Pi ε0 )/m2 (z4[t]-z2[t]))/Sqrt[((x4[t]-x2[t])^2+(y4[t]-y2[t])^2+(z4[t]-z2[t])^2)^3]]+
  159. Λ*c^2*z2[t]^2/Sqrt[x2[t]^2+y2[t]^2+z2[t]^2],
  160.  
  161. vx3'[t] ==
  162. (G m1 (x1[t]-x3[t]))/Sqrt[((x1[t]-x3[t])^2+(y1[t]-y3[t])^2+(z1[t]-z3[t])^2)^3]+
  163. (G m2 (x2[t]-x3[t]))/Sqrt[((x2[t]-x3[t])^2+(y2[t]-y3[t])^2+(z2[t]-z3[t])^2)^3]+
  164. (G m4 (x4[t]-x3[t]))/Sqrt[((x4[t]-x3[t])^2+(y4[t]-y3[t])^2+(z4[t]-z3[t])^2)^3]+
  165. If[q3 == 0, 0,
  166. (-q3*q1/(4Pi ε0 )/m3 (x1[t]-x3[t]))/Sqrt[((x1[t]-x3[t])^2+(y1[t]-y3[t])^2+(z1[t]-z3[t])^2)^3]+
  167. (-q3*q2/(4Pi ε0 )/m3 (x2[t]-x3[t]))/Sqrt[((x2[t]-x3[t])^2+(y2[t]-y3[t])^2+(z2[t]-z3[t])^2)^3]+
  168. (-q3*q4/(4Pi ε0 )/m3 (x4[t]-x3[t]))/Sqrt[((x4[t]-x3[t])^2+(y4[t]-y3[t])^2+(z4[t]-z3[t])^2)^3]]+
  169. Λ*c^2*x3[t]^2/Sqrt[x3[t]^2+y3[t]^2+z3[t]^2],
  170.  
  171. vy3'[t] ==
  172. (G m1 (y1[t]-y3[t]))/Sqrt[((x1[t]-x3[t])^2+(y1[t]-y3[t])^2+(z1[t]-z3[t])^2)^3]+
  173. (G m2 (y2[t]-y3[t]))/Sqrt[((x2[t]-x3[t])^2+(y2[t]-y3[t])^2+(z2[t]-z3[t])^2)^3]+
  174. (G m4 (y4[t]-y3[t]))/Sqrt[((x4[t]-x3[t])^2+(y4[t]-y3[t])^2+(z4[t]-z3[t])^2)^3]+
  175. If[q3 == 0, 0,
  176. (-q3*q1/(4Pi ε0 )/m3 (y1[t]-y3[t]))/Sqrt[((x1[t]-x3[t])^2+(y1[t]-y3[t])^2+(z1[t]-z3[t])^2)^3]+
  177. (-q3*q2/(4Pi ε0 )/m3 (y2[t]-y3[t]))/Sqrt[((x2[t]-x3[t])^2+(y2[t]-y3[t])^2+(z2[t]-z3[t])^2)^3]+
  178. (-q3*q4/(4Pi ε0 )/m3 (y4[t]-y3[t]))/Sqrt[((x4[t]-x3[t])^2+(y4[t]-y3[t])^2+(z4[t]-z3[t])^2)^3]]+
  179. Λ*c^2*y3[t]^2/Sqrt[x3[t]^2+y3[t]^2+z3[t]^2],
  180.  
  181. vz3'[t] ==
  182. (G m1 (z1[t]-z3[t]))/Sqrt[((x1[t]-x3[t])^2+(y1[t]-y3[t])^2+(z1[t]-z3[t])^2)^3]+
  183. (G m2 (z2[t]-z3[t]))/Sqrt[((x2[t]-x3[t])^2+(y2[t]-y3[t])^2+(z2[t]-z3[t])^2)^3]+
  184. (G m4 (z4[t]-z3[t]))/Sqrt[((x4[t]-x3[t])^2+(y4[t]-y3[t])^2+(z4[t]-z3[t])^2)^3]+
  185. If[q3 == 0, 0,
  186. (-q3*q1/(4Pi ε0 )/m3 (z1[t]-z3[t]))/Sqrt[((x1[t]-x3[t])^2+(y1[t]-y3[t])^2+(z1[t]-z3[t])^2)^3]+
  187. (-q3*q2/(4Pi ε0 )/m3 (z2[t]-z3[t]))/Sqrt[((x2[t]-x3[t])^2+(y2[t]-y3[t])^2+(z2[t]-z3[t])^2)^3]+
  188. (-q3*q4/(4Pi ε0 )/m3 (z4[t]-z3[t]))/Sqrt[((x4[t]-x3[t])^2+(y4[t]-y3[t])^2+(z4[t]-z3[t])^2)^3]]+
  189. Λ*c^2*z3[t]^2/Sqrt[x3[t]^2+y3[t]^2+z3[t]^2],
  190.  
  191. vx4'[t] ==
  192. (G m1 (x1[t]-x4[t]))/Sqrt[((x1[t]-x4[t])^2+(y1[t]-y4[t])^2+(z1[t]-z4[t])^2)^3]+
  193. (G m2 (x2[t]-x4[t]))/Sqrt[((x2[t]-x4[t])^2+(y2[t]-y4[t])^2+(z2[t]-z4[t])^2)^3]+
  194. (G m3 (x3[t]-x4[t]))/Sqrt[((x3[t]-x4[t])^2+(y3[t]-y4[t])^2+(z3[t]-z4[t])^2)^3]+
  195. If[q4 == 0, 0,
  196. (-q4*q1/(4Pi ε0 )/m4 (x1[t]-x4[t]))/Sqrt[((x1[t]-x4[t])^2+(y1[t]-y4[t])^2+(z1[t]-z4[t])^2)^3]+
  197. (-q4*q2/(4Pi ε0 )/m4 (x2[t]-x4[t]))/Sqrt[((x2[t]-x4[t])^2+(y2[t]-y4[t])^2+(z2[t]-z4[t])^2)^3]+
  198. (-q4*q3/(4Pi ε0 )/m4 (x3[t]-x4[t]))/Sqrt[((x3[t]-x4[t])^2+(y3[t]-y4[t])^2+(z3[t]-z4[t])^2)^3]]+
  199. Λ*c^2*x4[t]^2/Sqrt[x4[t]^2+y4[t]^2+z4[t]^2],
  200.  
  201. vy4'[t] ==
  202. (G m1 (y1[t]-y4[t]))/Sqrt[((x1[t]-x4[t])^2+(y1[t]-y4[t])^2+(z1[t]-z4[t])^2)^3]+
  203. (G m2 (y2[t]-y4[t]))/Sqrt[((x2[t]-x4[t])^2+(y2[t]-y4[t])^2+(z2[t]-z4[t])^2)^3]+
  204. (G m3 (y3[t]-y4[t]))/Sqrt[((x3[t]-x4[t])^2+(y3[t]-y4[t])^2+(z3[t]-z4[t])^2)^3]+
  205. If[q4 == 0, 0,
  206. (-q4*q1/(4Pi ε0 )/m4 (y1[t]-y4[t]))/Sqrt[((x1[t]-x4[t])^2+(y1[t]-y4[t])^2+(z1[t]-z4[t])^2)^3]+
  207. (-q4*q2/(4Pi ε0 )/m4 (y2[t]-y4[t]))/Sqrt[((x2[t]-x4[t])^2+(y2[t]-y4[t])^2+(z2[t]-z4[t])^2)^3]+
  208. (-q4*q3/(4Pi ε0 )/m4 (y3[t]-y4[t]))/Sqrt[((x3[t]-x4[t])^2+(y3[t]-y4[t])^2+(z3[t]-z4[t])^2)^3]]+
  209. Λ*c^2*y4[t]^2/Sqrt[x4[t]^2+y4[t]^2+z4[t]^2],
  210.  
  211. vz4'[t] ==
  212. (G m1 (z1[t]-z4[t]))/Sqrt[((x1[t]-x4[t])^2+(y1[t]-y4[t])^2+(z1[t]-z4[t])^2)^3]+
  213. (G m2 (z2[t]-z4[t]))/Sqrt[((x2[t]-x4[t])^2+(y2[t]-y4[t])^2+(z2[t]-z4[t])^2)^3]+
  214. (G m3 (z3[t]-z4[t]))/Sqrt[((x3[t]-x4[t])^2+(y3[t]-y4[t])^2+(z3[t]-z4[t])^2)^3]+
  215. If[q4 == 0, 0,
  216. (-q4*q1/(4Pi ε0 )/m4 (z1[t]-z4[t]))/Sqrt[((x1[t]-x4[t])^2+(y1[t]-y4[t])^2+(z1[t]-z4[t])^2)^3]+
  217. (-q4*q2/(4Pi ε0 )/m4 (z2[t]-z4[t]))/Sqrt[((x2[t]-x4[t])^2+(y2[t]-y4[t])^2+(z2[t]-z4[t])^2)^3]+
  218. (-q4*q3/(4Pi ε0 )/m4 (z3[t]-z4[t]))/Sqrt[((x3[t]-x4[t])^2+(y3[t]-y4[t])^2+(z3[t]-z4[t])^2)^3]]+
  219. Λ*c^2*z4[t]^2/Sqrt[x4[t]^2+y4[t]^2+z4[t]^2],
  220.  
  221. x1[0] == x1x, y1[0] == y1y, z1[0] == z1z,
  222. x2[0] == x2x, y2[0] == y2y, z2[0] == z2z,
  223. x3[0] == x3x, y3[0] == y3y, z3[0] == z3z,
  224. x4[0] == x4x, y4[0] == y4y, z4[0] == z4z,
  225.  
  226. vx1[0] == v1x, vy1[0] == v1y, vz1[0] == v1z,
  227. vx2[0] == v2x, vy2[0] == v2y, vz2[0] == v2z,
  228. vx3[0] == v3x, vy3[0] == v3y, vz3[0] == v3z,
  229. vx4[0] == v4x, vy4[0] == v4y, vz4[0] == v4z},
  230.  
  231. {x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4,
  232. vx1, vx2, vx3, vx4, vy1, vy2, vy3, vy4, vz1, vz2, vz3, vz4},
  233.  
  234. {t, 0, Tmax},
  235.  
  236. WorkingPrecision-> wp,
  237. MaxSteps-> Infinity,
  238. Method-> mta,
  239. InterpolationOrder-> All,
  240. StepMonitor :> (laststep=plunge; plunge=t;
  241. stepsize=plunge-laststep;), Method->{"EventLocator",
  242. "Event" :> (If[stepsize<1*^-4, 0, 1])}];
  243.  
  244. (* Position, Geschwindigkeit *)
  245.  
  246. f2p[t_]={{x1[t], y1[t], z1[t]}, {x2[t], y2[t], z2[t]}, {x3[t], y3[t], z3[t]}, {x4[t], y4[t], z4[t]}}/.nds[[1]];
  247. f2v[t_]={{vx1[t], vy1[t], vz1[t]}, {vx2[t], vy2[t], vz2[t]}, {vx3[t], vy3[t], vz3[t]}, {vx4[t], vy4[t], vz4[t]}}/.nds[[1]];
  248. swp[t_]=(m1 Evaluate[f2p[t][[1]]]+m2 Evaluate[f2p[t][[2]]]+m3 Evaluate[f2p[t][[3]]]+m4 Evaluate[f2p[t][[4]]])/(m1+m2+m3+m4);
  249.  
  250. (* Formatierung *)
  251.  
  252. s[text_]=Style[text, FontSize->11];
  253. sw[text_]=Style[text, White, FontSize->11];
  254. colorfunc[n_]=Function[{x, y, z, t},
  255. Hue[0, n, 0.5,
  256. If[Tmax<0, Max[Min[(+T+(-t+trail))/trail, 1], 0],
  257. Max[Min[(-T+(t+trail))/trail, 1], 0]]]];
  258.  
  259. (* Animation *)
  260.  
  261. Do[Print[Rasterize[
  262. Grid[{{
  263. Show[
  264.  
  265. If[T == 0, {},
  266.  
  267. ParametricPlot3D[Evaluate[f2p[t]],
  268. {t, Max[0, T-trail], T},
  269.  
  270. PlotStyle->{
  271. {Thickness[thk], Red},
  272. {Thickness[thk], Blue},
  273. {Thickness[thk], Green},
  274. {Thickness[thk], Magenta}},
  275.  
  276. PlotRange->plotrange, AspectRatio->1, MaxRecursion->15, Axes->True, ImageSize->imagesize]],
  277.  
  278. Graphics3D[
  279. If[startpos==1, {
  280. {PointSize[2point/3], Lighter[Red], Point[{x1x, y1y, z1z}]},
  281. {PointSize[2point/3], Lighter[Blue], Point[{x2x, y2y, z2z}]},
  282. {PointSize[2point/3], Lighter[Green], Point[{x3x, y3y, z3z}]},
  283. {PointSize[2point/3], Lighter[Magenta], Point[{x4x, y4y, z4z}]}
  284. }, {}],
  285.  
  286. PlotRange->plotrange, AspectRatio->1, Axes->True, ImageSize->imagesize],
  287.  
  288. Graphics3D[{PointSize[point], Red, Point[Evaluate[f2p[T]][[1]]]}],
  289. Graphics3D[{PointSize[point], Blue, Point[Evaluate[f2p[T]][[2]]]}],
  290. Graphics3D[{PointSize[point], Green, Point[Evaluate[f2p[T]][[3]]]}],
  291. Graphics3D[{PointSize[point], Magenta, Point[Evaluate[f2p[T]][[4]]]}],
  292.  
  293. ViewPoint->viewpoint]},
  294.  
  295. { },
  296. {s["t"->N[T]], sw[1/2]},
  297. { },
  298. {s["p1{x,y,z}"-> Evaluate[f2p[T][[1]]]], sw[1/2]},
  299. {s["v1{x,y,z}"-> Evaluate[f2v[T][[1]]]], sw[1/2]},
  300. {s["v1{total}"->{Evaluate[Chop@Norm[f2v[T][[1]]]]}], sw[1/2]},
  301. { },
  302. {s["p2{x,y,z}"-> Evaluate[f2p[T][[2]]]], sw[1/2]},
  303. {s["v2{x,y,z}"-> Evaluate[f2v[T][[2]]]], sw[1/2]},
  304. {s["v2{total}"->{Evaluate[Chop@Norm[f2v[T][[2]]]]}], sw[1/2]},
  305. { },
  306. {s["p3{x,y,z}"-> Evaluate[f2p[T][[3]]]], sw[1/2]},
  307. {s["v3{x,y,z}"-> Evaluate[f2v[T][[3]]]], sw[1/2]},
  308. {s["v3{total}"->{Evaluate[Chop@Norm[f2v[T][[3]]]]}], sw[1/2]},
  309. { },
  310. {s["p4{x,y,z}"-> Evaluate[f2p[T][[4]]]], sw[1/2]},
  311. {s["v4{x,y,z}"-> Evaluate[f2v[T][[4]]]], sw[1/2]},
  312. {s["v4{total}"->{Evaluate[Chop@Norm[f2v[T][[4]]]]}], sw[1/2]},
  313. { },
  314. {s["ps{x,y,z}"-> swp[T]], sw[1/2]},
  315. {s["vs{x,y,z}"-> swp'[T]], sw[1/2]},
  316. {s["vs{total}"->{Chop@Norm[swp'[T]]}], sw[1/2]}
  317. }, Alignment->Left]]],
  318.  
  319. (* Zeitregler *)
  320.  
  321. {T, 0, tMax, tMax/5}]
  322.  
  323. (* Export als HTML Dokument *)
  324. (* Export["dateiname.html", EvaluationNotebook[], "GraphicsOutput" -> "PNG"] *)
  325. (* Export direkt als Bildsequenz *)
  326. (* ParallelDo[Export["dateiname" <> ToString[T] <> ".png", Rasterize[...] ], {T, 0, 10, 5}] *)
  327.  
  328.  
RAW Paste Data