Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrianWeinstein/404ba670e95881b66064 to your computer and use it in GitHub Desktop.
Save BrianWeinstein/404ba670e95881b66064 to your computer and use it in GitHub Desktop.
vs = 1; \[Lambda] = 25;
dots[t_, vx_] := Flatten[Table[{vx*tt + (vs*(t - tt))*Cos[arg],
(vs*(t - tt))*Sin[arg]}, {tt, 0, t, vs*\[Lambda]},
{arg, 0, 2*Pi, 0.1}], 1]
(* To scale the SmoothDensityHistogram colors, use arg step
size .5/(t -tt/1.1) instead of 0.1 *)
wavefront[t_, vx_] := Graphics[{{Purple, Thick,
Table[Circle[{vx*tt, 0}, vs*(t - tt)],
{tt, 0, t, vs*\[Lambda]}]}, {Orange, Disk[{vx*t, 0}, 3]}},
PlotRange -> {{-50, 150}, {-100, 100}}, Axes -> False]
pressure[t_, vx_] := Show[
SmoothDensityHistogram[dots[t, vx],
ColorFunction -> "FuchsiaTones",
Mesh -> 0, Frame -> False, MaxRecursion -> 5,
PlotRange -> {{-50, 150}, {-100, 100}}, Axes -> False],
Graphics[{Orange, Disk[{vx*t, 0}, 3]}]]
Manipulate[GraphicsRow[{wavefront[t, vx], pressure[t, vx]},
Spacings -> 0.1, Frame -> All,
FrameStyle -> White, Background -> Black],
{{t, 58}, 1, 101}, {vx, 0, 1.4}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment