Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. ContourPlot[Im[Sqrt[(Tanh[x + I*y] - Tanh[2 x + I*2 y])^2 + (Tanh[x + I*y]
  2. Tanh[2 x + I*2 y] + 1)^2-1 - 2 ((Tanh[x + I*2 y])^2)((Tanh[x + I*y])^2) ]],
  3. {x, -10, 10}, {y, -10, 10}, AxesLabel -> Automatic,ContourShading -> Automatic,
  4. ColorFunction -> "Rainbow", Contours -> 20]
  5.  
  6. ContourPlot[Re[Sqrt[(Tanh[x + I*y] - Tanh[2 x + I*2 y])^2 + (Tanh[x + I*y]Tanh[2 x + I*2 y] + 1)^2 - 1 - 2 ((Tanh[x + I*2 y])^2) ((Tanh[x + I*y])^2) ]],
  7. {x, -10, 10}, {y, -10, 10}, AxesLabel -> Automatic,
  8. ContourShading -> Automatic, ColorFunction -> "Rainbow", Contours -> 20]
  9.  
  10. expr = Sqrt[(Tanh[z]-Tanh[2z])^2+(Tanh[z] Tanh[2z]+1)^2-1-2 Tanh[z]^2Tanh[2z]^2];
  11.  
  12. pts = ComplexAnalysis`BranchPoints[expr, z]
  13.  
  14. Simplify[pts, C[1] ∈ Integers]
  15.  
  16. ComplexAnalysis`BranchCuts[expr, z]
  17.  
  18. With[{z = x + I y},
  19. expr = (Tanh[z] - Tanh[2 z])^2 + (Tanh[z] Tanh[2 z] + 1)^2 - 1 - 2 ((Tanh[2 z])^2) ((Tanh[z])^2);
  20. branchCutRegion[x_, y_, __] = Re[expr] <= 0;
  21. ];
  22.  
  23. bpvals = Union[{x, y} /. Solve[(expr == 0 || 1/Together[TrigToExp[expr]] == 0) && -10 < x < 10 && -10 < y < 10, {x, y}]];
  24.  
  25. ContourPlot[Im[expr] == 0, {x, -10, 10}, {y, -10, 10},
  26. RegionFunction -> branchCutRegion, PlotPoints -> 100,
  27. Epilog -> {Red, Point[bpvals]}
  28. ]
  29.  
  30. binnedabs = Compile[{{z, _Complex}},
  31. Module[{f, abs, rnd, sgn, val},
  32. f = (Tanh[z] - Tanh[2 z])^2 + (Tanh[z] Tanh[2 z] + 1)^2 - 1 - 2 Tanh[2 z]^2 Tanh[z]^2;
  33. abs = Abs[f];
  34. rnd = Round[abs, .2];
  35. val = If[rnd == 0, f, rnd Sign[f]];
  36. {
  37. Divide[Mod[Arg[val], 2π], 2π],
  38. Power[1 + 0.3*Log[Abs[val] + 1], -1],
  39. Power[1 + 0.5*Log[Abs[val] + 1], -1]
  40. }
  41. ],
  42. CompilationTarget -> "C",
  43. Parallelization -> True,
  44. RuntimeAttributes -> {Listable},
  45. RuntimeOptions -> "Speed"
  46. ];
  47.  
  48. lattice = Array[List, {2048, 2048}, {{-10., 10.}, {-10., 10.}}].{I, 1};
  49.  
  50. raster = Raster[binnedabs[lattice], {{-10, -10}, {10, 10}}, ColorFunction -> Hue];
  51.  
  52. cutplot = ContourPlot[Im[expr] == 0, {x, -10, 10}, {y, -10, 10},
  53. RegionFunction -> branchCutRegion, PlotPoints -> 100, ContourStyle -> Black];
  54.  
  55. Show[
  56. cutplot,
  57. ImageSize -> 800,
  58. Prolog -> raster,
  59. Epilog -> {EdgeForm[Black], GrayLevel[.8], Disk[#, Scaled[.0045]] & /@ bpvals}
  60. ]
  61.  
  62. exprz = (Tanh[z] - Tanh[2 z])^2 + (Tanh[z] Tanh[2 z] + 1)^2 - 1 - 2 ((Tanh[2 z])^2) ((Tanh[z])^2);
  63. exprxy = exprz /. z -> x + I y;
  64. branchCutRegion[x_, y_, __] = Re[exprxy] <= 0;
  65.  
  66. bpvals = Union[{x, y} /. Solve[(expr == 0 || 1/Together[TrigToExp[expr]] == 0) && -10 < x < 10 && -10 < y < 10, {x, y}]];
  67.  
  68. domaincoloring = ComplexPlot[exprz, {z, -10 - 10 I, 10 + 10 I},
  69. ColorFunction -> "CyclicLogAbsArg", ImageSize -> 800];
  70.  
  71. cutplot = ContourPlot[Im[exprxy] == 0, {x, -10, 10}, {y, -10, 10},
  72. RegionFunction -> branchCutRegion, PlotPoints -> 100, ContourStyle -> Black];
  73.  
  74. Show[
  75. domaincoloring,
  76. cutplot,
  77. Epilog -> {EdgeForm[Black], GrayLevel[.8], Disk[#, Scaled[.0045]] & /@ bpvals}
  78. ]
  79.  
  80. domaincoloring = ComplexPlot[exprz, {z, -10 - 10 I, 10 + 10 I},
  81. ColorFunction -> {Hue[Divide[Mod[#8, 2π], 2π],
  82. Power[1 + 0.3*Log[#7 + 1], -1],
  83. Power[1 + 0.5*Log[#7 + 1], -1]] &, None},
  84. ColorFunctionScaling -> False,
  85. Exclusions -> None,
  86. ImageSize -> 800
  87. ];
  88.  
  89. myexp = Together[
  90. TrigToExp[
  91. FullSimplify[(Tanh[z] - Tanh[2 z])^2 + (Tanh[z] Tanh[2 z] + 1)^2 -
  92. 1 - 2 Tanh[z]^2 Tanh[2 z]^2]
  93. ]]
  94.  
  95. Expand[Numerator[
  96. Together[TrigToExp[
  97. FullSimplify[(Tanh[z] - Tanh[2 z])^2 + (Tanh[z] Tanh[2 z] +
  98. 1)^2 - 1 - 2 Tanh[z]^2 Tanh[2 z]^2]
  99. ]]]]
  100. mySol = z /.
  101. Solve[1 + 2 z^2 + 3 z^4 - 12 z^6 + 3 z^8 + 2 z^10 + z^12 == 0, z];
  102.  
  103. p1 = Show[
  104. Graphics[{Red,
  105. Point @@ {{Re[#], Im[#]} & /@ (N[Log[#]] & /@ mySol)}}],
  106. Axes -> True, PlotRange -> 5];
  107. p2 = Show[
  108. Graphics[{Blue,
  109. Point @@ {{Re[#], Im[#]} & /@ (N[(Log[#] + 2 [Pi] I)] & /@
  110. mySol)}}], Axes -> True, PlotRange -> 15];
  111. p3 = Show[
  112. Graphics[{Green // Darker,
  113. Point @@ {{Re[#], Im[#]} & /@ (N[(Log[#] - 2 [Pi] I)] & /@
  114. mySol)}}], Axes -> True, PlotRange -> 15];
  115. Show[{p1, p2, p3}, PlotRange -> 15]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement