Advertisement
Matthen

Caustics from waves

Jun 9th, 2013
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. \[Theta] = Pi/3;
  2. f[x_, y_] :=
  3. 0.8 Sin[xt] Cos[yt] /. {xt -> x Cos[\[Theta]] - y Sin[\[Theta]],
  4. yt -> y Cos[\[Theta]] + x Sin[\[Theta]]};
  5. g = Derivative[1, 0][f];
  6. n = 70; r = 0.85;
  7. Manipulate[
  8.  
  9. Show[
  10. Graphics[{
  11. FaceForm[RGBColor[0.95, 0.95, 1.0]],
  12. EdgeForm[
  13. Directive[Thickness[0.01],
  14. RGBColor[0.6365758754863813, 0.8532539864194705,
  15. 0.970244907301442]]],
  16. Polygon[
  17. Join[{{-1, 5}},
  18. Table[{x, f[x, y]}, {x, 0, 4 Pi, (4 Pi)/50}], {{4 Pi + 1,
  19. 5}}]],
  20. Table[
  21. Block[{p1, p2, p3, m, sin1, sin2, cos2, d\[Theta], xt},
  22. p1 = {x, 4}; p2 = {x, f[x, y]}; m = g[x, y]; sin1 = m;
  23. sin2 = r sin1; d\[Theta] = ArcSin[sin1] - ArcSin[sin2];
  24. cos2 = Sqrt[1 - sin1^2];
  25. p3 = p2 + (p2[[2]] + 3) {Sin[d\[Theta]]/Cos[d\[Theta]], -1};
  26. xt = p3[[1]];
  27. {RGBColor[0.781048294804303, 0.6390783550774395,
  28. 0.42232394903486686], Line[{p1, p2}], White, Line[{p2, p3}],
  29. Opacity[0.2], FaceForm[White], EdgeForm[],
  30. Rectangle[{xt - 2 (4 Pi/n), -3.5}, {xt + 2 (4 Pi/n), -3}]}
  31. ]
  32. , {x, 0, 4 Pi, (4 Pi)/n}]},
  33. Background ->
  34. RGBColor[0.10379186694132907, 0.2430914778362707,
  35. 0.49544518196383613], PlotRange -> {{0.5, 4 Pi - 0.5}, {-3.5, 4}}]
  36.  
  37. ]
  38. , {y, 0, 4 Pi}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement