Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. Clear["Global`*"]
  2. Dim = 3;
  3. n = {2,2};
  4. d = Length[n];
  5. T = Table[t[l], {l, 1, d}];
  6. Tmax = 10;
  7.  
  8. X0 = RandomReal[{-1,1}, Append[n, Dim]];
  9. Colors = RandomReal[{0,1}, Append[n, 3]];
  10.  
  11. M = Table[0, d];
  12. For[l=1, l<=d, l++,
  13. col = Table[0, n[[l]]];
  14. col[[1]] = 1;
  15. col[[n[[l]]]] = -1;
  16.  
  17. row = Table[0, n[[l]]];
  18. row[[1]] = 1;
  19. row[[2]] = -1;
  20.  
  21. M[[l]] = ToeplitzMatrix[col, row]
  22. ];
  23.  
  24. IndicesToContract = Table[{2*m,2*d+m}, {m, 1, d}];
  25. X = TensorContract[Apply[TensorProduct, Append[Map[MatrixExp,
  26. MapThread[Times, {-M, T}]], X0]], IndicesToContract];
  27.  
  28. plots = Table[0, 0];
  29. ParameterSpace = Table[t[l], 0, Tmax}, {l, 1, d}];
  30.  
  31. idx = Table[1, d];
  32. dim = d;
  33. ready = True;
  34. While[ready,
  35.  
  36. x = Extract[X, idx];
  37. AppendTo[plots, Region[ParametricRegion[x, ParameterSpace]]];
  38.  
  39. ready = False;
  40. While[!ready,
  41. If[dim > 0,
  42.  
  43. If[idx[[dim]] + 1 <= n[[dim]],
  44.  
  45. idx[[dim]]++;
  46. dim = d;
  47. ready = True,
  48.  
  49. idx[[dim]] = 1;
  50. dim--
  51. ],
  52.  
  53. Break[]
  54. ]
  55. ]
  56. ];
  57. ParameterSpace
  58. ParametricRegion[x, ParameterSpace]
  59.  
  60. ParametricRegion[{ ... }, {}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement