Message Boards Message Boards

GROUPS:

[GIF] Twinkle (Pseudo-randomly located oscillators)

Posted 2 years ago
3026 Views
|
6 Replies
|
10 Total Likes
|

Pseudo-randomly located oscillators

Twinkle

Inspired by Jerome Herr. Here's the code:

DynamicModule[{points, startθ, cols},
 cols = RGBColor /@ {"#598EA3", "#B0DDDF", "#F0AB7B", "#2D4861"};
 points = 
  RandomVariate[
   TransformedDistribution[
    r {Cos[θ], Sin[θ]}, {r \[Distributed] 
      NormalDistribution[1, 1/8], θ \[Distributed] 
      UniformDistribution[{0, 2 π}]}], 1000];
 startθ = RandomReal[{0, 2 π}, 1000];
 Manipulate[
  Graphics[{Table[{cols[[Mod[i, 3, 1]]], 
      PointSize[.0065 + .0025 Sin[θ + startθ[[i]]]], 
      Point[points[[i]]]}, {i, 1, 1000}]}, Background -> cols[[4]], 
   PlotRange -> 1.9, ImageSize -> 540], {θ, 0, 2 π}]
 ]
6 Replies

This feels like something that could pop up in a Doctor Who episode, where it would of course contain a subliminal alien message. Wolfram Research, what have you done with RandomVariate? And don't tell me it's "random".

Wait, what's wrong with RandomVariate?

I'm sorry, I can't quite tell if you're playing along or if my joke was too silly to register as a joke... this forum needs smilies!

(Either way I enjoy the animation, obviously!)

Sorry, literalism gene kicked in there. Anyway, thanks for the kind words!

enter image description here - another post of yours has been selected for the Staff Picks group, congratulations !

We are happy to see you at the tops of the "Featured Contributor" board. Thank you for your wonderful contributions, and please keep them coming!

Posted 2 years ago

That's beautiful!
I'm using Animate instead of Manipulate to have it play "live" in the notebook.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract