<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel rdf:about="https://community.wolfram.com">
    <title>Community RSS Feed</title>
    <link>https://community.wolfram.com</link>
    <description>RSS Feed for Wolfram Community showing ideas tagged with Wolfram Science sorted by most likes.</description>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/122095" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/326240" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/526743" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/863933" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/235291" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/595870" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/437875" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/114911" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/554194" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/227651" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3502932" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/852277" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/33771" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/835603" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1890120" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1248938" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2028929" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3097906" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/137758" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/845650" />
      </rdf:Seq>
    </items>
  </channel>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/122095">
    <title>Dancing with friends and enemies: boids&amp;#039; swarm intelligence</title>
    <link>https://community.wolfram.com/groups/-/m/t/122095</link>
    <description>The latest way I have found to use my expensive math software for frivolous entertainment is this. Here&amp;#039;s is a way to describe it. 
[list]
[*]1000 dancers assume random positions on the dance-floor. 
[*]Each randomly chooses one &amp;#034;friend&amp;#034; and one &amp;#034;enemy&amp;#034;. 
[*]At each step every dancer 
[list]
[*]moves 0.5% closer to the centre of the floor
[*]then takes a large step towards their friend 
[*]and a small step away from their enemy. 
[/list]
[*]At random intervals one dancer re-chooses their friend and enemy
[/list]
Randomness is deliberately injected. Here is the dance...
[mcode]n = 1000; 
r := RandomInteger[{1, n}]; 
f := (#/(.01 + Sqrt[#.#])) &amp;amp; /@ (x[[#]] - x) &amp;amp;; 
s := With[{r1 = r}, p[[r1]] = r; q[[r1]] = r]; 
x = RandomReal[{-1, 1}, {n, 2}]; 
{p, q} = RandomInteger[{1, n}, {2, n}]; 
Graphics[{PointSize[0.007], Dynamic[If[r &amp;lt; 100, s]; 
Point[x = 0.995 x + 0.02 f[p] - 0.01 f[q]]]}, PlotRange -&amp;gt; 2][/mcode]
[img]/c/portal/getImageAttachment?filename=OPTfnlfrnds.gif&amp;amp;userId=11733[/img]

Thanks to Vitaliy for posting this on my behalf, complete with animations :-)

Background: I had read somewhere that  macro-scale behaviour of animal swarms (think of flocks of starlings or shoals of herring) is explained by each individual following very simple rules local to their vicinity, essentially 1) try to keep up and 2) try not to collide. I started trying to play with this idea in Mathematica, but it was rather slow to identify the nearest neighbours of each particle. So I wondered what would happen if each particle acted according to the locations of two other particles, regardless of their proximity. The rule was simply to move away from one and towards the other.

The contraction (x = 0.995 x) was added to prevent the particle cloud from dispersing towards infinity or drifting away from the origin. I tweaked the &amp;#034;towards&amp;#034; and &amp;#034;away&amp;#034; step sizes to strike a balance between the tendency to clump together and to spread apart (if you make the step sizes equal you get something more like a swarm of flies). With each particle&amp;#039;s attractor and repeller fixed, the system finds a sort of dynamic equilibrium, so to keep things changing I added a rule to periodically change the attractor and repeller for one of the particles. The final adjustment was to make the &amp;#034;force&amp;#034; drop towards zero for particles at very close range. This helps to stop the formation of very tight clumps, and also prevents a division-by-zero error when a particle chooses itself as its attractor or repeller.

The description of the system as a dance was an attempt to explain the swirling pattern on the screen without using mathematical language. I&amp;#039;d love to see what other &amp;#034;dances&amp;#034; can be created with other simple rules.</description>
    <dc:creator>Simon Woods</dc:creator>
    <dc:date>2013-09-11T18:31:12Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/326240">
    <title>Simulating a global Ebola outbreak</title>
    <link>https://community.wolfram.com/groups/-/m/t/326240</link>
    <description>Triggered by the recent outbreak of Ebola India Bruckner, a pupil from Aberdeen&amp;#039;s [St Margaret&amp;#039;s School for Girls][1], and myself worked on a little model this summer to understand the basics of the spreading of diseases in populations and the relationship to transportation networks. The model is very basic, but shows some interesting features and is very straight forward to implement in Mathematica. &#xD;
&#xD;
When I was typing these lines I saw that Arnoud Buzing had posted something, reason enough to interrupt my typing and to check out what he had posted: [Visualizing the Ebola Outbreak][2]. I hope that my post is going to complement Arnoud&amp;#039;s to some extent.&#xD;
&#xD;
So, my question is how the global air transport network might lead to a spreading of a disease. I will use a very standard SIR (susceptible-infected-recovered) model, which is certainly far from being ideal for Ebola; [but similar types of models are to too bad either][3]. It rather simulates an outbreak of some generic disease from which you recover. If we assumed that everyone died in an outbreak the SIR model might also be appropriate. I will introduce the equations below. I also need a list of all airports and all flight connections. On the website [Openflights.org][4] you will find all data we need. I saved the file &amp;#034;airports.dat&amp;#034; and the file &amp;#034;routes.dat&amp;#034;. So that&amp;#039;s the data. &#xD;
&#xD;
I first import the data:&#xD;
&#xD;
    airports = Import[&amp;#034;~/Desktop/airports.dat&amp;#034;, &amp;#034;CSV&amp;#034;];&#xD;
    routes = Import[&amp;#034;~/Desktop/routes.dat&amp;#034;, &amp;#034;CSV&amp;#034;];&#xD;
&#xD;
This is a plot of all airports in that database.&#xD;
&#xD;
    GeoRegionValuePlot[Table[GeoPosition[airports[[i, {7, 8}]]] -&amp;gt; 1., {i, 1, Length[airports]}], PlotStyle -&amp;gt; PointSize[0.003], PlotRange -&amp;gt; 1, ImageSize -&amp;gt; Full]&#xD;
&#xD;
which gives&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
Alright, now the routes. First, we create a list of rules for all airport IDs and their coordinates:&#xD;
&#xD;
    codecoords = Table[airports[[i, 5]] -&amp;gt; GeoPosition[airports[[i, {7, 8}]]], {i, 1,Length[airports]}];&#xD;
&#xD;
We then calculate the links:&#xD;
&#xD;
    links = Monitor[Table[routes[[j, {3, 5}]] /. codecoords, {j, 1, Length[routes]}], ProgressIndicator[j, {1, Length[routes]}]];&#xD;
&#xD;
and clean out missing data:&#xD;
&#xD;
    linksclean = Select[links, Head[#[[1]]] == GeoPosition &amp;amp;&amp;amp; Head[#[[2]]] == GeoPosition &amp;amp;];&#xD;
&#xD;
Now comes a nice figure:&#xD;
&#xD;
    With[{locations = RandomChoice[linksclean, 14000]}, GeoGraphics[{{Green, Opacity[0.3],AbsoluteThickness[0.0001], GeoPath[locations, &amp;#034;Geodesic&amp;#034;]}}, &#xD;
      GeoRange -&amp;gt; &amp;#034;World&amp;#034;, GeoProjection -&amp;gt; Automatic, GeoBackground -&amp;gt; GeoStyling[&amp;#034;ReliefMap&amp;#034;], ImageSize -&amp;gt; {1200, 600}]]&#xD;
&#xD;
which gives&#xD;
&#xD;
![enter image description here][6]&#xD;
&#xD;
Ok. Interestingly I can only plot 16000 max at a time. Somewhere between 16-17k the Kernel quits. That might be Integer related. Could be a limit in the programming of Geographics. Not sure. I have more than enough memory and can plot the remaining 2-3k airports in a second figure and use Show to display all. (It would be great if someone from WRI could comment.)&#xD;
&#xD;
Anyway, let&amp;#039;s go to some modelling. The basic idea of an [SIR model][7] is that a population is modelled in three compartments Susceptibles (S), Infected (I) and Recovered (R). I will use a time-discrete model; there are continuous models around, too, and if anyone is interested I can provide the ODE model as well. Here are the three equations:&#xD;
&#xD;
    sus[i_] := sus[i] = sus[i - 1] - [Rho] sus[i - 1] inf[i - 1];&#xD;
    inf[i_] := nf[i] = inf[i - 1] + [Rho] sus[i - 1] inf[i - 1] - [Lambda] inf[i - 1];&#xD;
    rec[i_] := rec[i] = rec[i - 1] + [Lambda] inf[i - 1];&#xD;
&#xD;
The meaning of sus, inf and rec should be clear by now; they are given as percentages of the total population, their sum is 100%. The variable i represents time. $&#xD;
ho$ is an infection rate and $lambda$ is a recovery rate. The infections increase with the product of susceptibles and infected. By adding the right hand sides it becomes clear that the population does not change over time. We come up with some values for the parameters and iterate:&#xD;
&#xD;
    sus[1] = 0.95; inf[1] = 0.05; rec[1] = 0; [Rho] = 0.2; [Lambda] = 0.1;&#xD;
    tcourse = Table[{sus[i], inf[i], rec[i]}, {i, 1, 100}];&#xD;
&#xD;
The time course looks like this:&#xD;
&#xD;
    ListPlot[Transpose[tcourse]]&#xD;
&#xD;
![enter image description here][8]&#xD;
&#xD;
The monotonously decreasing function show susceptibles, the increasing function recovered, and the remaining curve the infected. We now need to do some cleaning up of the original airport data, before we proceed to a multi-airport/city model. &#xD;
&#xD;
    (*Extract the names and GPS coordinates*)&#xD;
    &#xD;
    rawdata = &#xD;
      Sort[Select[airports[[All, {5, 7, 8}]], #[[1]] != &amp;#034;&amp;#034; &amp;amp;]][[81 ;;]];&#xD;
    &#xD;
    (*These are just the coordinates*)&#xD;
    &#xD;
    airportcoords = rawdata[[All, {2, 3}]];&#xD;
    &#xD;
    (*These are just the names. *)&#xD;
    &#xD;
    names = rawdata[[All, 1]];&#xD;
    &#xD;
    (*Here are the names to indices*)&#xD;
    &#xD;
    rules = MapThread[#1 -&amp;gt; #2 &amp;amp;, {names, Range[Length[names]]}];&#xD;
    &#xD;
    (*The &amp;#034;population&amp;#034; is initially set to 1 for all airports, this allows us to take different airport sizes into consideration later.*)&#xD;
    &#xD;
    pop = Table[1., {j, 1, Length[names]}]; &#xD;
    routesraw = Import[&amp;#034;~/Desktop/routes.dat&amp;#034;, &amp;#034;CSV&amp;#034;];&#xD;
    &#xD;
    (*There are many links so this takes a while*)&#xD;
    &#xD;
    links = Select[routesraw[[All, {3, 5}]] /. rules, NumberQ[#[[1]]] &amp;amp;&amp;amp; NumberQ[#[[2]]] &amp;amp;];&#xD;
&#xD;
From that we now construct (a first guess at) the coupling or adjacency matrix:&#xD;
&#xD;
    couplingdummy = Table[0, {i, 1, Length[names]}, {j, 1, Length[names]}];&#xD;
    &#xD;
    For[k = 1, k &amp;lt;= Length[links], k++, &#xD;
      couplingdummy[[links[[k, 1]], links[[k, 2]]]] = 1; &#xD;
      couplingdummy[[links[[k, 2]], links[[k, 1]]]] = 1];&#xD;
&#xD;
I do know about ConstantArray, but for some reason that does not work. The first line constructs a matrix full of zeros and the second adds ones where there are links. The problem is that apparently in that dataset some airports are not linked at all. We can sort them out by:&#xD;
&#xD;
    indices = Select[Table[If[Total[couplingdummy[[i]]] &amp;gt; 0, i], {i, 1, Length[couplingdummy]}], NumberQ];&#xD;
&#xD;
We now delete the columns and rows of the couplingdummy matrix&#xD;
&#xD;
    intermed = couplingdummy[[#]] &amp;amp; /@ indices;&#xD;
    transintermed = Transpose[intermed];&#xD;
    coupling = transintermed[[#]] &amp;amp; /@ indices;&#xD;
&#xD;
Again I had a much more elegant way of doing this, with the advantage that it did not work. To speed up the following calculations I use that the coupling matrix is sparse, but I like the original too much to throw it away just yet. &#xD;
&#xD;
    coulinginterm = coupling;&#xD;
    coupling = SparseArray[coulinginterm];&#xD;
&#xD;
We adapt our &amp;#034;population/airport size&amp;#034; vector:&#xD;
&#xD;
    pop = Table[1., {j, 1, Length[indices]}]; &#xD;
&#xD;
and set the following parameters:&#xD;
&#xD;
    [Rho] = 0.2; [Lambda] = 0.1; Mairports =  Length[indices]; [Mu] = 0.05;&#xD;
&#xD;
$\rho$ and $lambda$ are as before. Mairports is the number of airports that we model and $\mu$ is a &amp;#034;migration rate&amp;#034;. It comes from the original model which we built for different cities were it describes the migration between different cities. Here is models the &amp;#034;propensity to fly&amp;#034;. &#xD;
&#xD;
We now define an effective coupling matrix. It is the adjacency matrix times the population vector (i.e. people in the catchment area of the airport). In our case the vector has all ones, so it is just the adjacency matrix. It allows us later to model more general situations. &#xD;
&#xD;
    meanNN = coupling.pop;&#xD;
&#xD;
When we want to model the outbreak as populations at the positions of all airports, each of which is described by an SIR model, we need to couple lots of populations, because there are lots of airports. The following uses the sparsity of the adjacency matrix to speed up the calculation. &#xD;
&#xD;
    sumind = Table[Take[Flatten[ArrayRules[coupling[[k, All]]][[All, 1]]], Length[ArrayRules[coupling[[k, All]]]] - 1], {k, 1, Mairports}];&#xD;
&#xD;
It generates a list of all airports that are coupled/linked to a given airport. Now we are ready to write down the central equations:&#xD;
&#xD;
    sus[i_, j_] :=  sus[i, j] = (1 - [Mu]) (sus[i - 1, j] - [Rho] sus[i - 1, j] inf[i - 1, j]) + [Mu]  Total[Table[sus[i - 1, sumind[[j, u]]]*pop[[sumind[[j, u]]]], {u, 1, Length[sumind[[j]]]} ] ]/meanNN[[j]]; &#xD;
    inf[i_, j_] := inf[i, j] = (1 - [Mu]) (inf[i - 1, j] + [Rho] sus[i - 1, j] inf[i - 1, j] - [Lambda] inf[i - 1, j]) + [Mu] Total[Table[inf[i - 1, sumind[[j, u]]]*pop[[sumind[[j, u]]]], {u, 1, Length[sumind[[j]]]} ] ]/meanNN[[j]];&#xD;
    rec[i_, j_] := rec[i, j] = (1 - [Mu]) (rec[i - 1, j] + [Lambda] inf[i - 1, j]) + [Mu] Total[Table[rec[i - 1, sumind[[j, u]]]*pop[[sumind[[j, u]]]], {u, 1,Length[sumind[[j]]]} ] ]/meanNN[[j]];&#xD;
&#xD;
The terms with the Total are &amp;#034;migration terms&amp;#034; that describe the travelling behaviour of the people in the catchment area of the airports. i is the time index and j labels the airports. Next come the initial conditions:&#xD;
&#xD;
    For[i = 1, i &amp;lt;= Mairports, i++, sus[1, i] = 1.; inf[1, i] = 0.0;  rec[1, i] = 0.;]&#xD;
    sus[1, 1] = 0.95; &#xD;
    inf[1, 1] = 0.05;&#xD;
    rec[1, 1] = 0.0;&#xD;
&#xD;
In the catchment areas of all airports there are only susceptibles, apart from airport number 1, which will have 5% infected people. Now we can finally iterate the whole thing:&#xD;
&#xD;
    tcourse = Monitor[Table[{sus[i, j], inf[i, j], rec[i, j]}, {i, 1, 500}, {j, 1,Mairports}], ProgressIndicator[i, {0, 500}]];&#xD;
&#xD;
Great. Let&amp;#039;s save that just in case your notebook tends to crash at this point, just l like mine did when I was playing with this.&#xD;
&#xD;
    Export[&amp;#034;~/Desktop/SIR-tcourse.csv&amp;#034;, tcourse];&#xD;
&#xD;
If you wish you can now plot the time course of some of the airport catchment areas:&#xD;
&#xD;
    ListPlot[Flatten[Table[{tcourse[[All, j, 1]], tcourse[[All, j, 2]], tcourse[[All, j, 3]]}, {j, 1, 200}], 1], ImageSize -&amp;gt; Large]&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
Now that is not very helpful yet. To generate nicer plots, i.e. to normalise, we first calculate the maximal number of sick  people at any of the airports:&#xD;
&#xD;
    maxsick = Max[Flatten[tcourse[[All, All, 2]]]];&#xD;
&#xD;
We then generate movie frames, and go and get some coffee....&#xD;
&#xD;
    frames = Monitor[Table[GeoRegionValuePlot[Table[GeoPosition[airportcoords[[indices[[i]]]]] -&amp;gt; inf[k, i]/maxsick, {i, 1, Length[indices]}], PlotStyle -&amp;gt; PointSize[0.003], PlotRange -&amp;gt; 1, ImageSize -&amp;gt; Full,ColorFunction -&amp;gt; &amp;#034;Rainbow&amp;#034;], {k, 1, 300}], ProgressIndicator[k, {0, 300}]];&#xD;
&#xD;
Actually, you might want to get another coffee when you want to export the frames:&#xD;
&#xD;
    Export[&amp;#034;~/Desktop/SIR-frames-World.gif&amp;#034;, frames];&#xD;
&#xD;
Alright. That gif is a bit large to embed it into this post, but you can download it from [here][10]. All I can do is show you some frames to get an idea of how this looks:&#xD;
&#xD;
![enter image description here][11]&#xD;
&#xD;
Of course we can look at the network structure and try to understand the pattern of infections. This command is useful:&#xD;
&#xD;
    CommunityGraphPlot[AdjacencyGraph[Normal[coupling]]]&#xD;
&#xD;
![enter image description here][12]&#xD;
&#xD;
You clearly see the communities in North America, Europe and Asia. This one is also pretty:&#xD;
&#xD;
    Show[TreePlot[Subgraph[grph, ConnectedComponents[grph][[1]]], Center, PlotStyle -&amp;gt; Directive[Gray, Opacity[0.02]]], &#xD;
     TreePlot[Subgraph[grph, ConnectedComponents[grph][[1]]], Center, EdgeRenderingFunction -&amp;gt; None]]&#xD;
&#xD;
![enter image description here][13]&#xD;
&#xD;
We have several enhancements of this. First we can easily look at different countries individually. What if an ebola patient arrives at some airport in the US? [See simulation here][14]. (Careful 50 MBs!)&#xD;
&#xD;
There is also something we can do if we want to go the the level of cities. The main problem is that the Wolfram database does not yet have data for all streets between cities. In one of the online conferences it was said that that will be introduced in some later version, which I cannot wait to play with. Until then we have to cheat. (or use some online database; I prefer cheating.)&#xD;
&#xD;
We developed a model of the spreading of a disease in Nigeria. So we could go about this like this:&#xD;
&#xD;
    Clear[&amp;#034;Global`*&amp;#034;]&#xD;
    CountryData[&amp;#034;Nigeria&amp;#034;, &amp;#034;Population&amp;#034;]&#xD;
    Graphics[CountryData[&amp;#034;Nigeria&amp;#034;, &amp;#034;Polygon&amp;#034;]] &#xD;
&#xD;
Then get city names, coords and population:&#xD;
&#xD;
    names = CityData[{All, &amp;#034;Nigeria&amp;#034;}];&#xD;
    citypop = Table[CityData[names[[i]], &amp;#034;Population&amp;#034;], {i, 1, Length[names]}];&#xD;
    citycoords = Table[CityData[names[[i]], &amp;#034;Coordinates&amp;#034;], {i, 1, Length[names]}];&#xD;
&#xD;
Here comes the cheat. Because we don&amp;#039;t have the streets we use Delaunay triangulation:&#xD;
&#xD;
    Needs[&amp;#034;ComputationalGeometry`&amp;#034;]&#xD;
    dtri = DelaunayTriangulation[citycoords]; list = {}; Table[&#xD;
     Do[AppendTo[list, {i, dtri[[All, 2]][[i, j]]}], {j, 1, &#xD;
       Length[dtri[[All, 2]][[i, All]]]}], {i, 1, Length[dtri]}];&#xD;
    coupling = Table[0, {i, 1, Length[names]}, {j, 1, Length[names]}];&#xD;
    For[i = 1, i &amp;lt; Length[list] + 1, i++, &#xD;
     coupling[[list[[i]][[1]], list[[i]][[2]]]] = 1;]&#xD;
    &#xD;
    coulinginterm = coupling;&#xD;
    &#xD;
    coupling = SparseArray[coulinginterm];&#xD;
&#xD;
which gives the following network&#xD;
&#xD;
    Graphics[Join[&#xD;
      Table[Circle[citycoords[[i]], 0.02], {i, 1, Length[names]}], &#xD;
      DeleteCases[&#xD;
       Flatten[Table[&#xD;
         If[coupling[[i, j]] == 1, &#xD;
          Line[{citycoords[[i]], citycoords[[j]]}]] , {i, 1, &#xD;
          Length[names]}, {j, 1, i}], 1], Null]]]&#xD;
&#xD;
![enter image description here][15]&#xD;
&#xD;
The point in the middle corresponds to the airport where it all starts; then come its neighbours and then their neighbours etc. You could now animate this and change the colours to see how the disease spreads through the different layers. It would be nice if someone could implement that. &#xD;
&#xD;
There are obviously some problems, i.e. &amp;#034;streets&amp;#034; leaving the country etc, but the general idea should work. The rest is quite the same as before:&#xD;
&#xD;
    (*Paramters*)&#xD;
    &#xD;
    [Rho] = 0.2; [Lambda] = 0.1; Mcities = Length[names]; [Mu] = 0.05;&#xD;
    &#xD;
    (*Initiation*)&#xD;
    &#xD;
    For[i = 1, i &amp;lt;= Mcities, i++, sus[1, i] = 1.; inf[1, i] = 0.0; &#xD;
     rec[1, i] = 0.;]&#xD;
    &#xD;
    (*Starting Outbrake at the following city*)&#xD;
    &#xD;
    sus[1, 1] = 0.95; inf[1, 1] = 0.05;&#xD;
    rec[1, 1] = 0.0;&#xD;
    &#xD;
    meanNN = coupling.citypop;&#xD;
    &#xD;
    sumind = Table[&#xD;
       Take[Flatten[ArrayRules[coupling[[k, All]]][[All, 1]]], &#xD;
        Length[ArrayRules[coupling[[k, All]]]] - 1], {k, 1, Mcities}];&#xD;
    &#xD;
    sus[i_, j_] := &#xD;
     sus[i, j] = (1 - [Mu]) (sus[i - 1, &#xD;
           j] - [Rho] sus[i - 1, j] inf[i - 1, j]) + [Mu]  Total[&#xD;
          Table[sus[i - 1, sumind[[j, u]]]*citypop[[sumind[[j, u]]]], {u, &#xD;
            1, Length[sumind[[j]]]} ] ]/meanNN[[j]]; &#xD;
    inf[i_, j_] := &#xD;
     inf[i, j] = (1 - [Mu]) (inf[i - 1, &#xD;
           j] + [Rho] sus[i - 1, j] inf[i - 1, j] - [Lambda] inf[i - 1, &#xD;
            j]) + [Mu] Total[&#xD;
          Table[inf[i - 1, sumind[[j, u]]]*citypop[[sumind[[j, u]]]], {u, &#xD;
            1, Length[sumind[[j]]]} ] ]/meanNN[[j]];&#xD;
    rec[i_, j_] := &#xD;
      rec[i, j] = (1 - [Mu]) (rec[i - 1, &#xD;
            j] + [Lambda] inf[i - 1, j]) + [Mu] Total[&#xD;
           Table[rec[i - 1, sumind[[j, u]]]*citypop[[sumind[[j, u]]]], {u,&#xD;
              1, Length[sumind[[j]]]} ] ]/meanNN[[j]];&#xD;
&#xD;
This time we try to work in parallel:&#xD;
&#xD;
    LaunchKernels[];&#xD;
    tcourse = ParallelTable[{sus[i, j], inf[i, j], rec[i, j]}, {i, 1, 500}, {j, 1, Mcities}]; // AbsoluteTiming&#xD;
&#xD;
(There is something strange here. This ran in MMA9 in 6.3 seconds- I still have data from the course I taught last year. MMA10 takes ages. After the installation of MMA10 also MMA9 seems to take longer 43 seconds. Is this a bug report?). Note that this time the population sizes of the cities are taken into account and are relevant. If you run&#xD;
&#xD;
    Manipulate[&#xD;
     Graphics[{Line[Flatten[CountryData[&amp;#034;Nigeria&amp;#034;, &amp;#034;Coordinates&amp;#034;], 1]], &#xD;
       Join[Table[{ &#xD;
          RGBColor[tcourse[[t, i, 2]], tcourse[[t, i, 1]], &#xD;
           tcourse[[t, i, 3]]], Disk[citycoords[[i]], 0.1]}, {i, 1, &#xD;
          Length[names]}]]}], {t, 1, 500, 1}]&#xD;
&#xD;
or &#xD;
&#xD;
    poly = Graphics[Polygon[Flatten[CountryData[&amp;#034;Nigeria&amp;#034;, &amp;#034;Coordinates&amp;#034;], 1]], ImagePadding -&amp;gt; None];&#xD;
    Animate[ImageSubtract[&#xD;
      Graphics[ListDensityPlot[&#xD;
        Join[{{4, 3.25, 0}, {4, 14, 0}, {14, 3.25, 0}, {14, 14, 0}}, &#xD;
         Table[{citycoords[[k]][[1]], citycoords[[k]][[2]], &#xD;
           1. - tcourse[[t, k, 1]]}, {k, 1, Mcities}]], &#xD;
        InterpolationOrder -&amp;gt; 3, ColorFunction -&amp;gt; &amp;#034;Rainbow&amp;#034;, &#xD;
        PlotRange -&amp;gt; All, Frame -&amp;gt; False, PlotRangePadding -&amp;gt; None]], &#xD;
      poly], {t, 1, 500, 1}, DefaultDuration -&amp;gt; 20.]&#xD;
&#xD;
or better &#xD;
 &#xD;
&#xD;
    infmax = Max[tcourse[[All, All, 2]]];&#xD;
    frames = Table[&#xD;
       ImageSubtract[&#xD;
        Graphics[&#xD;
         ListDensityPlot[&#xD;
          Join[{{4, 3.25, 0}, {4, 14, 0}, {14, 3.25, 0}, {14, 14, 0}}, &#xD;
           Table[{citycoords[[k]][[1]], citycoords[[k]][[2]], &#xD;
             tcourse[[t, k, 2]]/infmax}, {k, 1, Mcities}]], &#xD;
          InterpolationOrder -&amp;gt; 3, ColorFunction -&amp;gt; &amp;#034;Rainbow&amp;#034;, &#xD;
          PlotRange -&amp;gt; All, Frame -&amp;gt; False, PlotRangePadding -&amp;gt; None, &#xD;
          ColorFunctionScaling -&amp;gt; False]], poly], {t, 1, 500, 6}];&#xD;
&#xD;
you get nice animations like this one:&#xD;
&#xD;
![enter image description here][16]&#xD;
&#xD;
I have noticed that Nigeria needs to be rotated, but I hope that the idea becomes clear. I am also aware that there are many flaws in this. SIR is certainly not the best way forward to model Ebola. Any population dynamicist and/or health expert can certainly come up with an endless list of problems. The network is not perfect. For more serious applications we actually use models for the cities, i.e. street connections among close cities and airport connections among countries etc. The problem is that if we simulate between 200-20000  cities per country plus the airports, a standard laptop runs into trouble. On the bright side, we have a cluster on which this kind of larger simulations work just fine. &#xD;
&#xD;
Hope that you like this anyway,&#xD;
&#xD;
Marco&#xD;
&#xD;
&#xD;
  [1]: http://www.st-margaret.aberdeen.sch.uk&#xD;
  [2]: http://community.wolfram.com/groups/-/m/t/325956&#xD;
  [3]: http://mtbi.asu.edu/files/Mathematical_Models_to_Study_the_Outbreaks_of_Ebola.pdf&#xD;
  [4]: http://openflights.org/data.html&#xD;
  [5]: /c/portal/getImageAttachment?filename=Airportsall.jpg&amp;amp;userId=48754&#xD;
  [6]: /c/portal/getImageAttachment?filename=Airports-world.jpg&amp;amp;userId=48754&#xD;
  [7]: http://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology&#xD;
  [8]: /c/portal/getImageAttachment?filename=SingleSIR.jpg&amp;amp;userId=48754&#xD;
  [9]: /c/portal/getImageAttachment?filename=SIR-airportstcourse.jpg&amp;amp;userId=48754&#xD;
  [10]: https://www.dropbox.com/s/9y6d16z82qjw261/SIR-frames.gif?dl=0&#xD;
  [11]: /c/portal/getImageAttachment?filename=SIR-airports-frames.jpg&amp;amp;userId=48754&#xD;
  [12]: /c/portal/getImageAttachment?filename=Airports-CommNetwork.jpg&amp;amp;userId=48754&#xD;
  [13]: /c/portal/getImageAttachment?filename=SIR-networkrings.jpg&amp;amp;userId=48754&#xD;
  [14]: https://www.dropbox.com/s/0qwgmi7ks8dpsjh/SIR-USA-frames.gif?dl=0&#xD;
  [15]: /c/portal/getImageAttachment?filename=SIR-Nigerianetwork.jpg&amp;amp;userId=48754&#xD;
  [16]: /c/portal/getImageAttachment?filename=SIR-movie.gif&amp;amp;userId=48754</description>
    <dc:creator>Marco Thiel</dc:creator>
    <dc:date>2014-08-22T20:18:58Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/526743">
    <title>[JAM] CellularAutomaton Code Jam Wolfram Summer School 2015</title>
    <link>https://community.wolfram.com/groups/-/m/t/526743</link>
    <description>[Wolfram Science Summer School][1] and [Wolfram Innovation Summer School][2] are happening now in Boston at Bentley University. The goal of this Code Jam is to post interesting code snippets that fit the Wolfram Language functionality described in detail below. By &amp;#034;interesting&amp;#034; I mean simple programs that generate complex patterns. We will be jamming with our students, but everyone is welcome to join. Let&amp;#039;s have some fun!&#xD;
&#xD;
In this Code Jam we will take a look at the CellularAutomaton (CA) function and its syntax **for rules defined as functions**. This may sound a bit confusing, so let&amp;#039;s take a look at some examples. First, if you haven&amp;#039;t yet, you have to make yourself familiar with the [CellularAutomaton][3] function. The most well known cases are integer Wolfram indexes for [CA rules][4], for instance for the celebrated rule 30:&#xD;
&#xD;
    ArrayPlot[CellularAutomaton[30, RandomInteger[1, 100], 50]]&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
But CellularAutomaton can take a function as a rule. Below are some examples. Use an arbitrary symbolic function f as the rule to apply to range-1 neighbors:&#xD;
&#xD;
    CellularAutomaton[{f[#] &amp;amp;, {}, 1}, {a, b, c}, 1]&#xD;
&#xD;
`{{a, b, c}, {f[{c, a, b}], f[{a, b, c}], f[{b, c, a}]}}`&#xD;
&#xD;
Set up a &amp;#034;Pascal&amp;#039;s triangle cellular automaton&amp;#034;:&#xD;
&#xD;
    CellularAutomaton[{f[#] &amp;amp;, {}, 1/2}, {a, b, c}, 1]&#xD;
&#xD;
`{{a, b, c}, {f[{c, a}], f[{a, b}], f[{b, c}]}}`&#xD;
&#xD;
    CellularAutomaton[{Total[#] &amp;amp;, {}, 1/2}, {{1}, 0}, 3] &#xD;
&#xD;
`{{1, 0, 0, 0}, {1, 1, 0, 0}, {1, 2, 1, 0}, {1, 3, 3, 1}}`&#xD;
&#xD;
Additive cellular automaton modulo 4:&#xD;
&#xD;
    ArrayPlot[&#xD;
     CellularAutomaton[{Mod[Total[#], 4] &amp;amp;, {}, 1}, {{1}, 0}, 50], &#xD;
     ColorFunction -&amp;gt; &amp;#034;Rainbow&amp;#034;]&#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
The second argument to the function is the step number:&#xD;
&#xD;
    CellularAutomaton[{f[#1, #2] &amp;amp;, {}, 1}, {a, b, c}, 1]&#xD;
&#xD;
`{{a, b, c}, {f[{c, a, b}, 1], f[{a, b, c}, 1], f[{b, c, a}, 1]}}`&#xD;
&#xD;
    CellularAutomaton[{f, {}, 1}, {a, b, c}, 1]&#xD;
&#xD;
`{{a, b, c}, {f[{c, a, b}, 1], f[{a, b, c}, 1], f[{b, c, a}, 1]}}`&#xD;
&#xD;
Change the rule at successive steps; #2 gives the step number:&#xD;
&#xD;
    ArrayPlot[&#xD;
     CellularAutomaton[{Mod[Total[#] + #2, 4] &amp;amp;, {}, 1}, {{1}, 0}, 30], &#xD;
     ColorFunction -&amp;gt; &amp;#034;Rainbow&amp;#034;]&#xD;
&#xD;
![enter image description here][8]&#xD;
&#xD;
Use continuous values for cells:&#xD;
&#xD;
    ArrayPlot[CellularAutomaton[{Mod[Total[#]/2, 1] &amp;amp;, {}, 1}, {{1}, 0}, 50]]&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
    Manipulate[&#xD;
     ArrayPlot[&#xD;
      CellularAutomaton[{Mod[s Total[#], 1] &amp;amp;, {}, 2}, {{1}, 0}, 50],&#xD;
      ColorFunction -&amp;gt; &amp;#034;Rainbow&amp;#034;, PixelConstrained -&amp;gt; 3]&#xD;
     , {s, .01, .99}]&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
Try different functions and different initial conditions.  They can be strings, numbers, graphics or expressions.  Try ArrayPlot but also try other visualization tools like Grid. Try them out.  Post code, images, and text comments. You can also comment on other people&amp;#039;s code.&#xD;
&#xD;
  [1]: https://www.wolframscience.com/summerschool/&#xD;
  [2]: http://education.wolfram.com/summer/innovation/&#xD;
  [3]: http://reference.wolfram.com/language/ref/CellularAutomaton.html&#xD;
  [4]: http://www.wolframscience.com/nksonline/page-53&#xD;
  [5]: /c/portal/getImageAttachment?filename=SSCJSS2015_1.png&amp;amp;userId=11733&#xD;
  [6]: /c/portal/getImageAttachment?filename=SSCJSS2015_2.png&amp;amp;userId=11733&#xD;
  [7]: /c/portal/getImageAttachment?filename=SSCJSS2015_3.png&amp;amp;userId=11733&#xD;
  [8]: /c/portal/getImageAttachment?filename=SSCJSS2015_4.png&amp;amp;userId=11733&#xD;
  [9]: /c/portal/getImageAttachment?filename=SSCJSS2015_5.png&amp;amp;userId=11733&#xD;
  [10]: /c/portal/getImageAttachment?filename=4926wsdaf345678iruyjtdhfgsdasrt4.gif&amp;amp;userId=11733</description>
    <dc:creator>Vitaliy Kaurov</dc:creator>
    <dc:date>2015-07-09T08:46:23Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/863933">
    <title>Walking strandbeest dynamics</title>
    <link>https://community.wolfram.com/groups/-/m/t/863933</link>
    <description>Many of you have seen the strandbeest (from Dutch, meaning beach-beast). These PVC tube animals created by Theo Jansen walk along the beach and are wind powered:&#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
Years ago (2009 to be more exact) I made a post on my blog about the movement of the legs, as evidenced by the still-nicely-working Mathematica notebook:&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
At the time the proportions of the legs were not known publicly so I meticulously studied frames of (low quality) YouTube videos. I made the following diagram in Illustrator of what I thought I saw:&#xD;
&#xD;
![enter image description here][3] ![enter image description here][4]&#xD;
&#xD;
On the left the length of the legs in red, and in blue the numbers of the joints. On the right the trajectory of the joints that I calculated at the time in Mathematica. It&amp;#039;s funny that my blog does not exist any more (for years actually), but these images live on, as I found out when I looked for strandbeest on Google Images:&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
My images! But not on my website! Nice to see people still use it. Now, in 2016, I saw these files on my laptop, and thought: is there finally more known about them? Well yes, there is! The exact proportions are now known and there is tons and tons of videos, lectures, 3D-printable strandbeest models, interviews with Theo Jansen and other stuff! So now we can find the exact dimensions readily on the internet:&#xD;
&#xD;
![enter image description here][6] &#xD;
&#xD;
Notice that I (wrongly) assumed that the legs had &amp;#039;feet&amp;#039;! oops! I was very happy to see that my lengths were not that wrong though! Let&amp;#039;s recreate the strandbeest. We do so by first creating a function that quickly finds the intersection of two circles:&#xD;
&#xD;
    Clear[FindPoint, FindLines]&#xD;
    FindPoint[p1 : {x1_, y1_}, p2 : {x2_, y2_}, R_, r_, side_] := Module[{d, x, y, vc1, vc2, p, sol, sol1, sol2, s1, s2, sr},&#xD;
      d = N@Sqrt[(x2 - x1)^2 + (y2 - y1)^2];&#xD;
      x = (d^2 - r^2 + R^2)/(2 d);&#xD;
      y = Sqrt[R^2 - x^2];&#xD;
      vc1 = Normalize[{x2 - x1, y2 - y1}];&#xD;
      vc2 = Cross[vc1];&#xD;
      p = {x1, y1} + x vc1;&#xD;
      {sol1, sol2} = {p + y vc2, p - y vc2};&#xD;
      s1 = Sign[Last[Cross[Append[(p2 - p1), 0], Append[(sol1 - p1), 0]]]];&#xD;
      s2 = Sign[Last[Cross[Append[(p2 - p1), 0], Append[(sol2 - p1), 0]]]];&#xD;
      sr = If[side === Left, 1, -1];&#xD;
      Switch[sr, s1,&#xD;
       sol1&#xD;
       ,&#xD;
       s2&#xD;
       ,&#xD;
       sol2&#xD;
       ]&#xD;
      ]&#xD;
&#xD;
This finds on the side &amp;#039;side&amp;#039; (Left/Right) the intersection point of two circles positioned at p1 and p2, with radii R and r, respectively. And now we can easily compute all the little vertices/joints of our beast:&#xD;
&#xD;
    FindLines[\[Theta]_] := Module[{p1, p2, p3, p4, p5, p6, p7, p8, p10, p11, p12, p13, p14, p15},&#xD;
      {p1, p2, p3, p4, p5, p6, p7, p8, p10, p11, p12, p13, p14, p15} = FindPoints[\[Theta]];&#xD;
      {{p1, p2}, {p2, p3}, {p3, p4}, {p1, p4}, {p2, p6}, {p4, p6}, {p3, p5}, {p4, p5}, {p5, p8}, {p6, p8}, {p6, p7}, {p7, p8}, {p1, &#xD;
        p11}, {p10, p11}, {p2, p10}, {p2, p13}, {p11, p13}, {p10, p12}, {p11, p12}, {p12, p14}, {p13, p14}, {p13, p15}, {p14, p15}}&#xD;
      ]&#xD;
    FindPoints[\[Theta]_] := Module[{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16},&#xD;
      p1 = {0, 0};&#xD;
      p4 = {38, -7.8};&#xD;
      p11 = {-38, -7.8};&#xD;
      p2 = 15 {Cos[\[Theta]], Sin[\[Theta]]};&#xD;
      &#xD;
      p3 = FindPoint[p2, p4, 50, 41.5, Left];&#xD;
      p6 = FindPoint[p2, p4, 61.9, 39.3, Right];&#xD;
      p5 = FindPoint[p3, p4, 55.8, 41.5, Left];&#xD;
      p8 = FindPoint[p5, p6, 39.4, 36.7, Left];&#xD;
      p7 = FindPoint[p6, p8, 49, 65.7, Right];&#xD;
      &#xD;
      p10 = FindPoint[p2, p11, 50, 41.5, Right];&#xD;
      p13 = FindPoint[p2, p11, 61.9, 39.3, Left];&#xD;
      p12 = FindPoint[p10, p11, 55.8, 41.5, Right];&#xD;
      p14 = FindPoint[p12, p13, 39.4, 36.7, Right];&#xD;
      p15 = FindPoint[p13, p14, 49, 65.7, Left];&#xD;
      &#xD;
      {p1, p2, p3, p4, p5, p6, p7, p8, p10, p11, p12, p13, p14, p15}&#xD;
      ]&#xD;
&#xD;
Now we can plot it easily:&#xD;
&#xD;
    trajectoriesdata = (FindPoints /@ Subdivide[0, 2 Pi, 100])\[Transpose];&#xD;
    Manipulate[&#xD;
      Graphics[{Arrowheads[Large], Arrow /@ trajectoriesdata, Thick, Red, Line[FindLines[\[Theta]]]},&#xD;
       PlotRange -&amp;gt; {{-150, 150}, {-120, 70}}, &#xD;
       ImageSize -&amp;gt; 800&#xD;
      ]&#xD;
     ,&#xD;
     {\[Theta], 0, 2 \[Pi]}&#xD;
    ]&#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
We can also make an entire bunch of legs at the same time and make a 3D beast!&#xD;
&#xD;
    Manipulate[&#xD;
     mp = 60;&#xD;
     n = 12;&#xD;
     \[CurlyPhi] = Table[Mod[5 \[Iota], n, 1], {\[Iota], 1, n}];&#xD;
     Graphics3D[{Darker@Yellow, Table[&#xD;
        Line[ &#xD;
         Map[Prepend[mp \[Iota]], &#xD;
          FindLines[\[Theta] + \[CurlyPhi][[\[Iota]]] (2 Pi/n)], {2}]],&#xD;
        {\[Iota], n}&#xD;
        ]&#xD;
       , Black, Line[{{mp 1, 0, 0}, {mp n, 0, 0}}]&#xD;
       }&#xD;
      ,&#xD;
      Lighting -&amp;gt; &amp;#034;Neutral&amp;#034;,&#xD;
      PlotRangePadding -&amp;gt; Scaled[.1],&#xD;
      PlotRange -&amp;gt; {{-mp, (n + 1) mp}, {-150, 150}, {-150, 150}},&#xD;
      Boxed -&amp;gt; False,&#xD;
      ImageSize -&amp;gt; 700&#xD;
      ]&#xD;
     ,&#xD;
     {\[Theta], 0, 2 \[Pi]}&#xD;
     ]&#xD;
&#xD;
![enter image description here][8]&#xD;
&#xD;
From the side we can look at how the legs of 4-pair-legged and 6-pair-legged versions of the beasts work:&#xD;
&#xD;
![enter image description here][9] ![enter image description here][10]&#xD;
&#xD;
Hope you enjoyed this! Perhaps someone else can make this thing actually walk over a (bumpy) surface?&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=LVDKumerus2.jpg&amp;amp;userId=73716&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-05-29at00.51.53.png&amp;amp;userId=73716&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=strandbeest_sketch.png&amp;amp;userId=73716&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=strandbeest_trajectories.png&amp;amp;userId=73716&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-05-29at00.16.23.png&amp;amp;userId=73716&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Strandbeest_Leg_Proportions-01.png&amp;amp;userId=73716&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=3493strandwalk.gif&amp;amp;userId=73716&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=3587strandwalk3D.gif&amp;amp;userId=73716&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=4legged.gif&amp;amp;userId=73716&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=6legged.gif&amp;amp;userId=73716</description>
    <dc:creator>Sander Huisman</dc:creator>
    <dc:date>2016-05-28T23:02:16Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/235291">
    <title>Random Snowflake Generator Based on Cellular Automaton</title>
    <link>https://community.wolfram.com/groups/-/m/t/235291</link>
    <description>[img]/c/portal/getImageAttachment?filename=fig0.gif&amp;amp;userId=93201[/img]&#xD;
&#xD;
Some time ago one of my friends asked me whether it is possible to design a cellular automaton which can generate realistic snowflakes. I recall my crystallography and thermodynamics knowledge and came up a very simple yet impressive model.&#xD;
&#xD;
&#xD;
[size=5][b]The Regular Triangular Lattice[/b][/size]&#xD;
&#xD;
First of all, we are trying to simulate snowflake, which is a kind of hexagonal crystal. So it should be best to construct our CA on a regular hexagonal grid, i.e. regular triangular lattice.&#xD;
&#xD;
We all know [b]CellularAutomaton[/b] inherently works on rectangle lattices (&amp;#034;4-lattice&amp;#034; for short), so how can we deduce a triangular lattice (&amp;#034;3-lattice&amp;#034; for short) on it? Well, the differences between rect-lattice and triangular one is just a geometric transformation.&#xD;
&#xD;
To demonstrate that, have a look at the following 4-lattice, with a blue square highlighting the range-1 [url=http://mathworld.wolfram.com/MooreNeighborhood.html]Moore neighborhood[/url]:&#xD;
&#xD;
[img=width: 388px; height: 396px;]/c/portal/getImageAttachment?filename=fig1.gif&amp;amp;userId=93201[/img]&#xD;
&#xD;
Clearly there is always a hexagon (the green area) in this kind of neighborhood.&#xD;
&#xD;
So forming a regular 3-lattice is as straightforward as doing a simple affine transformation (basically a shearing and a scaling):&#xD;
&#xD;
[img=width: 484px; height: 304px;]/c/portal/getImageAttachment?filename=fig2.gif&amp;amp;userId=93201[/img]&#xD;
&#xD;
So to take advantage of all the power of [b]CellularAutomaton[/b], all we have to do, is to use a following special 6-neighborhood stencil on rectangle lattices, meanwhile our model can be discussed and constructed on regular triangular lattice convieniently:&#xD;
&#xD;
[img=width: 118px; height: 57px;]/c/portal/getImageAttachment?filename=fig3.png&amp;amp;userId=93201[/img]&#xD;
&#xD;
And after the calculation, we can perform the affine transformation with following functions to get a nice hexagonal grid picture.&#xD;
&#xD;
[mcode]Clear[vertexFunc]&#xD;
&#xD;
vertexFunc = &#xD;
        Compile[{{para, _Real, 1}}, &#xD;
            Module[{center, ratio}, center = para[[1 ;; 2]];&#xD;
                ratio = para[[3]];&#xD;
                {Re[#], Im[#]} + {{1, -(1/2)}, {0, &#xD;
                                        Sqrt[3]/2}}.Reverse[{-1, 1} center + {3, 0}] &amp;amp; /@ (ratio 1/&#xD;
                                Sqrt[3] E^(I ?/6) E^(I Range[6] ?/3))], &#xD;
            RuntimeAttributes -&amp;gt; {Listable}, Parallelization -&amp;gt; True, &#xD;
            RuntimeOptions -&amp;gt; &amp;#034;Speed&amp;#034;&#xD;
            (*,CompilationTarget?&amp;#034;C&amp;#034;*)];&#xD;
&#xD;
Clear[displayfunc]&#xD;
displayfunc[array_, ratio_] := &#xD;
    Graphics[{FaceForm[{ColorData[&amp;#034;DeepSeaColors&amp;#034;][3]}], &#xD;
            EdgeForm[{ColorData[&amp;#034;DeepSeaColors&amp;#034;][4]}], &#xD;
            Polygon[vertexFunc[Append[#, ratio]] &amp;amp; /@ Position[array, 1]]}, &#xD;
        Background -&amp;gt; ColorData[&amp;#034;DeepSeaColors&amp;#034;][0]][/mcode]&#xD;
&#xD;
&#xD;
[size=5][b]The Model[/b][/size]&#xD;
&#xD;
To construct the crystallization model, let&amp;#039;s consider one of the 6-neighborhood stencil, where each cell represents a minimal crystal unit:&#xD;
&#xD;
[img=width: 261px; height: 236px;]/c/portal/getImageAttachment?filename=fig4.png&amp;amp;userId=93201[/img]&#xD;
&#xD;
A simple model will need only 2 states: [b]0[/b] for &amp;#034;[i]It&amp;#039;s empty[/i]&amp;#034;, [b]1[/b] for &amp;#034;[i]There is a crystal unit[/i]&amp;#034;. So by considering all (except the [b]000000[/b] one, because we are generating ONE snowflake thus don&amp;#039;t want a crystall randomly arises from void) [b]6-bit[/b] non-negative numbers, we can have a finite set of possible arrangements of the neighborhood:&#xD;
&#xD;
[mcode]stateSet = Tuples[{0, 1}, 6] // Rest[/mcode]&#xD;
However, from the viewpoint of physics, any two arrangements which can be transformed into each other with only rotation and reflection should be considered as the same arrangement in the sense of their physical effects on the central cell (i.e. cell[size=1]2,2[/size]) are the same:&#xD;
&#xD;
[img=width: 363px; height: 117px;]/c/portal/getImageAttachment?filename=fig5.png&amp;amp;userId=93201[/img]&#xD;
&#xD;
So we should gather [b]stateSet[/b] with above equivalence class:&#xD;
&#xD;
[mcode]gatherTestFunc = Function[lst, Union[Join[&#xD;
&#xD;
                    RotateLeft[lst, # - 1] &amp;amp; /@ Flatten[Position[lst, 1]],&#xD;
                    RotateLeft[Reverse[lst], # - 1] &amp;amp; /@ &#xD;
                        Flatten[Position[Reverse[lst], 1]]&#xD;
                    ]]];&#xD;
&#xD;
stateClsSet = Sort /@ Gather[stateSet, gatherTestFunc[#1] == gatherTestFunc[#2] &amp;amp;];&#xD;
&#xD;
stateClsSetHomogeneous = ArrayPad[#, {{0, 12 - Length@#}, {0, 0}}] &amp;amp; /@ stateClsSet;[/mcode]&#xD;
Which turned out to be [b]12[/b] classes in total:&#xD;
&#xD;
[img=width: 710px; height: 127px;]/c/portal/getImageAttachment?filename=fig6.png&amp;amp;userId=93201[/img]&#xD;
&#xD;
Now from the viewpoint of cellular automaton, we need to establish a set of rules on how should any 6-neighborhood arrangement, i.e. those 12 kinds of equivalence classes, determine the state of the central cell.&#xD;
&#xD;
There are 4 kinds of possible transformations on cell[size=1]2,2[/size]: [b]0 --&amp;gt; 1[/b] is called [b]frozen[/b], [b]0 --&amp;gt; 0[/b] is [b]remaining empty[/b], [b]1 --&amp;gt; 1[/b] is [b]remaining frozen[/b], and [b]1 --&amp;gt; 0[/b] is called [b]melten[/b]. To make things more interesting and to explore more possibilities, we can introduce probability here, so certain arrangement will give certain probabilities corresponding to the 4 kinds of transformations. But notice that because of the unitarity of probability, we have Prob(frozen) + Prob(0-&amp;gt;0) = 1 and Prob(melten) + Prob(1-&amp;gt;1) = 1, so only 2 of the 4 probabilities are independent. In the following, we&amp;#039;ll choose Prob(frozen) and Prob(melten), and denote them as [b]pFrozen[/b] and [b]pMelten[/b].&#xD;
&#xD;
[img=width: 800px; height: 367px;]/c/portal/getImageAttachment?filename=fig7.png&amp;amp;userId=93201[/img]&#xD;
&#xD;
Back to physics / thermodynamics, those 24 probabilities, [b]pFrozen[/b] and [b]pMelten[/b], can of corse be determined by serious physical models, or they can be chosen randomly just for fun. For example, an intuitive (and naive) idea would be to believe an empty cell nearby a sharp pointed end or with abundant moisture source will have a high [b]pFrozen[/b]. (People who are interested in the serious physical models should not miss [url=http://psoup.math.wisc.edu/Snowfakes.htm]the Gravner-Griffeath Snowfakes model[/url].)&#xD;
&#xD;
Now we have the grid, the stencil, the neighborhood arrangement set and the transfer probabilities, we&amp;#039;re offically ready to construct our cellular automaton rules.&#xD;
Following the above discussion, the construction is straightforward. There are only two points which need to pay attention to. One is to keep in mind that the rule function is applied on the 3x3 stencil, so even cell[size=1]1,1[/size] and cell[size=1]3,3[/size] has nothing to do with our model, don&amp;#039;t forget handling them. The second is to use a [b]SeedRandom[/b] function to make sure same arrangement gives same result in same time step, otherwise the 6-fold rotational symmetry and 3 axes of reflection symmetry will both break!&#xD;
&#xD;
[mcode]Clear[ruleFunc]&#xD;
&#xD;
ruleFunc = With[{&#xD;
                stateClsSetHomogeneous = stateClsSetHomogeneous,&#xD;
                seedStore = RandomInteger[{0, 1000}, 1000],&#xD;
                pFreeze = {1,   0,     0.6,   0,     0.3,   0.15,   0,     0.2,   0,     0.2,   0,     0.8},&#xD;
                pMelt   = {0,   0.7,   0.5,   0.7,   0.7,   0.5,    0.3,   0.5,   0.3,   0.2,   0.1,   0  }&#xD;
                },&#xD;
            Compile[{{neighborarry, _Integer, 2}, {step, _Integer}},&#xD;
                Module[{cv, neighborlst, cls, rand},&#xD;
                    cv = neighborarry[[2, 2]];&#xD;
                    neighborlst = {#[[1, 2]], #[[1, 3]], #[[2, 3]], #[[3, 2]], #[[3, &#xD;
                                        1]], #[[2, 1]]} &amp;amp;[neighborarry];&#xD;
                    If[Total[neighborlst] == 0, cv,&#xD;
                        cls = Position[stateClsSetHomogeneous, neighborlst][[1, 1]];&#xD;
                        SeedRandom[seedStore[[step + 1]]];&#xD;
                        rand = RandomReal[];&#xD;
                        Boole@If[cv == 0, rand &amp;lt; pFreeze[[cls]], rand &amp;gt; pMelt[[cls]]]&#xD;
                        ]],&#xD;
                (*CompilationTarget -&amp;gt; &amp;#034;C&amp;#034;,*)&#xD;
                RuntimeAttributes -&amp;gt; {Listable}, Parallelization -&amp;gt; True, &#xD;
                RuntimeOptions -&amp;gt; &amp;#034;Speed&amp;#034;&#xD;
                ]&#xD;
            ];[/mcode]&#xD;
(Note: re-compile the rule function [b]ruleFunc[/b] will give a different set of [b]seedStore[/b] thus a different growth path.)&#xD;
&#xD;
Now everything is ready, let&amp;#039;s grow a snowflake from the beginning! :D&#xD;
&#xD;
[mcode]dataSet = Module[{&#xD;
&#xD;
                    rule,&#xD;
                    initM = {{&#xD;
                                    {0, 0, 0},&#xD;
                                    {0, 1, 0},&#xD;
                                    {0, 0, 0}&#xD;
                                }, 0},&#xD;
                    rspec = {1, 1},&#xD;
                    tmin = 0, tmax = 100, dt = 1},&#xD;
                rule = {ruleFunc, {}, rspec};&#xD;
                CellularAutomaton[rule, initM, {{tmin, tmax, dt}}]&#xD;
                ]; // AbsoluteTiming&#xD;
&#xD;
Animate[&#xD;
    Rotate[displayfunc[dataSet[[k]], .8], 90 °],&#xD;
    {k, 1, Length[dataSet], 1},&#xD;
    AnimationDirection -&amp;gt; ForwardBackward,&#xD;
    AnimationRunning -&amp;gt; False, DisplayAllSteps -&amp;gt; True&#xD;
    ][/mcode]&#xD;
&#xD;
[img]/c/portal/getImageAttachment?filename=fig0.gif&amp;amp;userId=93201[/img]&#xD;
&#xD;
&#xD;
&#xD;
[size=5][b]Possible Improvements[/b][/size]&#xD;
&#xD;
We used a [b]SeedRandom[/b] function in our CA rule function to force the 6-fold rotational symmetry and 3 axes of reflection symmetry, and performed the CA calculation on all cells. However, this so called [url=http://demonstrations.wolfram.com/DihedralGroupNOfOrder2n/][i]D[/i][size=1]6[/size] symmetry[/url] can (and should) be integrated into our model, which will saving [b]11/12[/b] of the calculation. Also, the randomness of the growth path comes from [b]seedStore[/b], so to generate a new growth path, we have to re-compile the rule function. But with a improved model as described above, this constraint will no longer exist.&#xD;
&#xD;
[img=width: 800px; height: 177px;]/c/portal/getImageAttachment?filename=fig8.png&amp;amp;userId=93201[/img]&#xD;
[b][size=4]&#xD;
&#xD;
[size=5]Open question [/size]&#xD;
[/size][/b]&#xD;
Can we construct a well-organized structure (like the crystals) from a cellular automaton defined on an [b]irregular[/b] grid? While I believe the answer is [i]yes[/i], the next question would be [i]how?[/i]</description>
    <dc:creator>Silvia Hao</dc:creator>
    <dc:date>2014-04-11T16:03:33Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/595870">
    <title>Ocean currents: from Fukushima and rubbish, to Malaysian airplane MH370</title>
    <link>https://community.wolfram.com/groups/-/m/t/595870</link>
    <description>![Ocean currents: from Fukushima and rubbish, to Malaysian airplane MH370][1]&#xD;
&#xD;
In this post I will use data from NASA&amp;#039;s ECCO2 project (http://ecco2.jpl.nasa.gov/) to simulate various scenarios: the movement of radioactive particles from the Fukushima nuclear power plant and the accumulation of rubbish in the oceans. I download about 20 years worth of oceanographic data and study how the flow of water might transport particles. A slight modification of the program might be useful to determine the crash site of Malaysian airplane MH370. The work was done with [Bjoern Schelter][2], who is member of this community. &#xD;
&#xD;
We will first download the vector fields for u and v direction. We obtain data for different depth, but I will only use surface currents. We first generate a list of filenames.&#xD;
&#xD;
    filenamesU = (&amp;#034;http://ecco2.jpl.nasa.gov/opendap/data1/cube/cube92/lat_lon/quart_90S_90N/UVEL.nc/UVEL.1440x720x50.&amp;#034; &amp;lt;&amp;gt; # &amp;lt;&amp;gt; &amp;#034;.nc.ascii?UVEL[0:1:0][0:1:0][0:1:719][0:1:1439]&amp;#034; &amp;amp; /@ (StringJoin[{ToString[#[[1]]], StringTake[StringJoin[ToString /@ PadLeft[{#[[2]]}, 2]], -2], StringTake[StringJoin[ToString /@ PadLeft[{#[[3]]}, 2]], -2]}] &amp;amp; /@ Table[Normal[DatePlus[DateObject[{1992, 1, 2}], 3*n]], {n, 0, 2556}]));&#xD;
    &#xD;
    filenamesV = (&amp;#034;http://ecco2.jpl.nasa.gov/opendap/data1/cube/cube92/lat_lon/quart_90S_90N/VVEL.nc/VVEL.1440x720x50.&amp;#034; &amp;lt;&amp;gt; # &amp;lt;&amp;gt; &amp;#034;.nc.ascii?VVEL[0:1:0][0:1:0][0:1:719][0:1:1439]&amp;#034; &amp;amp; /@ (StringJoin[{ToString[#[[1]]], StringTake[StringJoin[ToString /@ PadLeft[{#[[2]]}, 2]], -2],StringTake[StringJoin[ToString /@ PadLeft[{#[[3]]}, 2]], -2]}] &amp;amp; /@ Table[Normal[DatePlus[DateObject[{1992, 1, 2}], 3*n]], {n, 0, 2556}]));&#xD;
&#xD;
These filenames cover a time interval from the beginning of 1992 to 2012. We then download the actual data (which can take really long):&#xD;
&#xD;
    Monitor[For[k = 1, k &amp;lt;= Length[filenamesV], k++, &#xD;
      Export[&amp;#034;~/Desktop/OceanVelocities/velV&amp;#034; &amp;lt;&amp;gt; ToString[k] &amp;lt;&amp;gt; &amp;#034;.csv&amp;#034;, &#xD;
       ToExpression[StringSplit[StringSplit[#, &amp;#034;],&amp;#034;][[2]], &amp;#034;,&amp;#034;]] &amp;amp; /@ &#xD;
        StringSplit[Import[filenamesV[[k]]], &amp;#034;VVEL.VVEL[VVEL.TIME=&amp;#034;][[&#xD;
         2 ;;]] ]], &#xD;
     ProgressIndicator[Dynamic[k], {0, Length[filenamesV]}]]&#xD;
&#xD;
and&#xD;
&#xD;
    Monitor[For[k = 1, k &amp;lt;= Length[filenamesU], k++, &#xD;
      Export[&amp;#034;~/Desktop/OceanVelocities/velU&amp;#034; &amp;lt;&amp;gt; ToString[k] &amp;lt;&amp;gt; &amp;#034;.csv&amp;#034;, &#xD;
       ToExpression[StringSplit[StringSplit[#, &amp;#034;],&amp;#034;][[2]], &amp;#034;,&amp;#034;]] &amp;amp; /@ &#xD;
        StringSplit[Import[filenamesU[[k]]], &amp;#034;UVEL.UVEL[UVEL.TIME=&amp;#034;][[&#xD;
         2 ;;]] ]], &#xD;
     ProgressIndicator[Dynamic[k], {0, Length[filenamesU]}]]&#xD;
&#xD;
This will download about 16GB worth of data. You will, however, get reasonable results if you only use 30 frames, i.e. if you substitute Length[filenamesU] and Length[filenamesV] by 30. We will now create a figure for the first frame.&#xD;
&#xD;
    velV1 = Import[&amp;#034;~/Desktop/OceanVelocities/velV1.csv&amp;#034;];&#xD;
    velU1 = Import[&amp;#034;~/Desktop/OceanVelocities/velU1.csv&amp;#034;];&#xD;
&#xD;
We can now generate the velocity vectors for each point on the surface of the earth&#xD;
&#xD;
    veltot = Table[{velU1[[i, j]], velV1[[i, j]]}, {i, 1, 720}, {j, 1, 1440}];&#xD;
&#xD;
and then clean the data&#xD;
&#xD;
    veltot2 = Table[If[((StringQ[#[[1]]] || StringQ[#[[2]]]) &amp;amp; /@ {veltot[[i, j]] })[[1]], {0., 0.}, {velU1[[i, j]], velV1[[i, j]]}], {i, 1, 720}, {j, 1, 1440}];&#xD;
&#xD;
We can also calculate the speed at each point.&#xD;
&#xD;
    veltottot = Table[If[((StringQ[#[[1]]] || StringQ[#[[2]]]) &amp;amp; /@ {veltot[[i, j]] })[[1]], 0., Norm[{velU1[[i, j]], velV1[[i, j]]}]], {i, 1, 720}, {j, 1, 1440}];&#xD;
&#xD;
This next function will produce a visualisation of the speed profile for the first frame.&#xD;
&#xD;
    Show[ArrayPlot[Reverse[veltottot], PlotLegends -&amp;gt; Automatic, ImageSize -&amp;gt; Full, ColorFunction -&amp;gt; &amp;#034;TemperatureMap&amp;#034;], ListVectorPlot[Transpose[veltot2], VectorPoints -&amp;gt; 50]]&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
Note the incredible fine-structure in that image. We could now produce an animation for all frames. This will, however, be too large for the memory of most computers, so I would not execute it. If you only use the first 30 frames you get a reasonable idea of its working.&#xD;
&#xD;
    framesflow = {}; Monitor[&#xD;
     For[k = 1, k &amp;lt;= Length[filenamesU], k++, &#xD;
      velU1 = Import[&amp;#034;~/Desktop/velU&amp;#034; &amp;lt;&amp;gt; ToString[k] &amp;lt;&amp;gt; &amp;#034;.csv&amp;#034;]; &#xD;
      velV1 = Import[&amp;#034;~/Desktop/velV&amp;#034; &amp;lt;&amp;gt; ToString[k] &amp;lt;&amp;gt; &amp;#034;.csv&amp;#034;];&#xD;
      veltot = Table[{velU1[[i, j]], velV1[[i, j]]}, {i, 1, 720}, {j, 1, 1440}]; &#xD;
      AppendTo[framesflow, ArrayPlot[Reverse[Table[If[((StringQ[#[[1]]] || StringQ[#[[2]]]) &amp;amp; /@ {veltot[[i,j]] })[[1]], 0., Norm[{velU1[[i, j]], velV1[[i, j]]}]], {i, 1, 720}, {j, 1, 1440}]], PlotLegends -&amp;gt; Automatic, ImageSize -&amp;gt; Full, ColorFunction -&amp;gt; &amp;#034;TemperatureMap&amp;#034;]]], k];&#xD;
&#xD;
This following command exports all the frames as individual gif files, which can later be combined into a gif animation. &#xD;
&#xD;
    Monitor[For[k = 1, k &amp;lt;= Length[filenamesU], k++, &#xD;
       velU1 = Import[&#xD;
         &amp;#034;~/Desktop/OceanVelocities/velU&amp;#034; &amp;lt;&amp;gt; ToString[k] &amp;lt;&amp;gt; &amp;#034;.csv&amp;#034;]; &#xD;
       velV1 = Import[&#xD;
         &amp;#034;~/Desktop/OceanVelocities/velV&amp;#034; &amp;lt;&amp;gt; ToString[k] &amp;lt;&amp;gt; &amp;#034;.csv&amp;#034;];&#xD;
       veltot = &#xD;
        Table[{velU1[[i, j]], velV1[[i, j]]}, {i, 1, 720}, {j, 1, 1440}]; &#xD;
       Export[&amp;#034;~/Desktop/MovieOut/frame&amp;#034; &amp;lt;&amp;gt; ToString[1000 + k] &amp;lt;&amp;gt; &amp;#034;.gif&amp;#034;, &#xD;
        ArrayPlot[Reverse[Table[If[((StringQ[#[[1]]] || StringQ[#[[2]]]) &amp;amp; /@ {veltot[[i,j]] })[[1]], 0., Norm[{velU1[[i, j]], velV1[[i, j]]}]], {i, 1, 720}, {j, 1, 1440}]], PlotLegends -&amp;gt; None, ImageSize -&amp;gt; {1440, 730}, ColorFunction -&amp;gt; &amp;#034;TemperatureMap&amp;#034;]]], k];&#xD;
&#xD;
Another advantage of saving the frames is that we can use them as background for various scenarios and thereby decrease our computation time substantially. Here is a short animation of the first couple of frames.&#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
Now we get the trajectories of radioactive particles that are released into the ocean at the approximate site of the Fukushima power plant. We make the assumption that the particles simply follow the flow. Also, we use the vectorfield starting on 2nd January 1992. The overall patterns of the ocean currents seem to be reasonably stable over the years so that for this conceptual study this assumption will have to suffice. It is of course easy to adapt to the actual date. &#xD;
&#xD;
We first need to introduce a formula to convert the data grid to the surface of the earth. &#xD;
&#xD;
    ClearAll[&amp;#034;Global`*&amp;#034;];&#xD;
    f[teta_, r_, vx_, vy_] := {vx/(r*Sin[2*Pi*teta/4./360.]*2*Pi/360/4)*24*3600, vy/(N[r*2*Pi/360/4])*24*3600};&#xD;
    teta = 1; r = 6360000;&#xD;
&#xD;
We now place 20000 particle into the see close to the location of Fukushima. We add a small random number to the position to model a &amp;#034;cloud&amp;#034; of particles.&#xD;
&#xD;
    teilreinpos = &#xD;
     Table[{3, 511 + RandomVariate[NormalDistribution[0., 1.]], 568 + RandomVariate[NormalDistribution[0., 1.]]}, {m, 1, 20000}]; &#xD;
&#xD;
This is the main part of the program. We use the velocity to update the position of the particles. We then use the back-ground frames generated above and overlay the particle positions.&#xD;
&#xD;
    trajectories = {teilreinpos};&#xD;
    Monitor[Do[&#xD;
       velVt = Table[&#xD;
         If[StringQ[#], &#xD;
              0.1*(ToExpression[#[[&#xD;
                     3]]]*10^(ToExpression[#[[1]]]) ) &amp;amp; /@ { &#xD;
                StringSplit[#, {&amp;#034; &amp;#034;, &amp;#034;*&amp;#034;}]}, 1.*#] &amp;amp; /@ # &amp;amp; /@ &#xD;
          Import[&amp;#034;~/Desktop/OceanVelocities/velV&amp;#034; &amp;lt;&amp;gt; ToString[k] &amp;lt;&amp;gt; &#xD;
            &amp;#034;.csv&amp;#034;, &amp;#034;CSV&amp;#034;], {k, i - 2, i + 2}];&#xD;
       velUt = &#xD;
        Table[If[StringQ[#], &#xD;
              0.1*(ToExpression[#[[&#xD;
                     3]]]*10^(ToExpression[#[[1]]]) ) &amp;amp; /@ { &#xD;
                StringSplit[#, {&amp;#034; &amp;#034;, &amp;#034;*&amp;#034;}]}, 1.*#] &amp;amp; /@ # &amp;amp; /@ &#xD;
          Import[&amp;#034;~/Desktop/OceanVelocities/velU&amp;#034; &amp;lt;&amp;gt; ToString[k] &amp;lt;&amp;gt; &#xD;
            &amp;#034;.csv&amp;#034;, &amp;#034;CSV&amp;#034;], {k, i - 2, i + 2}];&#xD;
       xfunc = ListInterpolation[velUt, {{1, 5}, {0, 720}, {0, 1440}}];&#xD;
       yfunc = ListInterpolation[velVt, {{1, 5}, {0, 720}, {0, 1440}}];&#xD;
       AppendTo[trajectories, &#xD;
        Nest[({#[[1]], Mod[#[[2]], 720], &#xD;
               Mod[#[[3]], 1440]}) &amp;amp; /@ (# + {0.1, &#xD;
                0.1*f[#[[2]], r, xfunc[#[[1]] - i + 3., #[[2]], #[[3]]], &#xD;
                   yfunc[#[[1]] - i + 3., #[[2]], #[[3]]]][[2]] , &#xD;
                0.1*f[#[[2]], r, xfunc[#[[1]] - i + 3., #[[2]], #[[3]]], &#xD;
                   yfunc[#[[1]] - i + 3., #[[2]], #[[3]]]][[1]] } &amp;amp;) , # ,&#xD;
            10] &amp;amp; /@ trajectories[[-1]]]; &#xD;
       Export[&amp;#034;~/Desktop/OilSpillFrames/frame&amp;#034; &amp;lt;&amp;gt; ToString[1000 + i] &amp;lt;&amp;gt; &#xD;
         &amp;#034;.gif&amp;#034;, Show[&#xD;
         Import[&amp;#034;~/Desktop/MovieOut/frame&amp;#034; &amp;lt;&amp;gt; ToString[1000 + i] &amp;lt;&amp;gt; &#xD;
           &amp;#034;.gif&amp;#034;], &#xD;
         Graphics[{Red, Disk[#, 1]} &amp;amp; /@ (0.9361111 # + {44., 28.} &amp;amp; /@ &#xD;
             trajectories[[i - 2, All, {3, 2}]]), &#xD;
          PlotRange -&amp;gt; {{0, 1440}, {0, 720}}]]];&#xD;
       , {i, 3, 1238}], i];&#xD;
&#xD;
Here are a couple of frames:&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
All frames yield the following animation. &#xD;
&#xD;
![enter image description here][6]&#xD;
&#xD;
Also see the higher quality animation on Youtube. [https://youtu.be/8icgMg6lt0Y][7]&#xD;
&#xD;
Similarly we can study where rubbish, such as plastic bags would accumulate in the oceans due to the currents; these are also called [gyres of marine debris particles][8]. See also [this link][9].&#xD;
&#xD;
We start out just like for the Fukushima simulation:&#xD;
&#xD;
    ClearAll[&amp;#034;Global`*&amp;#034;];&#xD;
    f[teta_, r_, vx_, vy_] := {vx/(r*Sin[2*Pi*teta/4./360.]*2*Pi/360/4)*24*3600, vy/(N[r*2*Pi/360/4])*24*3600};&#xD;
    teta = 1; r = 6360000;&#xD;
&#xD;
In this case we have to distribute the particles randomly in all oceans. So I will basically distribute them everywhere and then ingore the ones over land mass, by checking whether the background flow speed is zero. So we first calculate the speed.&#xD;
&#xD;
    velVt = Table[&#xD;
       If[StringQ[#], &#xD;
            0.1*(ToExpression[#[[3]]]*10^(ToExpression[#[[1]]]) ) &amp;amp; /@ { &#xD;
              StringSplit[#, {&amp;#034; &amp;#034;, &amp;#034;*&amp;#034;}]}, 1.*#] &amp;amp; /@ # &amp;amp; /@ &#xD;
        Import[&amp;#034;~/Desktop/OceanVelocities/velV&amp;#034; &amp;lt;&amp;gt; ToString[k] &amp;lt;&amp;gt; &amp;#034;.csv&amp;#034;, &#xD;
         &amp;#034;CSV&amp;#034;], {k, 3 - 2, 3 + 2}];&#xD;
    velUt = Table[&#xD;
       If[StringQ[#], &#xD;
            0.1*(ToExpression[#[[3]]]*10^(ToExpression[#[[1]]]) ) &amp;amp; /@ { &#xD;
              StringSplit[#, {&amp;#034; &amp;#034;, &amp;#034;*&amp;#034;}]}, 1.*#] &amp;amp; /@ # &amp;amp; /@ &#xD;
        Import[&amp;#034;~/Desktop/OceanVelocities/velU&amp;#034; &amp;lt;&amp;gt; ToString[k] &amp;lt;&amp;gt; &amp;#034;.csv&amp;#034;, &#xD;
         &amp;#034;CSV&amp;#034;], {k, 3 - 2, 3 + 2}];&#xD;
    &#xD;
    xfunc = ListInterpolation[velUt, {{1, 5}, {0, 720}, {0, 1440}}];&#xD;
    yfunc = ListInterpolation[velVt, {{1, 5}, {0, 720}, {0, 1440}}];&#xD;
&#xD;
We then distribute the particles everywhere&#xD;
&#xD;
    teilreinpospre = Table[{3, RandomReal[{0, 720}], RandomReal[{0, 1440}]}, {k, 1, 30000}];&#xD;
&#xD;
and delete the particles with zero-speed-background.&#xD;
&#xD;
    teilreinpos = Select[teilreinpospre, xfunc[3, #[[2]], #[[3]]] != 0. &amp;amp;&amp;amp; yfunc[3, #[[2]], #[[3]]] != 0. &amp;amp;];&#xD;
&#xD;
Now we iterate as before. &#xD;
&#xD;
    trajectories = {teilreinpos};&#xD;
    Monitor[Do[&#xD;
       velVt = Table[&#xD;
         If[StringQ[#], &#xD;
              0.1*(ToExpression[#[[&#xD;
                     3]]]*10^(ToExpression[#[[1]]]) ) &amp;amp; /@ { &#xD;
                StringSplit[#, {&amp;#034; &amp;#034;, &amp;#034;*&amp;#034;}]}, 1.*#] &amp;amp; /@ # &amp;amp; /@ &#xD;
          Import[&amp;#034;~/Desktop/OceanVelocities/velV&amp;#034; &amp;lt;&amp;gt; ToString[k] &amp;lt;&amp;gt; &#xD;
            &amp;#034;.csv&amp;#034;, &amp;#034;CSV&amp;#034;], {k, i - 2, i + 2}];&#xD;
       velUt = &#xD;
        Table[If[StringQ[#], &#xD;
              0.1*(ToExpression[#[[&#xD;
                     3]]]*10^(ToExpression[#[[1]]]) ) &amp;amp; /@ { &#xD;
                StringSplit[#, {&amp;#034; &amp;#034;, &amp;#034;*&amp;#034;}]}, 1.*#] &amp;amp; /@ # &amp;amp; /@ &#xD;
          Import[&amp;#034;~/Desktop/OceanVelocities/velU&amp;#034; &amp;lt;&amp;gt; ToString[k] &amp;lt;&amp;gt; &#xD;
            &amp;#034;.csv&amp;#034;, &amp;#034;CSV&amp;#034;], {k, i - 2, i + 2}];&#xD;
       xfunc = ListInterpolation[velUt, {{1, 5}, {0, 720}, {0, 1440}}];&#xD;
       yfunc = ListInterpolation[velVt, {{1, 5}, {0, 720}, {0, 1440}}];&#xD;
       AppendTo[trajectories, &#xD;
        Nest[({#[[1]], Mod[#[[2]], 720], &#xD;
               Mod[#[[3]], 1440]}) &amp;amp; /@ (# + {0.1, &#xD;
                RandomVariate[NormalDistribution[0., 0.05]] + &#xD;
                 0.1*f[#[[2]], r, xfunc[#[[1]] - i + 3., #[[2]], #[[3]]], &#xD;
                    yfunc[#[[1]] - i + 3., #[[2]], #[[3]]]][[2]] , &#xD;
                RandomVariate[NormalDistribution[0., 0.05]] + &#xD;
                 &#xD;
                 0.1*f[#[[2]], r, xfunc[#[[1]] - i + 3., #[[2]], #[[3]]], &#xD;
                    yfunc[#[[1]] - i + 3., #[[2]], #[[3]]]][[&#xD;
                   1]] } &amp;amp;) , # , 10] &amp;amp; /@ trajectories[[-1]]]; &#xD;
       Export[&amp;#034;~/Desktop/Rubbish/frame&amp;#034; &amp;lt;&amp;gt; ToString[1000 + i] &amp;lt;&amp;gt; &amp;#034;.gif&amp;#034;, &#xD;
        Show[Import[&#xD;
          &amp;#034;~/Desktop/MovieOut/frame&amp;#034; &amp;lt;&amp;gt; ToString[1000 + i] &amp;lt;&amp;gt; &amp;#034;.gif&amp;#034;], &#xD;
         Graphics[{Red, Disk[#, 1]} &amp;amp; /@ (0.9361111 # + {44., 28.} &amp;amp; /@ &#xD;
             trajectories[[i - 2, All, {3, 2}]]), &#xD;
          PlotRange -&amp;gt; {{0, 1440}, {0, 720}}]]];&#xD;
       , {i, 3, 1238}], i];&#xD;
&#xD;
Here are some frames:&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
This leads to the following animation (due to file size I only show a later part of the simulation).&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
Please have a look at the [higher resolution and longer animation on Youtube][11]. &#xD;
&#xD;
It becomes clear that there are 5 large areas of rubbish in the oceans. This and their approximate positions are in accordance with their known positions and satellite data. &#xD;
&#xD;
This type of simulation is very much simplified. We are making many assumptions, but by using the &amp;#034;observed&amp;#034; velocity field, we get around the fluid mechanical problems usually involved in these problems. The main idea can be used for many other problems as well. For example, we could iterate backwards to see where particles came from. &#xD;
&#xD;
So I challenge you to simulate the following. Several fragments of the crashed Malaysian airplane have been found. Can you use the flow, invert the time direction and simulate where the parts must have come from? I wonder whether you can make better assmumptions than me (the larger fragments drift differently in the currents), and whether your point of origin correponds to mine.&#xD;
&#xD;
I would love to hear back from you, and get ideas of how to apply this. I had a previous discussion with Vitaliy Kaurov about this, and there are certainly much nicer ways of representing the results. Any ideas are welcome.&#xD;
&#xD;
Cheers,  &#xD;
Marco&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Rubbish-final-optimize.gif&amp;amp;userId=20103&#xD;
  [2]: http://community.wolfram.com/web/bschelter&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2015-10-24at01.21.46.png&amp;amp;userId=48754&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=VelocityField.gif&amp;amp;userId=48754&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2015-10-24at01.28.35.png&amp;amp;userId=48754&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Fukushima-ok.gif&amp;amp;userId=48754&#xD;
  [7]: https://youtu.be/8icgMg6lt0Y&#xD;
  [8]: https://en.wikipedia.org/wiki/Great_Pacific_garbage_patch&#xD;
  [9]: https://en.wikipedia.org/wiki/File:Garbage_Patch_Visualization_Experiment.webm&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2015-10-24at01.36.47.png&amp;amp;userId=48754&#xD;
  [11]: https://youtu.be/ttJPAIBch8U</description>
    <dc:creator>Marco Thiel</dc:creator>
    <dc:date>2015-10-24T00:43:19Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/437875">
    <title>Cellular Automaton done by an artist</title>
    <link>https://community.wolfram.com/groups/-/m/t/437875</link>
    <description>Three Years ago I came about Stephen Wolfram&amp;#039;s book A New Kind of Science. It has taken me on a phantastic journey from which I returned with a vision to paint a cellular automaton, big in size and big in scope. I decided to generate and paint a one-dimensional, two nearest neighbours cellular automaton with 14 colors. The problem was, I have just rudimentary knowledge of programming and I knew that this task was beyond me. Taking a course in adult education and two educational books on this matter were to no avail. Then I bought Mathematica. Some Money for a risk. What, if I couldnt handle it? Well I could, because of the excellent, interactive Help-section and that I could go to work just by using functions and brackets, no need to dive deeper into the realm of Mathematica. Also great the fast computation and visualization. What I had to do all by myself was to find in a set of 14(power14(power3)) the one rule which was worth to be painted. It took months of searching in colored deserts, no interesting structures to be found. Well, I think I finally found a good one, and I think it belongs to class three! (Right click on the image and select &amp;#034;View in new tab&amp;#034; to zoom.)&#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
&#xD;
The direction of evolution of the automaton is horizontally from the left to the right for aesthetical reasons. I have been a printer and I paint with printing ink on aluminium printing plates. The painting is composed of 12 Plates,  overall size 2.1 x 4 m, The image is composed of photos of the 12 plates, which are not easy to take pictures from because of their glossy surface.&#xD;
&#xD;
&#xD;
----------&#xD;
&#xD;
## Editor&amp;#039;s Edit ##&#xD;
&#xD;
Below is the painting and the painter kindly shared by the author upon requests below in the comments:&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
&#xD;
  [1]: /c/portal/getImageAttachment?filename=Nr179CellularAutomaton2014.jpg&amp;amp;userId=11733&#xD;
  [2]: /c/portal/getImageAttachment?filename=WolframCasdweq53.jpg&amp;amp;userId=11733</description>
    <dc:creator>Reinhard Danelzik</dc:creator>
    <dc:date>2015-02-08T13:06:14Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/114911">
    <title>Unlawful primes</title>
    <link>https://community.wolfram.com/groups/-/m/t/114911</link>
    <description>How small can a description of a large prime number be? There are the Fermat primes 2^n-1 for certain n, and in base 2 these are a sequence of ones.  In base 10, if you have just zeros and two ones, then the only primes of that form are 11 and 101.  If there are three ones then it is divisible by three.  But what about four ones?  It seems wrong to me that there might be an unbounded number of such primes.&#xD;
&#xD;
That&amp;#039;s what some brief experiments suggest though.&#xD;
[mcode]1+10^4+10^18+10^201 == 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000010001[/mcode]is the largest one I found.  Also I don&amp;#039;t notice any patterns, e.g. here in the first 200 such primes&#xD;
&#xD;
[img=width: 68px; height: 432px;]/c/portal/getImageAttachment?filename=primes-1111.jpg&amp;amp;userId=23275[/img]&#xD;
&#xD;
and here are the first 254 primes with nonzero digits {1,2,1}&#xD;
&#xD;
[img=width: 347px; height: 432px;]/c/portal/getImageAttachment?filename=primes-121.jpg&amp;amp;userId=23275[/img]&#xD;
&#xD;
the largest found is&#xD;
[mcode]1+2*10^14+10^201 == 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000001[/mcode]Does anyone else have any primes which don&amp;#039;t seem like they should be prime?  The more extreme the better.</description>
    <dc:creator>Todd Rowland</dc:creator>
    <dc:date>2013-09-03T04:50:53Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/554194">
    <title>Curlicue Fractals</title>
    <link>https://community.wolfram.com/groups/-/m/t/554194</link>
    <description>The [CurlicueFractal][1] can be simplified with AnglePath. &#xD;
&#xD;
    Graphics[Line[AnglePath[N[ (7 Sqrt[7] Khinchin Pi E EulerGamma) Range[-20000, 20000]]]]]&#xD;
&#xD;
![curlicue fractal][2]&#xD;
&#xD;
Who else can find some nice ones?&#xD;
&#xD;
  [1]: http://demonstrations.wolfram.com/CurlicueFractal/&#xD;
  [2]: /c/portal/getImageAttachment?filename=drxZkto.gif&amp;amp;userId=21530</description>
    <dc:creator>Ed Pegg</dc:creator>
    <dc:date>2015-08-26T19:10:26Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/227651">
    <title>Convergence of synonym networks</title>
    <link>https://community.wolfram.com/groups/-/m/t/227651</link>
    <description>Take a word and find its synonyms. Then find the synonyms of the synonyms from the previous step. And so on. [b]For how long will the number of synonyms continue to grow?[/b]

Language structures can take peculiar shapes. Code can be quite simple to compute and automate informative visualizations. Below vertex size is larger if the vertex has more connections, meaning a word has a greater number of synonyms. Note GraphLayout -&amp;gt; {&amp;#034;BalloonEmbedding&amp;#034;, &amp;#034;RootVertex&amp;#034; -&amp;gt; word} option to Graph is used to produce this specific layout. The code below is based on [url=http://wolfram.com/xid/0j49p2ci-ckbtad]an example from Documentation[/url].

Lets define a function:[mcode]SynonymNetwork[word_String, depth_Integer, labels_: Tooltip] :=
 
 Module[{ed, sz, g},
  
  (* list of edges *)
   ed = Union[Sort /@ Flatten[Rest[NestList[Union[Flatten[
           Thread[# &amp;lt;-&amp;gt; WordData[#, &amp;#034;Synonyms&amp;#034;, &amp;#034;List&amp;#034;]] &amp;amp; /@ #[[All, 2]]]] &amp;amp;, {&amp;#034;&amp;#034; &amp;lt;-&amp;gt; word}, depth]]]];
  
  (* size of vertices based on number of synonyms *)
   sz = Thread[VertexList[Graph[ed]] -&amp;gt; Map[{&amp;#034;Scaled&amp;#034;, #} &amp;amp;, 
           .05 (.01 + .99 N[Rescale[VertexDegree[g = Graph[ed]]]])^.5]];
  
  (* graph *)  
  SetProperty[g, 
   {GraphLayout -&amp;gt; {&amp;#034;BalloonEmbedding&amp;#034;, &amp;#034;RootVertex&amp;#034; -&amp;gt; word}, 
    EdgeStyle -&amp;gt; Directive[Opacity[.2], Red], 
    VertexStyle -&amp;gt; Directive[Opacity[.1], Black], 
    VertexStyle -&amp;gt; {word -&amp;gt; Directive[Opacity[1], Red]}, 
    VertexSize -&amp;gt; sz, VertexLabels -&amp;gt; Placed[&amp;#034;Name&amp;#034;, labels]}]
  
  ][/mcode]
Here how it works:[mcode]SynonymNetwork[&amp;#034;promise&amp;#034;, 3][/mcode]
[img=width: 479px; height: 727px;]/c/portal/getImageAttachment?filename=qw23rf5tef5gtbj7uyjthd.gif&amp;amp;userId=11733[/img]


Now as I asked earlier: will the number of synonyms continue to grow? This of course depends on a particular thesaurus dictionary at hand. But once we settled on one, what can we find? Obviously some very specific words have no synonyms at all:
[mcode]In[1]:= WordData[&amp;#034;transmogrification&amp;#034;, &amp;#034;Definitions&amp;#034;]
Out[1]= {{&amp;#034;transmogrification&amp;#034;, &amp;#034;Noun&amp;#034;} -&amp;gt; 
          &amp;#034;the act of changing into a different form or appearance (especially a fantastic or grotesque one)&amp;#034;}


In[2]:= WordData[&amp;#034;transmogrification&amp;#034;, &amp;#034;Synonyms&amp;#034;]
Out[2]= {{&amp;#034;transmogrification&amp;#034;, &amp;#034;Noun&amp;#034;} -&amp;gt; {}}[/mcode]
Some words will have very trivial small finite networks (note network depth is set 20, while even 100 or greater will not change it):[mcode]SynonymNetwork[&amp;#034;chemistry&amp;#034;, 20, Above][/mcode]
[img=width: 327px; height: 356px;]/c/portal/getImageAttachment?filename=sdf34erfdd43ergf.png&amp;amp;userId=11733[/img]

And of course many words will have networks that grow very fast. This applies not only for very general words such as fast or beautiful, but also for strange rare words such as &amp;#034;discombobulate&amp;#034;:[mcode]ParallelMap[Length[EdgeList[SynonymNetwork[&amp;#034;discombobulate&amp;#034;, #]]] &amp;amp;, Range[16]]
Out[]= {9, 97, 1097, 7644, 26051, 46671, 59440, 65187, 67805, 68798, 69274, 69456, 69565, 69587, 69592, 69592}

data = ParallelMap[Length[VertexList[SynonymNetwork[&amp;#034;discombobulate&amp;#034;, #]]] &amp;amp;, Range[16]
{10, 73, 787, 4293, 11646, 18858, 22931, 24911, 25743, 26096, 26238, 26302, 26321, 26330, 26330, 26330}

ListPlot[data, Filling -&amp;gt; Bottom, Joined -&amp;gt; True, Mesh -&amp;gt; All, AxesLabel -&amp;gt; {&amp;#034;Network depth&amp;#034;, &amp;#034;Synonyms&amp;#034;}][/mcode]
[img=width: 450px; height: 244px;]/c/portal/getImageAttachment?filename=ScreenShot2014-03-31at1.44.27AM.png&amp;amp;userId=11733[/img]


So we see [b]&amp;#034;discombobulate&amp;#034; synonym network gets saturated at depth 15 and attains 26330 vertices and 69592 edges[/b]. Quite magnificent result I think ;-) This is, btw, very inefficient way of computing the convergence  we repeat same computations many times while building the graph. Ideally we should introduce counting synonyms part into our SynonymNetwork function. This is how discombobulate network looks &amp;#034;big&amp;#034; already at depth 3:
[mcode]SynonymNetwork[&amp;#034;discombobulate&amp;#034;, 3]
[/mcode][img]/c/portal/getImageAttachment?filename=df45t6576rteyrsgdfaaasdf.png&amp;amp;userId=11733[/img]

How big do such networks get? Can we make some estimates? Well, lets first define set of all words that to belong to discombobulate network:[mcode]gr = SynonymNetwork[&amp;#034;discombobulate&amp;#034;, 15];
ver = VertexList[gr];[/mcode]
Then lets find all unique words in Alice in Wonderland:[mcode]alice = Union[ToLowerCase[StringSplit[ExampleData[{&amp;#034;Text&amp;#034;, &amp;#034;AliceInWonderland&amp;#034;}], RegularExpression[&amp;#034;[\\W_]+&amp;#034;]]]];
alice // Length

Out[]= 1484[/mcode]
Then select, say, only nouns that have synonyms [mcode]nouns = Select[alice, MemberQ[WordData[#, &amp;#034;PartsOfSpeech&amp;#034;], &amp;#034;Noun&amp;#034;] &amp;amp;&amp;amp; WordData[#, &amp;#034;Synonyms&amp;#034;, &amp;#034;List&amp;#034;] =!= {} &amp;amp;];
nouns // Length

Out[]= 809[/mcode]
We see that more than half of these nouns belong to the discombobulate network:
[mcode]MemberQ[ver, #] &amp;amp; /@ nouns // Tally
Out[]= {{False, 223}, {True, 586}}[/mcode]
I also would like to share some beautiful smaller CONVERGED (saturated) networks, which I found, - beautiful in structure and sets of words they gather (see below). They of course do not belong to huge &amp;#034;discombobulate&amp;#034; graph above. And as already mentioned I propose the following - comment if:
[list]
[*]you find some beautiful networks 
[*]you can figure out how we can make estimates on large networks or do any further digging 
[*]you can optimize code
[*]you have any ideas / comments at all ;-)
[/list]
[b]===&amp;gt; &amp;#034;dragonfly&amp;#034; - 23 synonyms, depth 3[/b]

[mcode]ParallelMap[Length[VertexList[SynonymNetwork[&amp;#034;dragonfly&amp;#034;, #]]] &amp;amp;, Range[7]]
Out[]= {8, 14, 23, 23}

SynonymNetwork[&amp;#034;dragonfly&amp;#034;, 20, Above][/mcode]
[img]/c/portal/getImageAttachment?filename=sdf43sfs7s683sdfs8239sf.png&amp;amp;userId=11733[/img]

[b]===&amp;gt; &amp;#034;benevolent&amp;#034; - 27 synonyms, depth 7[/b]

[mcode]ParallelMap[Length[VertexList[SynonymNetwork[&amp;#034;benevolent&amp;#034;, #]]] &amp;amp;, Range[9]]
Out[]= {11, 15, 19, 23, 25, 26, 27, 27}

SynonymNetwork[&amp;#034;benevolent&amp;#034;, 20, Below][/mcode]
[img]/c/portal/getImageAttachment?filename=GMLO35FVFVFDffdfdzg.png&amp;amp;userId=11733[/img]</description>
    <dc:creator>Vitaliy Kaurov</dc:creator>
    <dc:date>2014-03-30T05:26:37Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3502932">
    <title>[WSRP25] Modeling 3D Fire Spread Using Cellular Automata and Optimizing Fire Suppressant Placement</title>
    <link>https://community.wolfram.com/groups/-/m/t/3502932</link>
    <description>![Modeling 3D Wildfire Spread Using Cellular Automata and Optimizing Fire Suppressant Placement][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=kellyAnim8-reduce.gif&amp;amp;userId=3502529&#xD;
  [2]: https://www.wolframcloud.com/obj/53b633f3-7f63-4371-aa22-02cab3732f8b</description>
    <dc:creator>Kelly Liu</dc:creator>
    <dc:date>2025-07-10T21:47:49Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/852277">
    <title>[GiF] Computational history: countries that are gone</title>
    <link>https://community.wolfram.com/groups/-/m/t/852277</link>
    <description>X - country birth | Y - country death | RADIUS - lifetime&#xD;
-----------------------------------------------&#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
Mongol Empire&#xD;
-------------&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
The [Mongol Empire][3] existed during the 13th and 14th centuries and was the **largest contiguous land empire in history**. Originating in the steppes of Central Asia, the Mongol Empire eventually stretched from Eastern Europe to the Sea of Japan, extending northwards into Siberia, eastwards and southwards into the Indian subcontinent, Indochina, and the Iranian plateau, and westwards as far as the Levant and Arabia. As you probably guessed the information is from here:&#xD;
&#xD;
    WikipediaData[&amp;#034;Mongol Empire&amp;#034;]&#xD;
&#xD;
And the image you see above is built with information stored in &#xD;
&#xD;
    EntityProperties[&amp;#034;HistoricalCountry&amp;#034;]&#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
Let&amp;#039;s see what we can do with these data. First of I will get the data, - and you can see we have 1990 countries listed:&#xD;
&#xD;
    hc = EntityList[&amp;#034;HistoricalCountry&amp;#034;];&#xD;
    hc // Length&#xD;
    (*1990*)&#xD;
&#xD;
First of all I am curious about chronology of these social structures. The data go back in time so far that sometimes we simply do not have some information. Hence I will apply some filters to drop the missing information:&#xD;
&#xD;
    startend = DeleteMissing[EntityValue[hc, {&amp;#034;Entity&amp;#034;, &#xD;
        EntityProperty[&amp;#034;HistoricalCountry&amp;#034;, &amp;#034;StartDate&amp;#034;], &#xD;
        EntityProperty[&amp;#034;HistoricalCountry&amp;#034;, &amp;#034;EndDate&amp;#034;]}], 1, 2];&#xD;
    startend = DeleteCases[startend, {_, _, _Alternatives}];&#xD;
&#xD;
Now I sort by duration of country existence and look at a few countries with longest-existence:&#xD;
&#xD;
    sorthc = SortBy[{#1, #3 - #2} &amp;amp; @@@ startend, Last];&#xD;
&#xD;
    Row[TableForm[{#1, #2, N[UnitConvert[#2, &amp;#034;Year&amp;#034;]]} &amp;amp; @@@ &#xD;
    Reverse[#]] &amp;amp; /@{sorthc[[-10 ;;]], sorthc[[-20 ;; -11]]}, Spacer[50]]&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
So the longest existing historical country according to our data is [Ordos Culture][6] counting about 28,000 years. &#xD;
&#xD;
    StringTake[WikipediaData[&amp;#034;Ordos culture&amp;#034;], 505]&#xD;
&#xD;
&amp;gt; The Ordos culture was a culture occupying a region centered on the Ordos Loop (modern Inner Mongolia, China) during the Bronze and early Iron Age from the 6th to 2nd centuries BCE. The Ordos culture is known for significant finds of Scythian art and is thought to represent the easternmost extension of Indo-European Eurasian nomads, such as the Scythians. Under the Qin and Han dynasties, from the 6th to 2nd centuries BCE, the area came under at least nominal control of contemporaneous Chinese states.&#xD;
&#xD;
Now I am curios of how the countries&amp;#039; lifetime was distributed throughout the whole history. Wolfram Language has a neat visualization tool - [TimelinePlot][7] - for that. We have so many countries that I will take a random sample of them to not overload the visual.&#xD;
&#xD;
    SeedRandom[3];&#xD;
    tmp=RandomSample[startend,20];&#xD;
    TimelinePlot[Association@@Thread[EntityValue[tmp[[All,1]],&amp;#034;Name&amp;#034;]-&amp;gt;&#xD;
    (Interval/@tmp[[All,2;;3]])],Filling-&amp;gt;Below,&#xD;
    FillingStyle-&amp;gt;Directive[Opacity[.2],Orange],PerformanceGoal-&amp;gt;&amp;#034;Speed&amp;#034;]&#xD;
&#xD;
![enter image description here][8]&#xD;
&#xD;
And now with a larger sample of 1000 countries but without labels: &#xD;
&#xD;
    SeedRandom[5];&#xD;
    tmp=RandomSample[startend[[All,2;;3]],1000];&#xD;
    TimelinePlot[Interval/@tmp,Filling-&amp;gt;Below,&#xD;
    PerformanceGoal-&amp;gt;&amp;#034;Speed&amp;#034;,AspectRatio-&amp;gt;1,PlotTheme-&amp;gt;&amp;#034;Marketing&amp;#034;]&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
We see that the deeper in the past, the longer is lifetime and the fewer countries we have. This tendency can be easily visualized by plotting:&#xD;
&#xD;
    BubbleChart[{#1,#2,#2-#1}&amp;amp;@@@Map[AbsoluteTime,startend[[;;500,2;;3]],{2}],&#xD;
    ChartStyle-&amp;gt;EdgeForm[Opacity[.05]],FrameTicks-&amp;gt;None,ColorFunction-&amp;gt;Function[{x,y,r},&#xD;
    RGBColor[r,1-r,1-r,r]],PerformanceGoal-&amp;gt;&amp;#034;Speed&amp;#034;,ImageSize-&amp;gt;1000]&#xD;
&#xD;
X - country birth | Y - country death | RADIUS - lifetime&#xD;
-----------------------------------------------&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
Obviously above-diagonal nature is due to the fact that enddate is always later than the start date. Amazingly there are many countries that exist just a few days. Let&amp;#039;s see the shortest living countries:&#xD;
&#xD;
    fewDAYs = Cases[sorthc[[All, 2]], x_ /; x &amp;gt; Quantity[0, &amp;#034;Days&amp;#034;]][[;; 10]]&#xD;
&#xD;
![enter image description here][11]&#xD;
&#xD;
    TableForm@Flatten[Cases[sorthc, {_, #}] &amp;amp; /@ fewDAYs, 1]&#xD;
&#xD;
![enter image description here][12]&#xD;
&#xD;
I sort countries by their lifetime in years and plot RANK vs LIFETIME in a log-log plot:&#xD;
&#xD;
    yearLIFETIME=QuantityMagnitude@N[UnitConvert[Cases[sorthc[[All,2]],x_/;x&amp;gt;Quantity[0, &amp;#034;Days&amp;#034;]],&amp;#034;Year&amp;#034;]];&#xD;
    ListLogLogPlot[yearLIFETIME,PlotRange-&amp;gt;All,PlotTheme-&amp;gt;&amp;#034;Business&amp;#034;,Filling-&amp;gt;Bottom,&#xD;
    FrameLabel-&amp;gt;{&amp;#034;RANK&amp;#034;,&amp;#034;LIFETIME&amp;#034;},PlotLabel-&amp;gt;&amp;#034;Log-Log plot in YEARs&amp;#034;,BaseStyle-&amp;gt;15,ImageSize-&amp;gt;1000]&#xD;
&#xD;
![enter image description here][13]&#xD;
&#xD;
For small-lifetime countries we see almost a **straight line - the sign of a power law**. Now I would like to take a look at some **specific counties**. Especially those who **grew spatially very fast**, - of course, due to their **military conquest**. &#xD;
&#xD;
Mongol Empire&#xD;
-------------&#xD;
&#xD;
![enter image description here][14]&#xD;
&#xD;
Let&amp;#039;s get all polygons related to historical borders of Mongol Empire for every year between its existence 1206 -1368:&#xD;
&#xD;
    mongPOLY=ParallelTable[EntityValue[Entity[&amp;#034;HistoricalCountry&amp;#034;,&amp;#034;MongolEmpire&amp;#034;],&#xD;
    EntityProperty[&amp;#034;HistoricalCountry&amp;#034;,&amp;#034;Polygon&amp;#034;,{&amp;#034;Date&amp;#034;-&amp;gt;DateObject[{t}]}]],{t,1206,1368}];&#xD;
&#xD;
For many years we have many identical borders - let&amp;#039;s compress - find only unique borders:&#xD;
&#xD;
    mongPOLY//Length&#xD;
    mongPOLYcomp=DeleteMissing[DeleteDuplicates[&#xD;
        Transpose[{Range[1206,1368],mongPOLY}],Last[#1]==Last[#2]&amp;amp;],1,2];&#xD;
    mongPOLYcomp//Length&#xD;
&#xD;
13 compressed out of total 163 total borders! I plot them all:&#xD;
&#xD;
    GeoGraphics[{EdgeForm[Red], GeoStyling[Opacity[.07]], #} &amp;amp; /@ &#xD;
      mongPOLYcomp[[All, 2]], GeoProjection -&amp;gt; &amp;#034;Mercator&amp;#034;, &#xD;
     ImageSize -&amp;gt; 800, GeoBackground -&amp;gt; GeoStyling[&amp;#034;StreetMap&amp;#034;], &#xD;
     GeoRange -&amp;gt; {{20, 70}, {17, 133}}, GeoZoomLevel -&amp;gt; 4]&#xD;
&#xD;
![enter image description here][15]&#xD;
&#xD;
And for animation show at the top of the post:&#xD;
&#xD;
    frames=ParallelTable[&#xD;
    GeoGraphics[{EdgeForm[Red],GeoStyling[Opacity[.07]],mongPOLYcomp[[;;t,2]]},&#xD;
    GeoProjection-&amp;gt;&amp;#034;Mercator&amp;#034;,ImageSize-&amp;gt;800,GeoRange-&amp;gt;{{20,70},{17,133}},&#xD;
    GeoBackground-&amp;gt;GeoStyling[&amp;#034;StreetMap&amp;#034;],&#xD;
    Epilog-&amp;gt;Text[Framed[Style[mongPOLYcomp[[t,1]],20,Red,Bold],Background-&amp;gt;White],&#xD;
    Scaled[{.06,.955}]]],{t,1,13}];&#xD;
&#xD;
    Export[&amp;#034;MongolEmpire.gif&amp;#034;, frames, &amp;#034;DisplayDurations&amp;#034; -&amp;gt; {.5}]&#xD;
&#xD;
Nazi Germany&#xD;
------------&#xD;
&#xD;
![enter image description here][16]&#xD;
&#xD;
We need finer dates for Nazi Germany because it existed just a few years, let&amp;#039;s choose month:&#xD;
&#xD;
![enter image description here][17]&#xD;
&#xD;
Get all borders:&#xD;
&#xD;
    gerPOLY=ParallelTable[EntityValue[Entity[&amp;#034;HistoricalCountry&amp;#034;,&amp;#034;NaziGermany&amp;#034;],&#xD;
    EntityProperty[&amp;#034;HistoricalCountry&amp;#034;,&amp;#034;Polygon&amp;#034;,{&amp;#034;Date&amp;#034;-&amp;gt;DateObject[t]}]],{t,gerdates}];&#xD;
&#xD;
    gerPOLY//Length&#xD;
    gerPOLYcomp=DeleteMissing[DeleteDuplicates[Transpose[{gerdates,gerPOLY}],Last[#1]==Last[#2]&amp;amp;],1,2];&#xD;
    gerPOLYcomp//Length&#xD;
&#xD;
9 unique borders out 148 total! Lets plot them all:&#xD;
&#xD;
    GeoGraphics[{EdgeForm[Red], GeoStyling[Opacity[.07]], &#xD;
      gerPOLYcomp[[All, 2]]}, GeoProjection -&amp;gt; &amp;#034;Equirectangular&amp;#034;, &#xD;
     ImageSize -&amp;gt; 800, GeoBackground -&amp;gt; GeoStyling[&amp;#034;StreetMap&amp;#034;], &#xD;
     GeoZoomLevel -&amp;gt; 5]&#xD;
&#xD;
![enter image description here][18]&#xD;
&#xD;
Now, for the history buffs of WWII, I am curious what these borders exactly correspond to in this labeled map from Wikipedia, which differentiates between occupied and allied counties. &#xD;
&#xD;
![enter image description here][19]&#xD;
&#xD;
Kingdom of France&#xD;
-----------------&#xD;
&#xD;
Using the same technique we can get the evolution of borders for the Kingdom of France (without remote colonies):&#xD;
&#xD;
![enter image description here][20]&#xD;
&#xD;
![enter image description here][21]&#xD;
&#xD;
You could probably even 3D print this evolution, a start is here (see attached notebook for code):&#xD;
&#xD;
![enter image description here][22]&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=dsf354tegdft54twrshfgjuityutrew657.svg&amp;amp;userId=11733&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=MongolEmpire.gif&amp;amp;userId=11733&#xD;
  [3]: http://www.wolframalpha.com/input/?i=Mongol%20Empire&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=2016-05-06_03-59-40.png&amp;amp;userId=11733&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=2016-05-06_04-11-18.png&amp;amp;userId=11733&#xD;
  [6]: http://www.wolframalpha.com/input/?i=Ordos%20Culture&#xD;
  [7]: http://reference.wolfram.com/language/ref/TimelinePlot.html&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=sdfe456789oiuyjthdgsdfas.png&amp;amp;userId=11733&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=assaf3q45teragfd.png&amp;amp;userId=11733&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=dsf354tegdft54twrshfgjuityutrew657.svg&amp;amp;userId=11733&#xD;
  [11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=2016-05-06_05-38-30.png&amp;amp;userId=11733&#xD;
  [12]: http://community.wolfram.com//c/portal/getImageAttachment?filename=2016-05-06_05-39-30.png&amp;amp;userId=11733&#xD;
  [13]: http://community.wolfram.com//c/portal/getImageAttachment?filename=sdfqtwyrhgfbsdvs.png&amp;amp;userId=11733&#xD;
  [14]: http://community.wolfram.com//c/portal/getImageAttachment?filename=2016-05-06_05-51-52.png&amp;amp;userId=11733&#xD;
  [15]: http://community.wolfram.com//c/portal/getImageAttachment?filename=2016-05-06_03-42-48.png&amp;amp;userId=11733&#xD;
  [16]: http://community.wolfram.com//c/portal/getImageAttachment?filename=2016-05-06_05-59-31.png&amp;amp;userId=11733&#xD;
  [17]: http://community.wolfram.com//c/portal/getImageAttachment?filename=2016-05-06_06-01-10.png&amp;amp;userId=11733&#xD;
  [18]: http://community.wolfram.com//c/portal/getImageAttachment?filename=sdafae546ythdgfsdas.png&amp;amp;userId=11733&#xD;
  [19]: http://community.wolfram.com//c/portal/getImageAttachment?filename=2016-05-05_18-50-08.png&amp;amp;userId=11733&#xD;
  [20]: http://community.wolfram.com//c/portal/getImageAttachment?filename=2016-05-06_07-34-22.png&amp;amp;userId=11733&#xD;
  [21]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ezgif-896259266.gif&amp;amp;userId=11733&#xD;
  [22]: http://community.wolfram.com//c/portal/getImageAttachment?filename=sdf45yehtrgsf.gif&amp;amp;userId=11733</description>
    <dc:creator>Vitaliy Kaurov</dc:creator>
    <dc:date>2016-05-06T11:08:10Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/33771">
    <title>Visibility Graphs: Dualism of Time Series and Networks</title>
    <link>https://community.wolfram.com/groups/-/m/t/33771</link>
    <description>From a recent Complex System article [1] I found out about interesting mapping between Graphs and Time Series that currently gaining more and more attention. The main idea is being able to apply time series analysis methods to networks and vice versa. There is a hope of gaining new insights into familiar objects by approaching from different side. I thought it would be interesting to implement a toy example in Mathematica. I consider the simplest Horizontal Visibility Graph (HVG) algorithm which can be simply explained with the figure below.&#xD;
&#xD;
[img]http://i.imgur.com/uK2jT.png[/img]&#xD;
&#xD;
   1. Every event in time series correspond to a vertex in the graph&#xD;
   2. Two events are connected by edge in the graph if all events between them in time series a smaller then them in magnitude&#xD;
&#xD;
There are other more complex mapping algorithms (see references at the end), but well stick with this simple one. Lets consider three different types of time series to see what kind of networks they can produce:&#xD;
   1. Deterministic system: Cellular Automaton rule 54 with complex type 4 behavior&#xD;
   2. Stochastic system: Geometric Brownian Motion random process&#xD;
   3. Empirical system: Financial data of GE stock price&#xD;
[mcode]dataS = {FromDigits[#, 2] &amp;amp; /@ &#xD;
   CellularAutomaton[54, RandomInteger[1, 200], 49],&#xD;
   RandomFunction[GeometricBrownianMotionProcess[0, .1, 2], {1, 50, 1}][[2, 1, 1]],&#xD;
   FinancialData[&amp;#034;GE&amp;#034;, &amp;#034;Jan. 1, 2000&amp;#034;][[All, 2]][[1 ;; 50]]};&#xD;
&#xD;
ListPlot[#, Filling -&amp;gt; Bottom, AspectRatio -&amp;gt; 1/10, FillingStyle -&amp;gt; Thick, PlotStyle -&amp;gt; PointSize[.008], &#xD;
Axes -&amp;gt; {True, False}, GridLines -&amp;gt; {None, Automatic}, Ticks -&amp;gt; {Range[81], None}, ImageSize -&amp;gt; 800] &amp;amp; /@ dataS&#xD;
[/mcode]&#xD;
[img]http://i.imgur.com/aI72Q.png[/img]&#xD;
Define the mapping function&#xD;
[mcode]fied[m_, n_, data_] := If[(Min[#[[m]], #[[n]]] &amp;gt; Max[#[[m + 1 ;; n - 1]]]) &amp;amp;@data, m \[UndirectedEdge] n][/mcode]Compute the edges of the graph&#xD;
[mcode]edgesS = Cases[Flatten[Table[fied[m, n, #], {m, Length[#]}, {n, m + 1, Length[#]}]], _ \[UndirectedEdge] _] &amp;amp; /@ dataS;[/mcode]Build the graph and highlight vertexes based on vertex degree and the shortest path between initial and final events. &#xD;
[mcode]gS = Graph[#, GraphLayout -&amp;gt; &amp;#034;LayeredDigraphEmbedding&amp;#034;] &amp;amp; /@ edgesS;&#xD;
gSH = HighlightGraph[#, VertexList[#],&#xD;
VertexSize -&amp;gt; Thread[VertexList[#] -&amp;gt; Rescale[VertexDegree[#]]],&#xD;
ImageSize -&amp;gt; {Automatic, 500}, VertexLabels -&amp;gt; &amp;#034;Name&amp;#034;] &amp;amp; /@ gS;&#xD;
&#xD;
HighlightGraph[#, PathGraph[FindShortestPath[#, 1, 50]], GraphHighlightStyle -&amp;gt; &amp;#034;Thick&amp;#034;] &amp;amp; /@ gSH[/mcode][img]http://i.imgur.com/2bQU6.png[/img]&#xD;
I used LayeredDigraphEmbedding which kind of preserves chronological order of the series laying out networks nicely. I hope you enjoyed this little mapping and may apply a similar method for your own research. There are inverse mappings too - see the reference. Please feel free to share your ideas on the subject or possible algorithm optimization. &#xD;
&#xD;
   [1] [b][url=http://www.complex-systems.com/abstracts/v21_i03_a03.html]Discriminating Chaotic Visibility Graph Eigenvalues, Vincenzo Fioriti et al, Complex Systems, Vol 21, No 3, p193[/url][/b]&#xD;
   [2] [b][url=http://www.pnas.org/content/105/13/4972.full]From time series to complex networks: The visibility graph[/url][/b]&#xD;
   [3] [b][url=http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3154932/pdf/pone.0023378.pdf]Duality between Time Series and Networks[/url][/b]&#xD;
   [4] [b][url=http://arxiv.org/find/all/1/AND+abs:+AND+visibility+graph+abs:+AND+time+series/0/1/0/all/0/1?skip=0&amp;amp;query_id=701ef182d80b670f]Some related arXiv.org papers[/url][/b]</description>
    <dc:creator>Vitaliy Kaurov</dc:creator>
    <dc:date>2013-01-17T03:13:27Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/835603">
    <title>What are your memories of all things Wolfram ?</title>
    <link>https://community.wolfram.com/groups/-/m/t/835603</link>
    <description>&amp;gt; When I was 15 years old General Motors dropped a big V8 into the Chevy. That was one of the happiest days of my life. I couldn&amp;#039;t wait to drive one of those Chevies. And I had exactly the same feeling when somebody dropped Mathematica into a Macintosh.&#xD;
&#xD;
This is one of my favorite quotes about Mathematica. It is by Jerry Uhl, a math professor from the University of Illinois at UrbanaChampaign, said in 1989, as you can witness in the video below. &#xD;
&#xD;
For those of you who enjoys history, here is a wonderful piece, a glance into the Wolfram past. There is a YouTube channel, The ReDiscovered Future, which acts as the public &amp;#034;silver screen&amp;#034; of an initiative that aims to rescue video and audio recordings from older, volatile formats, store them on more reliable media, and share them with the world. They&amp;#039;ve just published a delightful video:&#xD;
&#xD;
[Macintosh + Mathematica = Infinity - April 1989][1]&#xD;
&#xD;
[![enter image description here][2]][3]&#xD;
&#xD;
I like how there are so many things that said then but still hold true. Of course this goes for the Alfred North Whitehead quote they started from: &#xD;
&#xD;
&amp;gt; Civilization advances by extending the number of important operations which we can perform without thinking about them. &#xD;
&#xD;
And the quote from student Donald Brown: &amp;#034;&#xD;
&#xD;
&amp;gt; With the use of Mathematica you are allowed in some sense to wander into zones of thoughts where you might not be inclined to go otherwise.&#xD;
&#xD;
Note already then the ideas of automation, [Computer Based Math][4], data accessibility, and diversity of computation in sciences. In the video Donald A. Glaser, who got the Nobel Prize in Physics 1960 for the invention of the bubble chamber speaks very nicely of importance of automation for cultivating intuition:&#xD;
&#xD;
&amp;gt; I think science will always have the same amount of perspiration and inspiration as before but we will eliminate calculus and differential equations and graphics from the perspiration category and that&amp;#039;ll give us more time for having more sophisticated inspirations.&#xD;
&#xD;
Mathematica hadn&amp;#039;t touch me then yet. I experience it fully later coming to USA. But then in 1989 we of course did do some computing in Soviet Union. That was two years before the Soviet regime would end after 69 years of reign. We used computers like the one shown on the photo below. The [Iskra-1030][5] was a Soviet version of IBM&amp;#039;s PC/XT, a personal computer based on the processor analogical to the Intel 8086. The model had 256 KB RAM expandable to 1MB, also featured hard drives - up to 10 MB. &#xD;
&#xD;
So I did not use Mathematica, but I did run some programs simulating Cellular Automata that I was reading about in [Stephen Wolfram papers][6] already published then. They were fascinating systems to me, because of the mysterious link between simplicity of rules and complexity of behavior. So the most fundamental [NKS][7] computations of simple programs reached me earlier. What a pleasant surprise was to discover [CellularAutomaton][8] function in Wolfram Language later that replaced pages of my old Soviet code.&#xD;
&#xD;
What do you think? Any recollections or quotes? How did Wolfram ideas enter your life?&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
&#xD;
  [1]: https://www.youtube.com/watch?v=3A5moyhfaQo&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=sdfq34tgdsagrqevassarv.png&amp;amp;userId=11733&#xD;
  [3]: https://www.youtube.com/watch?v=3A5moyhfaQo&#xD;
  [4]: https://www.computerbasedmath.org/&#xD;
  [5]: https://en.wikipedia.org/wiki/Iskra-1030&#xD;
  [6]: http://www.stephenwolfram.com/publications/academic/?cat=cellular-automata&#xD;
  [7]: https://www.wolframscience.com/&#xD;
  [8]: http://reference.wolfram.com/language/ref/CellularAutomaton.html&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=%D0%98%D0%A1%D0%9A%D0%A0%D0%90_1030.11.jpg&amp;amp;userId=11733</description>
    <dc:creator>Vitaliy Kaurov</dc:creator>
    <dc:date>2016-04-06T18:41:57Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1890120">
    <title>Diagonal Cellular Automata</title>
    <link>https://community.wolfram.com/groups/-/m/t/1890120</link>
    <description>I was amused by the post [1-D Cellular Automata With a Twist][1], so I thought I&amp;#039;d take a look. &#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
Here&amp;#039;s rule 420.&#xD;
&#xD;
    Clear[a];&#xD;
    tab=Table[{a[0,k]=0, a[k,0]=0},{k,0,800}]; &#xD;
    a[0,0]=1;&#xD;
    rule=IntegerDigits[420,3,7];&#xD;
    a[n_,k_] := a[n,k]= rule[[1+ a[n-1,k -1]+a[n -1,k]+a[n ,k-1]]];&#xD;
    tab=Table[a[m,d-m],{d,2,729},{m,1,d-1}];&#xD;
    ArrayPlot[Table[a[x,y],{x,1,729},{y,1,729}], Frame-&amp;gt; False, PixelConstrained-&amp;gt;1]&#xD;
&#xD;
![rule 420][3]&#xD;
&#xD;
Here are some other nice rules:&#xD;
&#xD;
    nice = {381, 382, 383, 384, 385, 386, 414, 415, 416, 417, 418, 419, &#xD;
      420, 421, 422, 424, 478, 613, 622, 623, 624, 625, 626, 657, 658, &#xD;
      663, 694, 717, 721, 864, 865, 866, 867, 868, 869, 870, 871, 872, &#xD;
      883, 903, 904, 906, 936, 937, 960, 1110, 1111, 1112, 1113, 1114, &#xD;
      1115, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1230, 1231, &#xD;
      1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1242, 1243, &#xD;
      1244, 1245, 1246, 1247, 1254, 1255, 1256, 1257, 1258, 1259, 1260, &#xD;
      1261, 1262, 1263, 1265, 1266, 1272, 1274, 1278, 1279, 1280, 1284, &#xD;
      1287, 1288, 1342, 1351, 1352, 1354, 1355, 1386, 1387, 1392, 1504, &#xD;
      1527, 1531, 1539, 1547, 1548, 1549, 1556, 1557, 1558, 1559, 1560, &#xD;
      1561, 1562, 1563, 1564, 1585, 1593, 1594, 1595, 1596, 1597, 1598, &#xD;
      1599, 1600, 1601, 1608, 1612, 1632, 1633, 1634, 1635, 1666, 1774, &#xD;
      1839, 1840, 1841, 1842, 1843, 1844, 1872, 1874, 1875, 1876, 1877, &#xD;
      1878, 1879, 1882, 2071, 2080, 2081, 2082, 2083, 2084, 2121, 2175}&#xD;
&#xD;
Here&amp;#039;s 1504&#xD;
&#xD;
![rule 1504][4]&#xD;
&#xD;
Here&amp;#039;s 1240&#xD;
&#xD;
![rule 1240][5] &#xD;
&#xD;
Here&amp;#039;s 1263&#xD;
![rule 1263][6]&#xD;
&#xD;
&#xD;
  [1]: https://www.reddit.com/r/math/comments/fagayt/1d_cellular_automata_with_a_twist/&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=DEBlSIr.png&amp;amp;userId=11733&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=rule420.png&amp;amp;userId=21530&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=rule1504.png&amp;amp;userId=21530&#xD;
  [5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=rule1240.png&amp;amp;userId=21530&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=rule1263.png&amp;amp;userId=21530</description>
    <dc:creator>Ed Pegg</dc:creator>
    <dc:date>2020-02-28T23:27:55Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1248938">
    <title>O Tannenbaum</title>
    <link>https://community.wolfram.com/groups/-/m/t/1248938</link>
    <description>#Making a Christmas Animation with the Wolfram Language#&#xD;
![enter image description here][1]&#xD;
&#xD;
This notebook describes how to build an animation of a decorated pine tree that moves its branches synchronized to the voices of the music of the 16th century German [*O Tannenbaum*][2] song (the English version is *O Christmas Tree*). One dedicated branch of the tree will act as the conductor and a candle will be the baton. The keep the animation interesting through all versus we will also add some snowfall and some ecstatic tree movements in the second half of the song. To see the final design watch this [YouTube video][3]:&#xD;
&#xD;
[![enter image description here][4]][3]&#xD;
&#xD;
I will implement the animation through the following steps:&#xD;
&#xD;
1) Build a pine tree with curved branches where the branches can be moved smoothly up and down and left and right.&#xD;
&#xD;
2) Add ornaments (colored balls, five-pointed stars) and candles of different color to the branches. Allow the ornaments to be moved with respect to the branch tips.&#xD;
&#xD;
3) Convert the 4 voices of the music to a 2D movement based on the frequencies of the sound. Model the conductor movements in sync with the music.&#xD;
&#xD;
4) Model the movements of the ornaments as forced spherical pendula. Account for friction of the ornaments using the Rayleigh dissipation function.&#xD;
&#xD;
5) Add some snowfall for having a white Christmas.&#xD;
&#xD;
6) Build the animation with the branches using according to the music.&#xD;
&#xD;
Special thanks to my coworker Andrew Steinacher for selecting the music and analyzing the music to get the data for the tree movements (the below section From Music to Movements). And thanks to Amy Young for turning the animation frames and the music into one video clip.&#xD;
&#xD;
#Making a Pine Tree#&#xD;
&#xD;
##Tree Parameters##&#xD;
&#xD;
The tree dimensions, the overall shape of the tree and counts of branches. The variable names make their meaning obvious.&#xD;
&#xD;
    (* radial branch count *)&#xD;
    radialBranchCount = 3;&#xD;
    (* vertical branch count *)&#xD;
    verticalBranchCount = 5;&#xD;
    (* tree height *)&#xD;
    treeHeight = 12;&#xD;
    (* tree width *)&#xD;
    treeWidth = 6;&#xD;
&#xD;
    (* plot points for the B-spline surfaces forming the branches *)&#xD;
    {?, ?} = {6, 8}; &#xD;
&#xD;
Colors of stem and branches.&#xD;
&#xD;
    stemColor = Directive[Darker[Brown], Lighting -&amp;gt; &amp;#034;Neutral&amp;#034;, Specularity[Brown, 20]];&#xD;
    branchTopColor = RGBColor[0., 0.6, 0.6];&#xD;
    branchBottomColor = RGBColor[0., 0.4, 0.4];&#xD;
    branchSideColor = RGBColor[0.4, 0.8, 0.];&#xD;
&#xD;
##Grow a Movable Tree Branch##&#xD;
&#xD;
Each branch has a rectangle cross section with changing dimension (as a function of the distance from the stem). The tip of the branch should be pointing slightly upwards to have the iconic shape of a Christmas tree.&#xD;
At its widest size, the branch is made to fit smoothly to a cone (the stem).&#xD;
The variable $\tau$ determines the up-down and variable $\sigma$ the left-right position of the tip of the branch.&#xD;
I build a branch from four B-spline surfaces (top, bottom, left, right) to have a smooth appearance with only a small number of points defining the surface.&#xD;
&#xD;
    branchTopBottom[&#xD;
      tp_, {hb_, ht_}, {?1_, ?2_}, {rb_, rt_}, &#xD;
      R_, {?_, ?_}] := &#xD;
     Module[{A = -0.6, ? = 1/2, ?m, Pm, dirR, &#xD;
       dir?, r, P1, P, \[ScriptN], \[ScriptP], x, &#xD;
       y, ?, ?, ?, \[ScriptH]s, \[ScriptH]},&#xD;
      ?m = Mean[{?1, ?2}]; &#xD;
      Pm = R {Cos[?m], Sin[?m]}; &#xD;
      dirR = 1. {Cos[?m], Sin[?m]};&#xD;
      dir? = Reverse[dirR] {-1, 1}; &#xD;
      r = If[tp == &amp;#034;top&amp;#034;, rt, rb];&#xD;
      (* move cross section radially away from the stem and contract it *)&#xD;
       Table[P1 = {r Cos[?], r Sin[?]}; &#xD;
           Table[P = P1 + s/? (Pm - P1);&#xD;
                       \[ScriptN] = dir?.P; \[ScriptP] = dirR.P; &#xD;
                       {x, &#xD;
           y} = \[ScriptN] Cos[&#xD;
              s/? Pi/2]^2 dir? + \[ScriptP] dirR;&#xD;
                       ? = ?* &#xD;
           1. s/?  Abs[?2 - ?1]/&#xD;
            radialBranchCount;&#xD;
                       ? = {{Cos[?], &#xD;
            Sin[?]}, {-Sin[?], Cos[?]}};&#xD;
                      {x, y} = ?.{x, y};&#xD;
                       ? = R s/?; &#xD;
                       \[ScriptH]s = {ht, &#xD;
            hb} + {? (A R (R - ?) - (hb - ht) (? - &#xD;
                   1) ?), (ht - hb) ?^2 ?}/R^2;&#xD;
                       \[ScriptH] = &#xD;
          If[tp == &amp;#034;top&amp;#034;, \[ScriptH]s[[1]], \[ScriptH]s[[2]]] ;&#xD;
                     {x, y, \[ScriptH] + ? s/? (ht - hb)},&#xD;
               {s, 0, ?}],  &#xD;
               {?, ?1, ?2, (?2 - ?1)/?}] // N&#xD;
      ]&#xD;
&#xD;
The radius at height h is just the linear interpolation of the maximal stem radius and radius 0 at the top.&#xD;
&#xD;
    stemRadius[h_, H_] := (H - h)/H&#xD;
&#xD;
The sides of a branch are just the connecting pieces between the top and the bottom surfaces.&#xD;
&#xD;
    branchOnStem[{{hb_, ht_}, {?1_, ?2_}, &#xD;
       R_}, {?_, ?_}] := &#xD;
     Module[{tBranch, bBranch, sideBranches},&#xD;
      {bBranch, tBranch} = &#xD;
       Table[branchTopBottom[p, {hb, ht}, {?1, ?2}, &#xD;
         stemRadius[{hb, ht}, treeHeight], &#xD;
         R, {?, ?}], {p, {&amp;#034;top&amp;#034;, &amp;#034;bottom&amp;#034;}}]; &#xD;
       sideBranches = &#xD;
       Table[BSplineSurface[{tBranch[[j]], &#xD;
          bBranch[[j]]}], {j, {1, -1}}]; &#xD;
      {branchTopColor, BSplineSurface[tBranch], &#xD;
       branchBottomColor, BSplineSurface[bBranch], &#xD;
       branchSideColor, sideBranches} &#xD;
      ]&#xD;
&#xD;
For later use, let&amp;#039;s define a function for the tip position only.&#xD;
&#xD;
    branchOnStemEndPoint[ {{hb_, ht_}, {?1_, ?2_}, &#xD;
       R_}, {?_, ?_}] := &#xD;
     Module[{A = -0.6, ? = 1/2, Pm, dirR, dir?, &#xD;
       P, \[ScriptN], \[ScriptP], x, &#xD;
       y, ?, ?, \[ScriptH]s, \[ScriptH],&#xD;
       ? = ?1, ?m = &#xD;
        Mean[{?1, ?2}]},  &#xD;
        Pm = R {Cos[?m], Sin[?m]}; &#xD;
        dirR = {Cos[?m], Sin[?m]};     &#xD;
       {x, y} = dirR.Pm dirR;&#xD;
       ? = &#xD;
       1. ? Abs[?2 - ?1]/radialBranchCount; &#xD;
       {x, y} = {{Cos[?], Sin[?]}, {-Sin[?], &#xD;
          Cos[?]}}.{x, y};&#xD;
       \[ScriptH]s = {ht, hb} + (ht - hb)   {? - 1., 1}; &#xD;
      {x, y, \[ScriptH]s[[1]] + ? (ht - hb)} ]&#xD;
&#xD;
An interactive demonstration that lets the branch and the branch tip around as a function of {?,?}.&#xD;
&#xD;
    Manipulate[&#xD;
     Graphics3D[{branchOnStem[{{0, 1}, {Pi/2 - 1/2, Pi/2 + 1/2}, &#xD;
         1 + ?}, ??],&#xD;
                              Red, &#xD;
       Sphere[branchOnStemEndPoint[{{0, 1}, {Pi/2 - 1/2, Pi/2 + 1/2}, &#xD;
          1 + ?}, ??], 0.05]},&#xD;
       PlotRange -&amp;gt; {{-2, 2}, {0, 4}, {-1, 2}},&#xD;
      ViewPoint -&amp;gt; {3.17, 0.85, 0.79}],&#xD;
     {{?, 1.6, &amp;#034;branch length&amp;#034;}, 0, 2, ImageSize -&amp;gt; Small},&#xD;
     {{??, {0, 0}, &#xD;
       &amp;#034;branch\nleft/right\nup/down&amp;#034;}, {-1, -1}, {1, 1}},&#xD;
     ControlPlacement -&amp;gt; Left, SaveDefinitions -&amp;gt; True]&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
##Adding Branches to a Tree Stem##&#xD;
&#xD;
The stem is just a cone with the cone tip being the tree top.&#xD;
&#xD;
    stem = Cone[{{0, 0, 0}, {0, 0, treeHeight}}, 1];&#xD;
&#xD;
Branch dimensions decrease with height; getting geometrically smaller. The total of all branch levels equals the tree height minus the step part at the bottom.&#xD;
&#xD;
    heightList1 = &#xD;
     Module[{? = 0.8, hs, sol},&#xD;
                     &#xD;
      hs = Prepend[Table[C  ?^k, {k, 0, verticalBranchCount - 1}], &#xD;
        0];&#xD;
                     sol = Solve[Total[hs] == 10, C, Reals];&#xD;
                    Accumulate[hs /. sol[[1]]]]&#xD;
&#xD;
&amp;gt; {0, 2.97477, 5.35459, 7.25845, 8.78153, 10.}&#xD;
&#xD;
    treeWidthOfHeight[h_] := treeWidth (treeHeight - h)/treeHeight&#xD;
&#xD;
The branches fit snug onto the stem, no gaps in-between.&#xD;
&#xD;
    Graphics3D[{{stemColor, stem}, &#xD;
       {Darker[Green], &#xD;
       Table[Table[&#xD;
         branchOnStem[{2 + &#xD;
            heightList1[[{j, j + 1}]], {k , k + 1} 2 Pi/&#xD;
             radialBranchCount , &#xD;
                                                               &#xD;
           treeWidthOfHeight[Mean[heightList1[[{j, j + 1}]]]]}, {0, &#xD;
           0}], {k, 0, 1}] ,&#xD;
               {j, 1, verticalBranchCount}]}}, &#xD;
     ViewPoint -&amp;gt; {2.48, -2.28, 0.28}]&#xD;
&#xD;
![enter image description here][6]&#xD;
&#xD;
    Graphics3D[{{stemColor, stem}, &#xD;
       {Darker[Green], &#xD;
       Table[Table[&#xD;
         branchOnStem[{2 + &#xD;
            heightList1[[{j, j + 1}]], {k , k + 1} 2 Pi/&#xD;
             radialBranchCount , &#xD;
                   &#xD;
           treeWidthOfHeight[Mean[heightList1[[{j, j + 1}]]]]}, {0, &#xD;
           0}], {k, 0, radialBranchCount - 1}] ,&#xD;
               {j, 1, verticalBranchCount}]}}, &#xD;
     ViewPoint -&amp;gt; {2.48, -2.28, 0.28}]&#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
Interleave branches to get a more realistic tree shape. This is the tree I will be using in the following. It is straightforward to change the tree parameters and use another tree.&#xD;
&#xD;
    heightList2 = {2/3, 1/3}.# &amp;amp; /@ Partition[heightList1, 2, 1];&#xD;
&#xD;
    Graphics3D[{{Darker[Brown], stem},&#xD;
        {EdgeForm[],&#xD;
         Table[&#xD;
        Table[branchOnStem[ {2 + &#xD;
            heightList1[[{j, j + 1}]], {k , k + 1} 2 Pi/&#xD;
             radialBranchCount , &#xD;
                                           &#xD;
           treeWidthOfHeight[Mean[heightList1[[{j, j + 1}]]]]}, {0, &#xD;
           0}], {k, 0, radialBranchCount - 1}] ,&#xD;
               {j, 1, verticalBranchCount}],&#xD;
       Table[Table[&#xD;
         branchOnStem[{2 + &#xD;
            heightList2[[{j, j + 1}]], {k , k + 1} 2 Pi/&#xD;
              radialBranchCount + Pi/radialBranchCount, &#xD;
                                           &#xD;
           treeWidthOfHeight[Mean[heightList2[[{j, j + 1}]]]]}, {0, &#xD;
           0}], {k, 0, radialBranchCount - 1}] ,&#xD;
               {j, 1, verticalBranchCount - 1}]}}, &#xD;
     ViewPoint -&amp;gt; {2.48, -2.28, 0.28}]&#xD;
&#xD;
![enter image description here][8]&#xD;
&#xD;
One could easily make even denser trees with more branches.&#xD;
&#xD;
    Graphics3D[{{Darker[Brown], stem},&#xD;
        {EdgeForm[], &#xD;
       Table[Table[branchOnStem[ {2 + heightList1[[{j, j + 1}]],&#xD;
           {k , k + 1} 2 Pi/(2 radialBranchCount) , &#xD;
                                           &#xD;
           treeWidthOfHeight[Mean[heightList1[[{j, j + 1}]]]]}, {0, &#xD;
           0}], {k, 0, (2 radialBranchCount) - 1}] ,   {j, 1, &#xD;
         verticalBranchCount}],&#xD;
       Table[Table[branchOnStem[{2 + heightList2[[{j, j + 1}]],&#xD;
           {k , k + 1} 2 Pi/(2 radialBranchCount) + &#xD;
            Pi/(2 radialBranchCount), &#xD;
                                           &#xD;
           treeWidthOfHeight[Mean[heightList2[[{j, j + 1}]]]]}, {0, &#xD;
           0}], {k, 0, 2 radialBranchCount - 1}] ,&#xD;
               {j, 1, verticalBranchCount - 1}]}}, &#xD;
     ViewPoint -&amp;gt; {2.48, -2.28, 0.28}]&#xD;
![enter image description here][9]&#xD;
&#xD;
#Decorating the Tree#&#xD;
Now let&amp;#039;s construct a few ornaments to build a nicely decorated Christmas tree. I all add shiny balls, five-pointed stars and candles. I recommend original Thuringian Lauscha baubles for your Christmas tree. (You can get them [here][10].)&#xD;
&#xD;
##Ornaments, Candles, and the Top##&#xD;
###Colored Balls###&#xD;
&#xD;
A must on every tree are some shiny glass spheres, baubles.&#xD;
&#xD;
    coloredBall[p_, size_, color_, {?_, ?_}] := &#xD;
     Module[{\[ScriptD] = {Cos[?] Sin[?], &#xD;
         Sin[?] Sin[?], -Cos[?]}},&#xD;
      {EdgeForm[], GrayLevel[0.4],  Specularity[Yellow, 20], &#xD;
       Cylinder[{p, p + 1.5 size \[ScriptD]}, 0.02 size ],&#xD;
       color, Specularity[Yellow, 10],&#xD;
       Sphere[p + (1.5 size + 0.6 size) \[ScriptD] , 0.6 size] &#xD;
         }]&#xD;
&#xD;
    Graphics3D[{coloredBall[{1, 2, 3}, 1, Red, {0, 0}], &#xD;
      coloredBall[{3, 2, 3}, 1, Darker[Blue], {1, 0.2}]}, Axes -&amp;gt; True]&#xD;
&#xD;
![enter image description here][11]&#xD;
&#xD;
    branchOnStemWithBall[{{hb_, ht_}, {?1_, ?2_}, &#xD;
       R_}, {?_, ?_}, color_, {?_, ?_}] := &#xD;
     {branchOnStem[{{hb, ht}, {?1, ?2}, &#xD;
        R}, {?, ?}] ,  &#xD;
      coloredBall[&#xD;
       branchOnStemEndPoint[{{hb, ht}, {?1, ?2}, &#xD;
         R}, {?, ?}], 0.45 (ht - hb)/2, &#xD;
       color, {?, ?}]}&#xD;
&#xD;
Here is a branch with a bauble. The {?,?} variables allow to change the position of the ball relative to the branch tip.&#xD;
&#xD;
    Manipulate[&#xD;
     Graphics3D[{branchOnStemWithBall[{{0, 1}, {Pi/2 - 1/2, Pi/2 + 1/2}, &#xD;
         1 + ?}, ??, Red, ??]},&#xD;
       PlotRange -&amp;gt; {{-2, 2}, {0, 4}, {-2, 2}},&#xD;
      ViewPoint -&amp;gt; {3.17, 0.85, 0.79}],&#xD;
     {{?, 1.6, &amp;#034;branch length&amp;#034;}, 0, 2, ImageSize -&amp;gt; Small},&#xD;
     {{??, {0.6, 0.26}, &#xD;
       &amp;#034;branch\nleft/right\nup/down&amp;#034;}, {-1, -1}, {1, 1}},&#xD;
     {{??, {2.57, 1.88}, &amp;#034;ball angles&amp;#034;}, {0, -Pi}, {Pi, Pi}},&#xD;
     ControlPlacement -&amp;gt; Left, SaveDefinitions -&amp;gt; True]&#xD;
&#xD;
![enter image description here][12]&#xD;
&#xD;
Here is a tree with balls mostly straight down. I will use random colors for the balls.&#xD;
&#xD;
    Graphics3D[{{Darker[Brown], &#xD;
       stem},  {Table[&#xD;
        Table[branchOnStemWithBall[{2 + &#xD;
            heightList1[[{j, j + 1}]], {k , k + 1} 2 Pi/&#xD;
             radialBranchCount , &#xD;
                                                               &#xD;
           treeWidthOfHeight[Mean[heightList1[[{j, j + 1}]]]]}, {0, 0},&#xD;
                                  RandomColor[], {0, 0}], {k, 0, &#xD;
          radialBranchCount - 1}] ,&#xD;
               {j, 1, verticalBranchCount}]&#xD;
       }}, ViewPoint -&amp;gt; {2.48, -2.28, 0.28}, Axes -&amp;gt; True]&#xD;
&#xD;
![enter image description here][13]&#xD;
&#xD;
A tree with balls in random directions. If later the branches will be moved, the natural movements (meaning the solution of the corresponding equations of motion) of the balls will be calculated.&#xD;
&#xD;
    Graphics3D[{{Darker[Brown], &#xD;
       stem},  {Table[&#xD;
        Table[branchOnStemWithBall[{2 + &#xD;
            heightList1[[{j, j + 1}]], {k , k + 1} 2 Pi/&#xD;
             radialBranchCount , &#xD;
                                                               &#xD;
           treeWidthOfHeight[Mean[heightList1[[{j, j + 1}]]]]}, {0, 0},&#xD;
                                  &#xD;
          RandomColor[], {RandomReal[{-Pi, Pi}], &#xD;
           RandomReal[{0, Pi}]}], {k, 0, radialBranchCount - 1}] ,&#xD;
               {j, 1, verticalBranchCount}]}}, &#xD;
     ViewPoint -&amp;gt; {2.48, -2.28, 0.28}, Axes -&amp;gt; True]&#xD;
&#xD;
![enter image description here][14]&#xD;
&#xD;
##Five-pointed Stars##&#xD;
&#xD;
Now some 5-stars. As this ornament is not rotational symmetric, I allow for an orientation angle with respect to the thread it hangs on.&#xD;
&#xD;
    coloredFiveStar[p_, size_, dir_, &#xD;
      color_, ?_, {?_, ?_}] := &#xD;
     Module[{\[ScriptD] = {Cos[?] Sin[?], &#xD;
         Sin[?] Sin[?], -Cos[?]}, points, P1, P2, d1, &#xD;
       d2, d3, dP, dP2},&#xD;
        d2 = Normalize[dir - dir.\[ScriptD] \[ScriptD]]; &#xD;
      d3 = Cross[\[ScriptD], d2];&#xD;
      {EdgeForm[], GrayLevel[0.4], Specularity[Pink, 20],  &#xD;
       Cylinder[{p, p + (1.5 size + 0.6 size) \[ScriptD]}, 0.02 size ],&#xD;
       color, Specularity[Hue[.125], 5], &#xD;
       dP = Sin[?] d2 + Cos[?] d3;  &#xD;
       dP2 = Cross[\[ScriptD], dP];&#xD;
       points = &#xD;
        Table[p + (1.5 size + 0.6 size) \[ScriptD]  +   &#xD;
          size If[EvenQ[j], 1, 1/2] *&#xD;
                                  (Cos[j 2 Pi/10 ] \[ScriptD] + &#xD;
             Sin[j 2 Pi/10] dP),   {j, 0, 10}]; &#xD;
       P1 = p + (1.5 size + 0.6 size) \[ScriptD] + size/3 dP2;&#xD;
       P2 = p + (1.5 size + 0.6 size) \[ScriptD] - size/3 dP2; &#xD;
       {P1, P2} = (p + (1.5 size + 0.6 size) \[ScriptD]  + #  size/&#xD;
              3 dP2) &amp;amp; /@ {+1, -1};&#xD;
       Polygon[&#xD;
        Join @@ (Function[a, &#xD;
            Append[#, a] &amp;amp; /@ Partition[points, 2, 1]] /@ {P1, P2})]&#xD;
         }]&#xD;
&#xD;
    Graphics3D[{coloredFiveStar[{1, 2, 3}, 0.2, {0, -1, 0}, Darker[Red], &#xD;
       0, {0, 0}],&#xD;
                             &#xD;
      coloredFiveStar[{1.5, 2, 3}, 0.2, {0, -1, 0}, Darker[Purple], &#xD;
       Pi/3, {1, 0.4}]}]&#xD;
&#xD;
![enter image description here][15]&#xD;
&#xD;
    branchOnStemWithFiveStar[{{hb_, ht_}, {?1_, ?2_}, &#xD;
       R_}, {?_, ?_}, &#xD;
      color_, ?_, {?_, ?_}] := &#xD;
     Module[{dir = &#xD;
        Append[Normalize[&#xD;
          Mean[{{Cos[?1], &#xD;
             Sin[?1]}, {Cos[?2], &#xD;
             Sin[?2]}}]], 0]},&#xD;
      {branchOnStem[{{hb, ht}, {?1, ?2}, &#xD;
         R}, {?, ?}] ,  &#xD;
       coloredFiveStar[&#xD;
        branchOnStemEndPoint[{{hb, ht}, {?1, ?2}, &#xD;
          R}, {?, ?}], 0.4 (ht - hb)/2, dir, &#xD;
        color, ?, {?, ?}]} ]&#xD;
&#xD;
A tree decorated with 5-stars.&#xD;
&#xD;
    Graphics3D[{{Darker[Brown], &#xD;
       stem},  {Table[&#xD;
        Table[branchOnStemWithFiveStar[{2 + &#xD;
            heightList1[[{j, j + 1}]], {k , k + 1} 2 Pi/&#xD;
             radialBranchCount , &#xD;
                                                               &#xD;
           treeWidthOfHeight[Mean[heightList1[[{j, j + 1}]]]]}, {0, 0},&#xD;
                                  RandomColor[], &#xD;
          RandomReal[{-Pi, Pi}], {RandomReal[{-Pi, Pi}], &#xD;
           RandomReal[0.1 {-1, 1}]}], {k, 0, radialBranchCount - 1}] ,&#xD;
               {j, 1, verticalBranchCount}]&#xD;
       }}, ViewPoint -&amp;gt; {2.48, -2.28, 0.28}, Axes -&amp;gt; True]&#xD;
&#xD;
![enter image description here][16]&#xD;
&#xD;
##Candles##&#xD;
Build from a foot that attaches to the branch tips, a wax-like body, a blackened wick, and a flame. To make like easier for the animation and to avoid fire hazards, I will use electric candles so that the flame will not change shape as the branches move around.&#xD;
&#xD;
    flamePoints = &#xD;
     Table[{0.2 Sin[Pi z]^2 Cos[?], &#xD;
       0.2 Sin[Pi z]^2 Sin[?], z}, {z, 0, 1, &#xD;
       1/1/12}, {?, Pi/2, 5/2 Pi, 2 Pi/24}]&#xD;
&#xD;
    litCandle[p_, size_, color_] := &#xD;
     {EdgeForm[], color, &#xD;
      Cylinder[{p + {0, 0, size 0.001}, p + {0, 0, size 0.5}}, size  0.04],&#xD;
      GrayLevel[0.1], Specularity[Orange, 20],&#xD;
      Cylinder[{p, p + {0, 0, size 0.05}}, size  0.06],&#xD;
      Black, Glow[Black], &#xD;
      Cylinder[{ p + {0, 0, size 0.5}, p + {0, 0, size 0.5 + 0.05 size}}, &#xD;
       size 0.008],&#xD;
      Glow[Orange], Specularity[Hue[.125], 5], &#xD;
      BSplineSurface[&#xD;
       Map[(p + {0, 0, size 0.5} + 0.3 size #) &amp;amp;, flamePoints, {2}],&#xD;
       SplineClosed -&amp;gt; {True, False}]&#xD;
        }&#xD;
&#xD;
A white and a red candle.&#xD;
&#xD;
    Graphics3D[{litCandle[{0, 0, 0}, 1, &#xD;
       Directive[White, Glow[GrayLevel[0.3]],  Specularity[Yellow, 20]]], &#xD;
      litCandle[{0.5, 0, 0}, 1, &#xD;
       Directive[Red, Glow[GrayLevel[0.1]],  Specularity[Yellow, 20]]]}]&#xD;
&#xD;
![enter image description here][17]&#xD;
&#xD;
Later, I will use an extended branch with a candle to be the conductor, so I will allow the candle to be tilted away from the stem.&#xD;
&#xD;
    branchOnStemWithCandle[{{hb_, ht_}, {?1_, ?2_}, &#xD;
       R_}, {?_, ?_}, color_, ?_] := &#xD;
     {branchOnStem[{{hb, ht}, {?1, ?2}, &#xD;
        R}, {?, ?}] ,  &#xD;
      If[? == 0, &#xD;
       litCandle[&#xD;
        branchOnStemEndPoint[{{hb, ht}, {?1, ?2}, &#xD;
          0.98 R}, {?, ?}], 0.66 (ht - hb) , color],&#xD;
       Module[{P = &#xD;
          branchOnStemEndPoint[{{hb, ht}, {?1, ?2}, &#xD;
            0.98 R}, {?, ?}], dir},&#xD;
        dir = Append[Reverse[Take[P, 2]] {-1, 1}, 0];&#xD;
        Rotate[&#xD;
         litCandle[&#xD;
          branchOnStemEndPoint[{{hb, ht}, {?1, ?2}, &#xD;
            0.98 R}, {?, ?}], 0.66 (ht - hb) , &#xD;
          color], ?, dir, P]]]}&#xD;
&#xD;
    Manipulate[&#xD;
     Graphics3D[{branchOnStemWithCandle[{{0, 1}, {Pi/2 - 1/2, Pi/2 + 1/2},&#xD;
          1 + ?}, ??, Red, ?]},&#xD;
       PlotRange -&amp;gt; {{-2, 2}, {0, 4}, {-2, 2}},&#xD;
      ViewPoint -&amp;gt; {3.17, 0.85, 0.79}],&#xD;
     {{?, 1.6, &amp;#034;branch length&amp;#034;}, 0, 2, ImageSize -&amp;gt; Small},&#xD;
     {{??, {0, 0}, &#xD;
       &amp;#034;branch\nleft/right\nup/down&amp;#034;}, {-1, -1}, {1, 1}},&#xD;
     {{?, Pi/4, &amp;#034;candle angle&amp;#034;}, -Pi, Pi},&#xD;
     ControlPlacement -&amp;gt; Left, SaveDefinitions -&amp;gt; True]&#xD;
&#xD;
And here is a tree with a candle on each branch.&#xD;
&#xD;
    Graphics3D[{{Darker[Brown], &#xD;
       stem},  {Table[&#xD;
        Table[branchOnStemWithCandle[{2 + &#xD;
            heightList1[[{j, j + 1}]], {k , k + 1} 2 Pi/&#xD;
             radialBranchCount , &#xD;
            treeWidthOfHeight[Mean[heightList1[[{j, j + 1}]]]]}, {0, 0},&#xD;
                                  White, 0], {k, 0, &#xD;
          radialBranchCount - 1}] ,&#xD;
               {j, 1, verticalBranchCount}]&#xD;
       }}, ViewPoint -&amp;gt; {2.48, -2.28, 0.28}, Axes -&amp;gt; True]&#xD;
&#xD;
![enter image description here][18]&#xD;
&#xD;
##Tree Topper##&#xD;
For fun, I add a rotatable spikey at the top.&#xD;
&#xD;
    spikey = Cases[&#xD;
        N@Entity[&amp;#034;Polyhedron&amp;#034;, &amp;#034;RhombicHexecontahedron&amp;#034;][&#xD;
          &amp;#034;Image&amp;#034;], _GraphicsComplex, ?][[1]];&#xD;
&#xD;
    top = {Gray, Specularity[Red, 25], &#xD;
      Cone[{{0, 0, 0.9 treeHeight}, {0, 0, 1.08 treeHeight}}, &#xD;
       treeWidth/240],&#xD;
             Orange, EdgeForm[Darker[Orange]], Specularity[Hue[.125], 5],&#xD;
              &#xD;
      MapAt[((0.24 # + {0, 0, 1.08 treeHeight}) &amp;amp; /@ #) &amp;amp;, spikey, 1]&#xD;
      }&#xD;
    Graphics3D[{{Darker[Brown], stem}, &#xD;
       {Table[&#xD;
        Table[branchOnStem[{2 + &#xD;
            heightList1[[{j, j + 1}]], {k , k + 1} 2 Pi/&#xD;
             radialBranchCount , &#xD;
                                                               &#xD;
           treeWidthOfHeight[Mean[heightList1[[{j, j + 1}]]]]}, {0, &#xD;
           0} ], {k, 0, radialBranchCount - 1}] ,&#xD;
               {j, 1, verticalBranchCount}],&#xD;
       top}}, ViewPoint -&amp;gt; {2.48, -2.28, 0.28}, Axes -&amp;gt; True]&#xD;
&#xD;
![enter image description here][19]&#xD;
&#xD;
##Decorating the Tree##&#xD;
&#xD;
We will single out a single branch as the conductor. The remaining branches we will randomly divide into four groups and decorate them with baubles of two colors, five-pointed stars, and candles.&#xD;
&#xD;
Now let&amp;#039;s add an ornament or a candle on every tree branch. I will use the above tree with 27 branches. I start the branches by height on the stem and by azimuthal angle.&#xD;
&#xD;
    allBranches = &#xD;
     Flatten[Riffle[&#xD;
       Table[Table[{2 + &#xD;
           heightList1[[{j, j + 1}]], {k , k + 1} 2. Pi/&#xD;
            radialBranchCount , &#xD;
                                                                   &#xD;
          treeWidthOfHeight[Mean[heightList1[[{j, j + 1}]]]]}, {k, 0, &#xD;
          radialBranchCount - 1}] ,&#xD;
               {j, 1, verticalBranchCount}],&#xD;
       Table[Table[{2 + &#xD;
           heightList2[[{j, j + 1}]], {k , k + 1} 2. Pi/&#xD;
             radialBranchCount + Pi/radialBranchCount, &#xD;
                                          &#xD;
          treeWidthOfHeight[Mean[heightList2[[{j, j + 1}]]]]}, {k, 0, &#xD;
          radialBranchCount - 1}] ,&#xD;
               {j, 1, verticalBranchCount - 1}]], 1]&#xD;
&#xD;
    Length[allBranches]&#xD;
&#xD;
&amp;gt; 27&#xD;
&#xD;
Color branches by index, starting at the bottom in red to the top in purple.&#xD;
&#xD;
    Graphics3D[{{Darker[Brown], stem},&#xD;
      MapIndexed[(branchOnStem[#1, {0, 0}] /. _RGBColor :&amp;gt; &#xD;
           Hue[#2[[1]]/36]) &amp;amp;, allBranches],&#xD;
      top}, ViewPoint -&amp;gt; {2, 1, -0.2}]&#xD;
&#xD;
![enter image description here][20]&#xD;
&#xD;
Split all branches into 4 groups for the voices and a conductor branch.&#xD;
&#xD;
    conductorBranch = 7;&#xD;
&#xD;
    SeedRandom[12];&#xD;
    voiceBranches = (Last /@ #) &amp;amp; /@ &#xD;
      GroupBy[{RandomChoice[{1, 2, 3, 4}], #} &amp;amp; /@ &#xD;
        Delete[Range[27], {conductorBranch}], First]&#xD;
&#xD;
&amp;gt; &amp;lt;|1 -&amp;gt; {1, 4, 5, 6, 12, 18, 20}, 3 -&amp;gt; {2, 8, 10, 11, 14, 22, 23, 25}, &#xD;
&amp;gt; 2 -&amp;gt; {3, 13, 15, 16, 21, 26}, 4 -&amp;gt; {9, 17, 19, 24, 27}|&amp;gt;&#xD;
&#xD;
    voiceBranches = &amp;lt;|1 -&amp;gt; {2, 9, 14, 17, 19, 24, 27}, &#xD;
      2 -&amp;gt; {3, 13, 15, 16, 21, 26}, 3 -&amp;gt; {1, 4, 5, 12, 18, 20}, &#xD;
      4 -&amp;gt; {6, 8, 10, 11, 22, 23, 25}|&amp;gt;&#xD;
&#xD;
&amp;gt; &amp;lt;|1 -&amp;gt; {2, 9, 14, 17, 19, 24, 27}, 2 -&amp;gt; {3, 13, 15, 16, 21, 26},   3&#xD;
&amp;gt; -&amp;gt; {1, 4, 5, 12, 18, 20}, 4 -&amp;gt; {6, 8, 10, 11, 22, 23, 25}|&amp;gt;&#xD;
&#xD;
Here is a plot of the branches colored according to which voice they represent.&#xD;
&#xD;
    Graphics3D[{{Darker[Brown], stem},&#xD;
      branchOnStem[#1, {0, 0}] &amp;amp; /@ &#xD;
        allBranches[[voiceBranches[[1]]]] /. _RGBColor :&amp;gt; Yellow,&#xD;
      branchOnStem[#1, {0, 0}] &amp;amp; /@ &#xD;
        allBranches[[voiceBranches[[2]]]] /. _RGBColor :&amp;gt; White,&#xD;
      branchOnStem[#1, {0, 0}] &amp;amp; /@ &#xD;
        allBranches[[voiceBranches[[3]]]] /. _RGBColor :&amp;gt; LightBlue,&#xD;
      branchOnStem[#1, {0, 0}] &amp;amp; /@ &#xD;
        allBranches[[voiceBranches[[4]]]] /. _RGBColor :&amp;gt; Pink,&#xD;
      branchOnStem[&#xD;
        allBranches[[conductorBranch]] {1, 1, 1.5}, {0, &#xD;
         0}] /. _RGBColor :&amp;gt; Red,&#xD;
      top}, ViewPoint -&amp;gt; {2, 1, -0.2}]&#xD;
&#xD;
![enter image description here][21]&#xD;
&#xD;
The final tree with the branch tip positions as parameters. Also allow the ornaments on the branch tips angled and colored.&#xD;
&#xD;
    christmasTree[{{?1_, ?1_}, {?2_, ?2_}, {?3_, ?3_}, {?4_, ?4_}, {?c_, ?c_}}, &#xD;
                                {{?1_, ?1_}, {?2_, ?2_}, {?3_, ?3_}},  &#xD;
                                 {colBall1_, colBall2_, col5Star_},&#xD;
                               conductorEnhancementFactor : fc_, &#xD;
                               conductorCandleAngle : ?c_, topRotationAngle : ?_] := &#xD;
      {{Darker[Brown], stem}, &#xD;
       branchOnStemWithBall[#, {?1, ?1}, &#xD;
          colBall1, {?1, ?1}] &amp;amp; /@ &#xD;
        allBranches[[voiceBranches[[1]]]],&#xD;
       branchOnStemWithBall[#, {?2, ?2}, &#xD;
          colBall2, {?2, ?2}] &amp;amp; /@ &#xD;
        allBranches[[voiceBranches[[2]]]],&#xD;
       branchOnStemWithFiveStar[#, {?3, ?3}, col5Star, &#xD;
          Pi/4, {?3, ?3}] &amp;amp; /@ &#xD;
        allBranches[[voiceBranches[[3]]]], &#xD;
       branchOnStemWithCandle[#, {?4, ?4}, &#xD;
          Directive[White, Glow[GrayLevel[0.3]], Specularity[Yellow, 20]],&#xD;
           0] &amp;amp; /@ allBranches[[voiceBranches[[4]]]],&#xD;
       branchOnStemWithCandle[&#xD;
        allBranches[[conductorBranch]] {1, 1, &#xD;
          1 + fc}, {?c, ?c}, &#xD;
        Directive[Red, Glow[GrayLevel[0.1]],  &#xD;
         Specularity[Yellow, 20]], ?c],&#xD;
       Rotate[top, ?, {0, 0, 1}]&#xD;
       };&#xD;
&#xD;
Resting position of all branches and the conductor branch elongated and its candle angled.&#xD;
&#xD;
    Graphics3D[christmasTree[{{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}},&#xD;
                                                              {{0, 0}, {0,0}, {0, 0}}, {Red, Darker[Yellow], Pink}, 0.8, Pi/4, 0], &#xD;
     ImageSize -&amp;gt; 600, ViewPoint -&amp;gt; {3.06, 1.28, 0.27},  &#xD;
     PlotRange -&amp;gt; {{-7, 7}, {-7, 7}, {0, 15}}]&#xD;
&#xD;
![enter image description here][22]&#xD;
&#xD;
Three trees with all parameters selected randomly.&#xD;
&#xD;
    SeedRandom[1]&#xD;
    Table[Graphics3D[christmasTree[RandomReal[1.5 {-1, 1}, {5, 2}],&#xD;
                                                            &#xD;
        Table[{RandomReal[{-Pi, Pi}], RandomReal[{0, Pi}]}, 3],&#xD;
                                                RandomColor[3], &#xD;
        RandomReal[], RandomReal[Pi/2], 0], ImageSize -&amp;gt; 200, &#xD;
       ViewPoint -&amp;gt; {3.06, 1.28, 0.27},  &#xD;
       PlotRange -&amp;gt; {{-7, 7}, {-7, 7}, {-2, 15}}], {3}] // Row&#xD;
&#xD;
![enter image description here][23]&#xD;
&#xD;
The following interactive demonstrations allows to move the branches, move ornaments around with respect to the branch tips and to color the ornaments to ones personal preferences.&#xD;
&#xD;
    Manipulate[&#xD;
     Graphics3D[&#xD;
      christmasTree[{??1, ??2, ??3, ??4, ??c}, &#xD;
                                                             {??1, ??2, ??3}, {col1, col2, col3}, &#xD;
       l, ?c, ?],&#xD;
                               ImageSize -&amp;gt; 400, &#xD;
      ViewPoint -&amp;gt; {2.61, 1.99, 0.80},&#xD;
                                 &#xD;
      PlotRange -&amp;gt; {{-7, 7}, {-7, 7}, {-2, 15}}],&#xD;
     &amp;#034;conductor&amp;#034;,&#xD;
     {{l, 0.6, &amp;#034;branch length&amp;#034;}, 0, 1, ImageSize -&amp;gt; Small},&#xD;
     {{?c, Pi/4, &amp;#034;candle angle&amp;#034;}, 0, Pi, ImageSize -&amp;gt; Small},&#xD;
     {{??c, {0, 0}, &amp;#034;movement&amp;#034;}, {-1, -1}, {1, 1}, &#xD;
      ImageSize -&amp;gt; Small},&#xD;
     Delimiter,&#xD;
     &amp;#034;voice 1 (balls)&amp;#034;,&#xD;
     Grid[{{&amp;#034;movement&amp;#034;, &amp;#034;ornament&amp;#034;},&#xD;
       {Control[{{??1, {0, 0}, &amp;#034;&amp;#034;}, {-1, -1}, {1, 1}, &#xD;
          ImageSize -&amp;gt; Small}],&#xD;
        Control[{{??1, {0, 0}, &amp;#034;&amp;#034;}, {-Pi, 0}, {Pi, Pi}, &#xD;
          ImageSize -&amp;gt; Small}]}}],&#xD;
     {{col1, Red, &amp;#034;&amp;#034;}, Red, ImageSize -&amp;gt; Tiny},&#xD;
     Delimiter,&#xD;
     &amp;#034;voice 2 (balls)&amp;#034;,&#xD;
     Grid[{{&amp;#034;movement&amp;#034;, &amp;#034;ornament&amp;#034;},&#xD;
       {Control[{{??2, {0, 0}, &amp;#034;&amp;#034;}, {-1, -1}, {1, 1}, &#xD;
          ImageSize -&amp;gt; Small}],&#xD;
        Control[{{??2, {0, 0}, &amp;#034;&amp;#034;}, {-Pi, 0}, {Pi, Pi}, &#xD;
          ImageSize -&amp;gt; Small}]}}],&#xD;
     {{col2, Darker[Yellow], &amp;#034;&amp;#034;}, Red, ImageSize -&amp;gt; Tiny},&#xD;
     Delimiter,&#xD;
     &amp;#034;voice 3 (5-star)&amp;#034;,&#xD;
     Grid[{{&amp;#034;movement&amp;#034;, &amp;#034;ornament&amp;#034;},&#xD;
       {Control[{{??3, {0, 0}, &amp;#034;&amp;#034;}, {-1, -1}, {1, 1}, &#xD;
          ImageSize -&amp;gt; Small}],&#xD;
        Control[{{??3, {0, 0}, &amp;#034;&amp;#034;}, {-Pi, 0}, {Pi, Pi}, &#xD;
          ImageSize -&amp;gt; Small}]}}],&#xD;
     {{col3, Pink, &amp;#034;&amp;#034;}, Red, ImageSize -&amp;gt; Tiny},&#xD;
     Delimiter,&#xD;
     &amp;#034;voice 4 (white candles)&amp;#034;,&#xD;
      Control[{{??4, {0, 0}, &amp;#034;movement&amp;#034;}, {-1, -1}, {1, 1}, &#xD;
       ImageSize -&amp;gt; Small}],&#xD;
     Delimiter,&#xD;
      Delimiter,&#xD;
     {{?, 0, &amp;#034;top rotation&amp;#034;}, 0, 1, ImageSize -&amp;gt; Small},&#xD;
     ControlPlacement -&amp;gt; Left, SaveDefinitions -&amp;gt; True]&#xD;
&#xD;
![enter image description here][24]&#xD;
&#xD;
#From Music to Movements#&#xD;
&#xD;
So, now that I have dealt with the making a parametrized decorated Christmas tree with movable branches and ornaments, I must deal with relating the music to the movements of the branches (and in turn the ornaments).&#xD;
&#xD;
##Get the 4 Voices as Sound##&#xD;
&#xD;
Use a MIDI file of the song. &#xD;
&#xD;
![enter image description here][25]&#xD;
&#xD;
    {ohTannenBaum // Head, ohTannenBaum // ByteCount}&#xD;
&#xD;
&amp;gt; {Sound, 287816}&#xD;
&#xD;
Extract the 4 voices.&#xD;
&#xD;
    voices = AssociationThread[{&amp;#034;Soprano&amp;#034;, &amp;#034;Alto&amp;#034;, &amp;#034;Tenor&amp;#034;, &amp;#034;Bass&amp;#034;}, &#xD;
       ImportString[&#xD;
        ExportString[ohTannenBaum, &amp;#034;MIDI&amp;#034;], {&amp;#034;MIDI&amp;#034;, &amp;#034;SoundNotes&amp;#034;}]];&#xD;
&#xD;
    Sound[Take[#, 10]] &amp;amp; /@ voices&#xD;
![enter image description here][26]&#xD;
&#xD;
##Voices to Frequencies##&#xD;
&#xD;
    frequencyRules = &amp;lt;|&amp;#034;A1&amp;#034; -&amp;gt; 55., &amp;#034;A2&amp;#034; -&amp;gt; 110., &amp;#034;A3&amp;#034; -&amp;gt; 220., &#xD;
       &amp;#034;A4&amp;#034; -&amp;gt; 440., &amp;#034;B1&amp;#034; -&amp;gt; 61.74, &amp;#034;B2&amp;#034; -&amp;gt; 123.5, &amp;#034;B3&amp;#034; -&amp;gt; 246.9, &#xD;
       &amp;#034;B4&amp;#034; -&amp;gt; 493.9, &amp;#034;C2&amp;#034; -&amp;gt; 65.41, &amp;#034;C3&amp;#034; -&amp;gt; 130.8, &amp;#034;C4&amp;#034; -&amp;gt; 261.6, &#xD;
       &amp;#034;C5&amp;#034; -&amp;gt; 523.3, &amp;#034;D2&amp;#034; -&amp;gt; 73.42, &amp;#034;D#4&amp;#034; -&amp;gt; 311.13, &amp;#034;D4&amp;#034; -&amp;gt; 293.7, &#xD;
       &amp;#034;D5&amp;#034; -&amp;gt; 587.3, &amp;#034;E2&amp;#034; -&amp;gt; 82.41, &amp;#034;E4&amp;#034; -&amp;gt; 329.6, &amp;#034;E5&amp;#034; -&amp;gt; 659.3, &#xD;
       &amp;#034;F#2&amp;#034; -&amp;gt; 92.50, &amp;#034;F#4&amp;#034; -&amp;gt; 370.0, &amp;#034;G2&amp;#034; -&amp;gt; 98.00, &amp;#034;G#4&amp;#034; -&amp;gt; 415.3, &#xD;
       &amp;#034;G4&amp;#034; -&amp;gt; 392.0|&amp;gt;;&#xD;
&#xD;
    {minf, maxf} = MinMax[frequencyRules]&#xD;
&#xD;
&amp;gt; {55., 659.3}&#xD;
&#xD;
Time-frequency plot of the first voice.&#xD;
&#xD;
    pw[t_] = Piecewise[{frequencyRules[#1], #2[[1]] &amp;lt;= t &amp;lt;= #2[[2]]} &amp;amp; @@@&#xD;
         voices[[1]]];&#xD;
    Plot[pw[t], {t, 0, 100}, PlotRange -&amp;gt; {200, All}, Filling -&amp;gt; Axis, &#xD;
     PlotLabel -&amp;gt; &amp;#034;Soprano&amp;#034;,&#xD;
     Frame -&amp;gt; True, FrameLabel -&amp;gt; {&amp;#034;time in sec&amp;#034;, &amp;#034;frequency in Hz&amp;#034;}, &#xD;
     AxesOrigin -&amp;gt; {0, 200}]&#xD;
&#xD;
![enter image description here][27]&#xD;
&#xD;
For representing the frequencies in the movements, I will smooth the curves.&#xD;
&#xD;
    spline = BSplineFunction[Table[{t, pw[t]}, {t, 0, 100, 0.5}], &#xD;
      SplineDegree -&amp;gt; 2]&#xD;
&#xD;
![enter image description here][28]&#xD;
&#xD;
    ParametricPlot[spline[t], {t, 0, 100}, AspectRatio -&amp;gt; 0.5, &#xD;
     PlotPoints -&amp;gt; 1000]&#xD;
&#xD;
![enter image description here][29]&#xD;
&#xD;
    tMax = 100;&#xD;
    Do[&#xD;
     With[{j = j},&#xD;
      pwf[j][t_] = &#xD;
       Piecewise[{frequencyRules[#1], #2[[1]] &amp;lt;= t &amp;lt;= #2[[2]]} &amp;amp; @@@ &#xD;
         voices[[j]]];&#xD;
      splineFunction[j] = &#xD;
       BSplineFunction[Table[{t, pwf[j][t]}, {t, 0, 100, 0.5}], &#xD;
        SplineDegree -&amp;gt; 2];&#xD;
      voiceFunction[j][t_Real] := &#xD;
       If[0 &amp;lt; t &amp;lt; tMax, splineFunction[j][t/tMax][[2]]/maxf, 0]],&#xD;
     {j, 4}]&#xD;
&#xD;
The frequencies of the four voices.&#xD;
&#xD;
    Plot[Evaluate[Reverse@Table[pwf[j][t], {j, 4}]], {t, 0, 100}, &#xD;
     Frame -&amp;gt; True, FrameLabel -&amp;gt; {&amp;#034;time in sec&amp;#034;, &amp;#034;frequency in Hz&amp;#034;}, &#xD;
     AspectRatio -&amp;gt; 0.3]&#xD;
&#xD;
![enter image description here][30]&#xD;
&#xD;
Smoothed scaled frequencies of the four voices.&#xD;
&#xD;
    Plot[Evaluate[Table[voiceFunction[j][t], {j, 4}]], {t, 0, 100}, &#xD;
     Frame -&amp;gt; True, FrameLabel -&amp;gt; {&amp;#034;time in sec&amp;#034;, &amp;#034;scaled frequency&amp;#034;}, &#xD;
     AspectRatio -&amp;gt; 0.3]&#xD;
&#xD;
![enter image description here][31]&#xD;
&#xD;
Here is a plot of the (smoothed) first three voices as a 3D plot.&#xD;
&#xD;
    ParametricPlot3D[{voiceFunction[1][t], voiceFunction[2][t], &#xD;
      voiceFunction[3][t]}, {t, 0, 100}, AspectRatio -&amp;gt; Automatic, &#xD;
     PlotPoints -&amp;gt; 1000, BoxRatios -&amp;gt; {1, 1, 1}]&#xD;
&#xD;
![enter image description here][32]&#xD;
&#xD;
    Show[% /. Line[pts_] :&amp;gt; Tube[pts, 0.002], &#xD;
     Method -&amp;gt; {&amp;#034;TubePoints&amp;#034; -&amp;gt; 4}]&#xD;
&#xD;
![enter image description here][33]&#xD;
&#xD;
##Get Sway Pattern##&#xD;
&#xD;
Anchor to particular phrases to generate all measure beats.&#xD;
&#xD;
    {firstBeat, secondBeat, lastBeat} = &#xD;
     voices[&amp;#034;Soprano&amp;#034;][[{1, 2, -1}, 2, 1]]&#xD;
&#xD;
&amp;gt; {1.33522, 2.00568, 98.7727}&#xD;
&#xD;
        anchorDataOChristmasTree = SequenceCases[&#xD;
           voices[&amp;#034;Soprano&amp;#034;],&#xD;
           (* pattern for &amp;#034;O Christmas Tree, O Christmas Tree...&amp;#034; *)&#xD;
           {&#xD;
             SoundNote[&amp;#034;D4&amp;#034;, {pickupStart_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
             SoundNote[&amp;#034;G4&amp;#034;, {beatOne_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
             SoundNote[&amp;#034;G4&amp;#034;, {_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
             SoundNote[&amp;#034;G4&amp;#034;, {beatTwo_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
             SoundNote[&amp;#034;A4&amp;#034;, {beatThree_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
             SoundNote[&amp;#034;B4&amp;#034;, {beatFour_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
             SoundNote[&amp;#034;B4&amp;#034;, {_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
             SoundNote[&amp;#034;B4&amp;#034;, {beatFive_, _}, &amp;#034;Trumpet&amp;#034;, ___]&#xD;
             } :&amp;gt; &amp;lt;|&#xD;
             &amp;#034;PhraseName&amp;#034; -&amp;gt; &amp;#034;O Christmas Tree&amp;#034;,&#xD;
             &amp;#034;PickupBeat&amp;#034; -&amp;gt; pickupStart,&#xD;
             &amp;#034;TargetMeasureBeats&amp;#034; -&amp;gt; {beatOne, beatTwo, beatThree},&#xD;
             &amp;#034;BeatLength&amp;#034; -&amp;gt; &#xD;
              Mean@Differences[{pickupStart, beatOne, beatTwo, beatThree, &#xD;
                 beatFour, beatFive}]&#xD;
             |&amp;gt;&#xD;
           ];&#xD;
    &#xD;
    anchorDataYourBoughsSoGreen = SequenceCases[&#xD;
       voices[&amp;#034;Soprano&amp;#034;],&#xD;
       (* &amp;#034;Your boughs so green in summertime...&amp;#034; *)&#xD;
       {&#xD;
         SoundNote[&amp;#034;D5&amp;#034;, {pickupBeatAnd_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
         SoundNote[&amp;#034;D5&amp;#034;, {beatOne_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
         SoundNote[&amp;#034;B4&amp;#034;, {_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
         SoundNote[&amp;#034;E5&amp;#034;, {beatTwo_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
         SoundNote[&amp;#034;D5&amp;#034;, {beatThreeAnd_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
         SoundNote[&amp;#034;D5&amp;#034;, {beatFour_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
         SoundNote[&amp;#034;C5&amp;#034;, {_, _}, &amp;#034;Trumpet&amp;#034;, ___],&#xD;
         SoundNote[&amp;#034;C5&amp;#034;, {beatFive_, _}, &amp;#034;Trumpet&amp;#034;, ___]&#xD;
         } :&amp;gt; With[&#xD;
         {&#xD;
          (* the offbeat nature of this phrase requires some manual work &#xD;
             to get things lined up in terms of actual beats *)&#xD;
          &#xD;
          pickupBeatStart = pickupBeatAnd - (beatOne - pickupBeatAnd),&#xD;
          beatThree = beatThreeAnd - (beatFour - beatThreeAnd)&#xD;
          },&#xD;
         &amp;lt;|&#xD;
          &amp;#034;PhraseName&amp;#034; -&amp;gt; &amp;#034;Your boughs so green in summertime&amp;#034;,&#xD;
          &amp;#034;PickupBeat&amp;#034; -&amp;gt; pickupBeatStart,&#xD;
          &amp;#034;TargetMeasureBeats&amp;#034; -&amp;gt; {beatOne, beatTwo, beatThree},&#xD;
          &amp;#034;BeatLength&amp;#034; -&amp;gt; &#xD;
           Mean@Differences[{pickupBeatStart, beatOne, beatTwo, beatThree,&#xD;
               beatFour, beatFive}]&#xD;
          |&amp;gt;&#xD;
         ]&#xD;
       ];&#xD;
&#xD;
    anchorData0 = &#xD;
      Join[anchorDataOChristmasTree, anchorDataYourBoughsSoGreen] // &#xD;
       SortBy[#PickupBeat &amp;amp;];&#xD;
    meanBeatLength = Mean[anchorData0[[All, &amp;#034;BeatLength&amp;#034;]]];&#xD;
    &#xD;
    (* add enough beats to fill the end of the song, which ends on beat 2 *)&#xD;
    anchorData = &#xD;
      Append[anchorData0, &amp;lt;|&#xD;
        &amp;#034;TargetMeasureBeats&amp;#034; -&amp;gt; (lastBeat + {-1, 0, 1}*&#xD;
            Last[anchorData0][&amp;#034;BeatLength&amp;#034;]), &#xD;
        &amp;#034;BeatLength&amp;#034; -&amp;gt; Last[anchorData0][&amp;#034;BeatLength&amp;#034;]|&amp;gt;];&#xD;
    anchorData = &#xD;
      Append[anchorData, &amp;lt;|&#xD;
        &amp;#034;TargetMeasureBeats&amp;#034; -&amp;gt; (lastBeat + ({-1, 0, 1} + 3)*&#xD;
            Last[anchorData][&amp;#034;BeatLength&amp;#034;]), &#xD;
        &amp;#034;BeatLength&amp;#034; -&amp;gt; Last[anchorData][&amp;#034;BeatLength&amp;#034;]|&amp;gt;];&#xD;
&#xD;
Interpolate the beats between and during phrases:&#xD;
&#xD;
    interpolateAnchor = Apply[&#xD;
       Function[{currentAnchor, nextAnchor},&#xD;
        With[&#xD;
         {targetMeasureLastBeat = &#xD;
           Last[currentAnchor[&amp;#034;TargetMeasureBeats&amp;#034;]],&#xD;
          nextMeasureFirstBeat = &#xD;
           First[nextAnchor[&amp;#034;TargetMeasureBeats&amp;#034;]]},&#xD;
         DeleteDuplicates@Join[&#xD;
           currentAnchor[&amp;#034;TargetMeasureBeats&amp;#034;],&#xD;
           Range[targetMeasureLastBeat, &#xD;
            nextMeasureFirstBeat - currentAnchor[&amp;#034;BeatLength&amp;#034;]/4., &#xD;
            Mean[{currentAnchor[&amp;#034;BeatLength&amp;#034;], nextAnchor[&amp;#034;BeatLength&amp;#034;]}]]]&#xD;
         ]]];&#xD;
&#xD;
    measureBeats = Flatten@BlockMap[interpolateAnchor, anchorData, 2, 1];&#xD;
    measureBeats // Length&#xD;
&#xD;
&amp;gt; 144&#xD;
&#xD;
The beats vary slightly, which, if not taken into account with the anchoring method above, can cause phasing between the motion and the sound:&#xD;
&#xD;
    Histogram[Differences[measureBeats], PlotTheme -&amp;gt; &amp;#034;Detailed&amp;#034;, PlotRange -&amp;gt; Full]&#xD;
&#xD;
![enter image description here][34]&#xD;
&#xD;
        (* add pickup beat at start *)&#xD;
        &#xD;
        swayControlPoints = &#xD;
          Prepend[Join @@ (Partition[measureBeats, 3, 3, 1, {}] //&#xD;
              &#xD;
              MapIndexed[&#xD;
               Function[{times, index}, {#, (-1)^(Mod[index[[1]], 2] + 1)} &amp;amp; /@&#xD;
                  times]]), {firstBeat, -1}];&#xD;
    &#xD;
    swayControlPointPlot = &#xD;
      ListPlot[swayControlPoints, Joined -&amp;gt; True, Mesh -&amp;gt; All, &#xD;
       AspectRatio -&amp;gt; 1/6, PlotStyle -&amp;gt;&#xD;
        {Darker[Purple]}, PlotTheme -&amp;gt; &amp;#034;Detailed&amp;#034;, &#xD;
       MeshStyle -&amp;gt; PointSize[0.008], ImageSize -&amp;gt; 600, &#xD;
       Epilog -&amp;gt; {Darker[Green], Thick, &#xD;
         InfiniteLine[{{#, -1}, {#, 1}}] &amp;amp; /@ {firstBeat, secondBeat, &#xD;
           lastBeat}}];&#xD;
    &#xD;
    sway = BSplineFunction[&#xD;
       Join[{{0, 0}}, &#xD;
        Select[swayControlPoints, #[[1]] &amp;lt; tMax &amp;amp;], {{100, 0}}], &#xD;
       SplineDegree -&amp;gt; 3];&#xD;
    &#xD;
    sh = Show[{swayControlPointPlot, &#xD;
       ParametricPlot[sway[t], {t, 0, tMax}, PlotPoints -&amp;gt; 2500]}]&#xD;
&#xD;
![enter image description here][35]&#xD;
&#xD;
    {Show[sh, PlotRange -&amp;gt; {{0, 10}, All}], Show[sh, PlotRange -&amp;gt; {{90, 105}, All}]}&#xD;
&#xD;
![enter image description here][36]&#xD;
&#xD;
Now, a subtle point: Interpolating with B-splines gives nice smooth curves. In distinction to Interpolation, the actual given points are not on the resulting curve. This looks nice and smooth and is what we want for visual purposes of this animation. But the interpolation is for the pair of points. This means that for a given argument (between 0 and 1) of the B-spline function, ones does not get a linear interpolation with respect to the first argument. Rather, one has to invert the interpolation to get time as a function of the interpolation parameter variable. Taking this effect into account is important to properly align the music with the branch movements.&#xD;
&#xD;
    swayTimeCoordinate = Interpolation[Table[{t, sway[t/100][[1]]}, {t, 0, 100, 0.1}],  InterpolationOrder -&amp;gt; 1]&#xD;
&#xD;
![enter image description here][37]&#xD;
&#xD;
This plot shows the difference between the interpolation and the rescaled B-spline function parameter.&#xD;
&#xD;
    Plot[swayTimeCoordinate[t] - t, {t, 0, 100}]&#xD;
&#xD;
![enter image description here][38]&#xD;
&#xD;
    swayOfTime[t_] := sway[swayTimeCoordinate[t]/100][[2]]&#xD;
&#xD;
    Plot[swayOfTime[t], {t, 0, 10}]&#xD;
&#xD;
![enter image description here][39]&#xD;
&#xD;
Visualize the phrases and how they relate to the sway motion with Tooltip and colored rectangles:&#xD;
&#xD;
    phraseGraphics = BlockMap[&#xD;
       Apply[&#xD;
        Function[{currentAnchor, nextAnchor},&#xD;
         With[&#xD;
          {phraseStart = currentAnchor[&amp;#034;PickupBeat&amp;#034;],&#xD;
           phraseEnd = &#xD;
            nextAnchor[&amp;#034;PickupBeat&amp;#034;] - currentAnchor[&amp;#034;BeatLength&amp;#034;]},&#xD;
          {Switch[currentAnchor[&amp;#034;PhraseName&amp;#034;],&#xD;
            &amp;#034;O Christmas Tree&amp;#034;, Opacity[0.25, Gray],&#xD;
            &amp;#034;Your boughs so green in summertime&amp;#034;, &#xD;
            Opacity[0.25, Darker@Green],&#xD;
            _, Black],&#xD;
           Tooltip[&#xD;
            Polygon[&#xD;
             {{phraseStart, -10}, {phraseStart, 10}, {phraseEnd, &#xD;
               10}, {phraseEnd, -10}}],&#xD;
            Grid[{{currentAnchor[&amp;#034;PhraseName&amp;#034;], SpanFromLeft},&#xD;
              {&amp;#034;Phrase Start:&amp;#034;, phraseStart}, {&amp;#034;Phrase End:&amp;#034;, phraseEnd}&#xD;
              }]]}]]],&#xD;
       Append[anchorData0, &amp;lt;|&amp;#034;PickupBeat&amp;#034; -&amp;gt; lastBeat + meanBeatLength|&amp;gt;],&#xD;
        2, 1];&#xD;
&#xD;
    Show[swayControlPointPlot, &#xD;
     ParametricPlot[sway[t], {t, 0, Last[measureBeats]}, &#xD;
      ImageSize -&amp;gt; Full, PlotPoints -&amp;gt; 800, AspectRatio -&amp;gt; 1/8, &#xD;
      PlotTheme -&amp;gt; &amp;#034;Detailed&amp;#034;, PlotRangePadding -&amp;gt; Scaled[.02]], &#xD;
     Prolog -&amp;gt; phraseGraphics]&#xD;
&#xD;
![enter image description here][40]&#xD;
&#xD;
##Conductor  Movements##&#xD;
&#xD;
The conductor branch carries out a simple periodic movement that is synchronized to the music.&#xD;
&#xD;
    threePatternPoints = {{0, -1}, {-1, -0}, {0, 1}};&#xD;
    threePatternBackground = ListPlot[&#xD;
       MapIndexed[&#xD;
        Callout[#1, StringTemplate[&amp;#034;Beat #`` @ ``&amp;#034;][First@#2, #1], Left] &amp;amp;,&#xD;
        threePatternPoints],&#xD;
       PlotTheme -&amp;gt; &amp;#034;Minimal&amp;#034;, Axes -&amp;gt; False, AspectRatio -&amp;gt; 1,&#xD;
       PlotStyle -&amp;gt; Directive[Black, PointSize[0.025]],&#xD;
       PlotRange -&amp;gt; {{-2, 0.75}, {-1.5, 1.5}}];&#xD;
&#xD;
    conductorControlTimes = swayControlPoints[[All, 1]];&#xD;
    &#xD;
    (* basic conductor control points for interpolation *)&#xD;
    conductorControlPoints = &#xD;
      MapIndexed[{conductorControlTimes[[First[#2]]], #1} &amp;amp;, &#xD;
       Join @@ ConstantArray[RotateRight[threePatternPoints, 1], &#xD;
         Floor@(Length[conductorControlTimes]/3)]]; &#xD;
    &#xD;
    (* the shape is okay, but not perfect *)&#xD;
    &#xD;
    conductor = Interpolation[conductorControlPoints];&#xD;
    &#xD;
    (* adding pauses before/after the beat improves the shape of the &#xD;
       curves and makes the beats more obvious *)&#xD;
    conductorControlPointsWithPauses = &#xD;
      Join @@&#xD;
       ({# - {meanBeatLength/8., -0.15*&#xD;
              Normalize[&#xD;
               Mean[threePatternPoints] - #[[&#xD;
                 2]]]}, #, # + {meanBeatLength/8., &#xD;
             0.15*Normalize[&#xD;
               Mean[threePatternPoints] - #[[&#xD;
                 2]]]}} &amp;amp; /@&#xD;
                                    &#xD;
         conductorControlPoints); &#xD;
&#xD;
This time, I use Interpolation. &#xD;
&#xD;
    conductorWithPauses = &#xD;
      Interpolation[conductorControlPointsWithPauses, &#xD;
       InterpolationOrder -&amp;gt; 5];&#xD;
&#xD;
Here is the resulting shape of the baton.&#xD;
&#xD;
    Manipulate[&#xD;
     Show[threePatternBackground, &#xD;
      ParametricPlot[&#xD;
       conductorWithPauses[t], {t, &#xD;
        Max[firstBeat,(*tmax-2*meanBeatLength*)0], tmax},&#xD;
       PerformanceGoal -&amp;gt; &amp;#034;Quality&amp;#034;], &#xD;
      Epilog -&amp;gt; {Red, PointSize[Large], Point[conductorWithPauses[tmax]]},&#xD;
       ImageSize -&amp;gt; Large], {{tmax, lastBeat, &amp;#034;t&amp;#034;}, firstBeat + 0.0001, &#xD;
      lastBeat, Appearance -&amp;gt; &amp;#034;Labeled&amp;#034;},&#xD;
     SaveDefinitions -&amp;gt; True]&#xD;
&#xD;
![enter image description here][41]&#xD;
&#xD;
##Branch Movements from the Voices##&#xD;
&#xD;
There are various ways how the sound could be &amp;#039;translated&amp;#039; into movements of the branches. We will give two possibilities, one related to the frequency of the sounds, and another based on the onset of the notes. &#xD;
&#xD;
### Possibility 1###&#xD;
 &#xD;
First translation from voice to 2d movements: &#xD;
vertical movement: smoothed frequency of the voice&#xD;
horizontal movement: difference of current smoothed frequency of the voice to slightly earlier frequency&#xD;
&#xD;
    ?Delay = 0.3;&#xD;
    &#xD;
    voice??[j_][time_] := &#xD;
     If[0 &amp;lt; time &amp;lt; tMax,(* smoothing factor *) &#xD;
      Sin[Pi time/tMax]^0.25 {voiceFunction[j][1. time] - &#xD;
         voiceFunction[j][time - ?Delay],&#xD;
        voiceFunction[j][1. time]}, {0, 0}]&#xD;
    &#xD;
    ParametricPlot[voice??[1][t], {t, 0, tMax}, &#xD;
     AspectRatio -&amp;gt; 1, PlotRange -&amp;gt; All, Frame -&amp;gt; True, Axes -&amp;gt; False,&#xD;
     PlotStyle -&amp;gt; Thickness[0.002]]&#xD;
&#xD;
![enter image description here][42]&#xD;
&#xD;
###Possibility 2###&#xD;
&#xD;
First translation from voice to 2d movements: &#xD;
vertical movement: note changes&#xD;
horizontal movement: sway&#xD;
&#xD;
     value = -1;&#xD;
    interpolateDance[{{t1_, t2_}, {t3_, t4_}}, t_] :=&#xD;
      &#xD;
      With[{y1 = value, y2 = value = -value},&#xD;
       {{y1, t1 &amp;lt; t &amp;lt; t2}, {((y1 - y2) t - (t3 y1 - t2 y2))/(t2 - t3), &#xD;
         t2 &amp;lt; t &amp;lt; t3}}];&#xD;
    &#xD;
    dancingPositionPiecewise[notes : {__SoundNote}] := &#xD;
      With[{noteTimes = &#xD;
         Cases[notes, &#xD;
          SoundNote[_, times : {startTime_, endTime_}, ___] :&amp;gt; times]},&#xD;
       value = -1;&#xD;
       Quiet[Piecewise[&#xD;
         DeleteDuplicatesBy[&#xD;
          Join @@ BlockMap[interpolateDance[#, t] &amp;amp;, noteTimes, 2, 1], &#xD;
          Last], 0]&#xD;
        ]];&#xD;
    &#xD;
    tEnd = Max[voices[[All, All, 2]]];&#xD;
    dancingPositions = dancingPositionPiecewise /@ voices;&#xD;
    &#xD;
    Plot[Evaluate[KeyValueMap[Legended[#2, #1] &amp;amp;, dancingPositions]], {t, &#xD;
      0, 50},&#xD;
     PlotRangePadding -&amp;gt; Scaled[.05], PlotRange -&amp;gt; {All, {-1, 1}}, &#xD;
     ImageSize -&amp;gt; Large, PlotTheme -&amp;gt; &amp;#034;Detailed&amp;#034;, PlotLegends -&amp;gt; None]&#xD;
&#xD;
![enter image description here][43]&#xD;
&#xD;
    dancingPositionPiecewiseList = Normal[dancingPositions][[All, 2]];&#xD;
    &#xD;
    bsp = BSplineFunction[&#xD;
      Table[Evaluate[{t, dancingPositionPiecewiseList[[2]]}], {t, 0, 100, &#xD;
        0.2}]]&#xD;
&#xD;
![enter image description here][44]&#xD;
&#xD;
    ParametricPlot[bsp[t], {t, 0, 1}, AspectRatio -&amp;gt; 1/4, &#xD;
     PlotPoints -&amp;gt; 2000]&#xD;
&#xD;
![enter image description here][45]&#xD;
&#xD;
    Do[voiceIF[j] = &#xD;
      BSplineFunction[&#xD;
       Table[Evaluate[{t, dancingPositionPiecewiseList[[j]]}], {t, 0, 100,&#xD;
          0.2}]],&#xD;
     {j, 4}]&#xD;
    &#xD;
    Do[With[{j = j},&#xD;
      voiceTimeCoordinate[j] = &#xD;
       Interpolation[Table[{t, voiceIF[j][t/100][[1]]}, {t, 0, 100, 0.1}],&#xD;
         InterpolationOrder -&amp;gt; 1]],&#xD;
     {j, 4}]&#xD;
&#xD;
The final movements of the branch tips with the ?-? square [-1,1]*[-1,1].&#xD;
&#xD;
    Clear[voice??];&#xD;
    voice??[j_][time_] := &#xD;
     If[0 &amp;lt; time &amp;lt; tMax,(* smoothing factor *) Sin[Pi time/tMax]^0.25*&#xD;
       {sway[swayTimeCoordinate[time]/tMax][[2]], &#xD;
        voiceIF[j][voiceTimeCoordinate[j][time]/tMax][[2]]}, {0, 0}]&#xD;
    &#xD;
    Table[ListPlot[Table[ voice??[j][t], {t, 0, 105, 0.01}], &#xD;
      Joined -&amp;gt; True, AspectRatio -&amp;gt; 1, &#xD;
      PlotStyle -&amp;gt; Thickness[0.002]], {j, 4}]&#xD;
&#xD;
![enter image description here][46]&#xD;
&#xD;
#Model the Ornament Swings#&#xD;
&#xD;
Now it is time (finally) to do some physics. The ornaments (ball, five-star) I will model as a forced spherical pendulum with fraction. The forcing is realized through the position of branch tips, which in turn comes from the voice??[j][time].&#xD;
&#xD;
##Forced Spherical Pendulum##&#xD;
&#xD;
Form Lagrangian of a forced spherical pendulum in spherical coordinates.&#xD;
&#xD;
    Clear[r, ?, R, X, Y, Z]&#xD;
    R[t_] := {X[t], Y[t], Z[t]}&#xD;
    r[t_] := R[t] + &#xD;
      L {Cos[?[t]] Sin[?[t]], &#xD;
        Sin[?[t]] Sin[?[t]], -Cos[?[t]]}&#xD;
    ? = 1/2 r&amp;#039;[t].r&amp;#039;[t] - g r[t][[3]]&#xD;
&#xD;
&amp;gt; -g (-L Cos[?[t]] + Z[t]) +   1/2 ((Derivative[1][Z][t] + &#xD;
&amp;gt;       L Sin[?[t]] Derivative[1][?][t])^2 + (Derivative[&#xD;
&amp;gt;        1][Y][t] + &#xD;
&amp;gt;       L Cos[?[t]] Sin[?[t]] Derivative[1][?][t] + &#xD;
&amp;gt;       L Cos[?[t]] Sin[?[t]] Derivative[1][?][&#xD;
&amp;gt;         t])^2 + (Derivative[1][X][t] + &#xD;
&amp;gt;       L Cos[?[t]] Cos[?[t]] Derivative[1][?][t] - &#xD;
&amp;gt;       L Sin[?[t]] Sin[?[t]] Derivative[1][?][t])^2)&#xD;
&#xD;
Add a Rayleigh dissipation function ? to account for friction.&#xD;
&#xD;
    ? = 1/2 (\[ScriptF]? ?&amp;#039;[t]^2 + \[ScriptF]?  ?&amp;#039;[t]^2);&#xD;
    &#xD;
    eoms = {D[D[?, ?&amp;#039;[t]], t] - &#xD;
    D[?, ?[t]] == -D[?, ?&amp;#039;[t]],&#xD;
    &#xD;
    D[D[?, ?&amp;#039;[t]], t] - &#xD;
    D[?, ?[t]] == -D[?, ?&amp;#039;[&#xD;
    t]]} // Simplify&#xD;
    &#xD;
&#xD;
&amp;gt; {(\[ScriptF]? +  L^2 Sin[2 ?[t]] Derivative[1][?][t]) Derivative[&#xD;
&amp;gt; 1][?][t] +  L Sin[?[t]] (-Sin[?[t]] (X^??)[t] +  Cos[?[t]] (Y^??)[t] +&#xD;
&amp;gt; L Sin[?[t]] (?^??)[t]) ==  0, \[ScriptF]? Derivative[1][?][t] +  L (g&#xD;
&amp;gt; Sin[?[t]] -  L Cos[?[t]] Sin[?[t]] Derivative[1][?][t]^2 +  Cos[?[t]]&#xD;
&amp;gt; Cos[?[t]] (X^??)[t] +  Cos[?[t]] Sin[?[t]] (Y^??)[t] +  Sin[?[t]]&#xD;
&amp;gt; (Z^??)[t] +  L (?^??)[t]) == 0}&#xD;
&#xD;
Example showing that the oscillations die out quickly with appropriate parameter values of \[ScriptF]?, \[ScriptF]?.&#xD;
&#xD;
     paramRules = { g -&amp;gt; 10, &#xD;
       L -&amp;gt; 1, \[ScriptF]? -&amp;gt; 1, \[ScriptF]? -&amp;gt; 1};&#xD;
    &#xD;
    In[126]:= X[t_] := If[2 Pi &amp;lt; t &amp;lt; 4 Pi, 8 Cos[t], 8];&#xD;
    Y[t_] := If[2 Pi &amp;lt; t &amp;lt; 4 Pi, 4 Sin[t], 0];&#xD;
    Z[t_] := 0; &#xD;
    &#xD;
    nds = NDSolve[{eoms /. paramRules, ?[0] == 1, ?&amp;#039;[0] == &#xD;
        0, ?[0] == 0.001, ?&amp;#039;[0] == 0},&#xD;
      {?, ?}, {t, 0, 20}, PrecisionGoal -&amp;gt; 3, AccuracyGoal -&amp;gt; 3] &#xD;
&#xD;
![enter image description here][47]&#xD;
&#xD;
    Plot[Evaluate[{\[Phi][t], \[Theta][t]} /. nds[[1]]], {t, 0, &#xD;
      nds[[1, 2, 2, 1, 1, 2]]}, PlotRange -&amp;gt; All]&#xD;
&#xD;
![enter image description here][48]&#xD;
&#xD;
    Graphics3D[&#xD;
     Table[With[{P = r[t] - R[t] /. nds[[1]] /. paramRules}, {Black, &#xD;
        Sphere[{0, 0, 0}, 0.02], Gray, Cylinder[{{0, 0, 0}, P}, 0.005],&#xD;
        Darker[Blue], Sphere[P, 0.02]}],&#xD;
      {t, 0, 20, 0.05}], PlotRange -&amp;gt; All]&#xD;
&#xD;
![enter image description here][49]&#xD;
&#xD;
##Calculate Ornament Movements##&#xD;
&#xD;
Get the ? and ? direction of the branch tip positions interpolated as a function of time.&#xD;
&#xD;
    branchToVoice = &#xD;
     Association[&#xD;
      Flatten[Function[{v, bs}, (# -&amp;gt; v) &amp;amp; /@  bs] @@@ &#xD;
        Normal[voiceBranches]]]&#xD;
&#xD;
&amp;gt; &amp;lt;|2 -&amp;gt; 1, 9 -&amp;gt; 1, 14 -&amp;gt; 1, 17 -&amp;gt; 1, 19 -&amp;gt; 1, 24 -&amp;gt; 1, 27 -&amp;gt; 1, 3 -&amp;gt; 2,&#xD;
&amp;gt; 13 -&amp;gt; 2, 15 -&amp;gt; 2, 16 -&amp;gt; 2, 21 -&amp;gt; 2, 26 -&amp;gt; 2, 1 -&amp;gt; 3, 4 -&amp;gt; 3, 5 -&amp;gt; 3,  &#xD;
&amp;gt; 12 -&amp;gt; 3, 18 -&amp;gt; 3, 20 -&amp;gt; 3, 6 -&amp;gt; 4, 8 -&amp;gt; 4, 10 -&amp;gt; 4, 11 -&amp;gt; 4,   22 -&amp;gt;&#xD;
&amp;gt; 4, 23 -&amp;gt; 4, 25 -&amp;gt; 4|&amp;gt;&#xD;
&#xD;
    tValues = Table[1. t , {t, -5, 110, 0.1}];&#xD;
    Do[??Values = &#xD;
      Table[voice??[j][t] , {t, -5, 110, 0.1}];&#xD;
     if?[j] = &#xD;
      Interpolation[&#xD;
       Transpose[{tValues, ??Values[[All, 1]]}]];&#xD;
     if?[j] = &#xD;
      Interpolation[&#xD;
       Transpose[{tValues, ??Values[[All, 2]]}]],&#xD;
     {j, 4}]&#xD;
&#xD;
Calculate the movement of the ornaments modeled as spherical pendula. To get some variation in the movements, I use small random deviations from the vertical as initial conditions for the ornaments (modeling some random thermal air movements).&#xD;
&#xD;
For a time range in the second half, I use a different amplitude (corresponding to louder music) for the forcing amplitudes.&#xD;
&#xD;
    changeTimeList = {17.6, 42.2, 66.8, 83.1};&#xD;
&#xD;
    loudness[t_] :=&#xD;
     &#xD;
     With[{?1 = 0.2, ?2 = 0.8, ?t = 1.5},&#xD;
       Which[t &amp;lt;= changeTimeList[[3]] - ?t, ?1,&#xD;
            changeTimeList[[3]] - ?t &amp;lt;= t &amp;lt;= &#xD;
        changeTimeList[[3]] + ?t, &#xD;
                   ?1 + (?2 - &#xD;
           1 ?1) (1 - &#xD;
            Cos[Pi (t - (changeTimeList[[&#xD;
                    3]] - ?t))/(2 ?t)])/2,&#xD;
                   &#xD;
       changeTimeList[[3]] + ?t &amp;lt;= t &amp;lt;=  &#xD;
        changeTimeList[[4]] - ?t , ?2,&#xD;
                   &#xD;
       changeTimeList[[4]] - ?t &amp;lt;= t &amp;lt;= &#xD;
        changeTimeList[[4]] + ?t,&#xD;
                   ?1 + (?2 - &#xD;
           1 ?1) (1 + &#xD;
            Cos[Pi (t - (changeTimeList[[&#xD;
                    4]] - ?t))/(2 ?t)])/2,&#xD;
                   t &amp;gt;= changeTimeList[[3]] + 1.5, ?1]&#xD;
      ]   &#xD;
&#xD;
    Plot[loudness[t], {t, 1, 100}, AxesOrigin -&amp;gt; {0, 0}, PlotRange -&amp;gt; All]&#xD;
&#xD;
![enter image description here][50]&#xD;
&#xD;
    Off[General::stop]; &#xD;
    SeedRandom[111];&#xD;
    &#xD;
    Monitor[ &#xD;
     Do[ &#xD;
      branchEnd[j, {?_, ?_}] = &#xD;
       branchOnStemEndPoint[ allBranches[[j]], {?, ?}]; &#xD;
      If[j =!= conductorBranch,&#xD;
       With[{v = branchToVoice[j]}, &#xD;
        tipPosition[t_] = &#xD;
         branchEnd[j, loudness[t] {if?[v][t], if?[v][t]}]]; &#xD;
                {X[t_], Y[t_], Z[t_] } = tipPosition[t]; &#xD;
       paramRules = { g -&amp;gt; 20, &#xD;
         L -&amp;gt; 1, \[ScriptF]? -&amp;gt; 1, \[ScriptF]? -&amp;gt; 1};&#xD;
       While[ Check[&#xD;
          pendulum??[j][t_] =&#xD;
           NDSolveValue[{eoms /. paramRules, &#xD;
             ?[0] == RandomReal[{-Pi, Pi}], ?&amp;#039;[0] == &#xD;
              0.01 RandomReal[{-1, 1}], &#xD;
             ?[0] == 0.01 RandomReal[{-1, 1}], ?&amp;#039;[0] == &#xD;
              0.01 RandomReal[{-1, 1}]},&#xD;
            {?[t], ?[t]}, {t, 0, 105}, PrecisionGoal -&amp;gt; 4, &#xD;
            AccuracyGoal -&amp;gt; 4,&#xD;
             MaxStepSize -&amp;gt; 0.01, MaxSteps -&amp;gt; 100000, Method -&amp;gt; &amp;#034;BDF&amp;#034;]; &#xD;
          False, True]] // Quiet],&#xD;
      {j, Length[allBranches]}], j]&#xD;
&#xD;
Here are the spherical coordinate angles for a randomly selected ornament. We see the increase in oscillation amplitude when the loud music sets in.&#xD;
&#xD;
    Plot[pendulum\[Phi]\[Theta][51][t][[2]], {t, 0, 105}, &#xD;
     AspectRatio -&amp;gt; 1/4, PlotRange -&amp;gt; All]&#xD;
&#xD;
![enter image description here][52]&#xD;
&#xD;
#The Swaying Christmas Tree#&#xD;
&#xD;
Add some colors for the 5-stars.&#xD;
&#xD;
    SeedRandom[11];&#xD;
    Do[randomColor[j] = RandomColor[];&#xD;
         randomAngle[j] = RandomReal[{-Pi/2, Pi/2}],&#xD;
     {j, Length[allBranches]}]&#xD;
&#xD;
Fast vertical start and slow end of the conductor movements.&#xD;
&#xD;
        conductor??[t_] :=&#xD;
          Piecewise[&#xD;
          {{{0, 0}, &#xD;
            t &amp;lt;= firstBeat/&#xD;
              2},  {(t - firstBeat/2)/(firstBeat/2) conductorControlPointsWithPauses[[&#xD;
              1, 2]], firstBeat/2 &amp;lt; t &amp;lt;= firstBeat},  {conductorWithPauses[t],  &#xD;
            firstBeat &amp;lt; t &amp;lt;= &#xD;
             lastBeat},  {(tMax - t)/(tMax - &#xD;
                lastBeat) conductorControlPointsWithPauses[[-1, 2]],  &#xD;
            lastBeat &amp;lt; t &amp;lt; tMax}, &#xD;
           {{0, 0}, t &amp;gt;= tMax}}]&#xD;
    &#xD;
The  onset of the conductor movements.&#xD;
&#xD;
    &#xD;
        ListPlot[{Table[{t, conductor??[t][[1]]}, {t, -1, 3, 0.01}],&#xD;
          Table[{t, conductor??[t][[2]]}, {t, -1, 3, 0.01}]}, &#xD;
         PlotRange -&amp;gt; All, Joined -&amp;gt; True]&#xD;
    &#xD;
![enter image description here][53]&#xD;
&#xD;
    &#xD;
        With[{animationType = 2},&#xD;
         scalefactors[1][t_] := &#xD;
          Switch[animationType, 1, {0.8, 1} , 2, loudness[t]];&#xD;
         scalefactors[2][t_] := &#xD;
          Switch[animationType, 1, {1, 1} , 2, loudness[t]];&#xD;
         scalefactors[3][t_] := &#xD;
          Switch[animationType, 1, {1, 1} , 2, loudness[t]];&#xD;
         scalefactors[4][t_] := &#xD;
          Switch[animationType, 1, {1, 1} , 2, loudness[t]]&#xD;
         ] &#xD;
    &#xD;
    christmasTreeWithSwingingOrnaments[t_, &#xD;
      conductorEnhancementFactor : fc_,  &#xD;
      conductorCandleAngle : ?c_, topRotationAngle : ?_, &#xD;
      opts___] := &#xD;
     Graphics3D[{{Darker[Brown], stem}, &#xD;
       (* first voice *)&#xD;
       branchOnStemWithBall[allBranches[[#]],&#xD;
          scalefactors[1][t] voice??[1][t], &#xD;
          Darker[Yellow, -0.1],&#xD;
          If[t &amp;lt; 0, {0, 0}, pendulum??[#][t]]] &amp;amp; /@ &#xD;
        voiceBranches[[1]],&#xD;
       (* second voice *)&#xD;
       &#xD;
       branchOnStemWithBall[allBranches[[#]], &#xD;
          scalefactors[2] [t] voice??[2][t], &#xD;
          Blend[{Red, Pink}], &#xD;
          If[t &amp;lt; 0, {0, 0}, pendulum??[#][t]]] &amp;amp; /@ &#xD;
        voiceBranches[[2]],&#xD;
       (* third voice *)&#xD;
       &#xD;
       branchOnStemWithFiveStar[allBranches[[#]], &#xD;
          scalefactors[3][t] voice??[3][t], randomColor[#], &#xD;
          Pi/4, If[t &amp;lt; 0, {0, 0}, pendulum??[#][t]]] &amp;amp; /@ &#xD;
        voiceBranches[[3]], &#xD;
       (* fourth voice *)&#xD;
       &#xD;
       branchOnStemWithCandle[#, &#xD;
          scalefactors[4][t] voice??[4][t], &#xD;
          Directive[White, Glow[GrayLevel[0.3]], Specularity[Yellow, 20]],&#xD;
           0] &amp;amp; /@ allBranches[[voiceBranches[[4]]]], &#xD;
       (* conductor *)&#xD;
       &#xD;
       branchOnStemWithCandle[&#xD;
        allBranches[[conductorBranch]] {1, 1, 1 + fc}, &#xD;
        conductor??[t], &#xD;
        Directive[Red, Glow[GrayLevel[0.1]],  &#xD;
         Specularity[Yellow, 20]], ?c],&#xD;
       Rotate[top, ?, {0, 0, 1}]&#xD;
       }, opts, ViewPoint -&amp;gt; {2.8, 1.79, 0.1}, &#xD;
      PlotRange -&amp;gt; {{-8, 8}, {-8, 8}, {-2, 15}},&#xD;
      Background -&amp;gt; RGBColor[0.998, 1., 0.867] ]&#xD;
&#xD;
Use a low view point as trees are normally larger than humans.&#xD;
&#xD;
    Show[christmasTreeWithSwingingOrnaments[70, 0.5,  0.8, 2], &#xD;
     PlotRange -&amp;gt; All, Boxed -&amp;gt; False]&#xD;
&#xD;
![enter image description here][54]&#xD;
&#xD;
#Let It Snow! #&#xD;
&#xD;
Some snow is is a must-be for a classic (white) Christmas. So, let&amp;#039;s build some 3D snowflakes and then them fall down. Rather than solving PDEs ([http://psoup.math.wisc.edu/papers/h3l.pdf][55]), we will just use cellular automata on hexagonal grids to generate some snowflake-like shapes with hexagonal symmetry.&#xD;
&#xD;
##Snowflake shapes (2D)##&#xD;
&#xD;
Let&amp;#039;s borrow some code from Ed Pegg&amp;#039;s demonstration [Snowflake-Like Patterns][56]. I just import the notebook and programmatically extract the relevant cells that define the variables hex and snowflake.&#xD;
&#xD;
    ReleaseHold /@ (MakeExpression[#[[1]], StandardForm] &amp;amp; /@ &#xD;
        Take[Cases[&#xD;
          Import[&amp;#034;http://demonstrations.wolfram.com/downloadauthornb.cgi?\&#xD;
    name=SnowflakeLikePatterns&amp;#034;], Cell[_, &amp;#034;Input&amp;#034;, ___], ?], 2]);&#xD;
    &#xD;
    makeSnowflake[rule_, steps_] := &#xD;
     Polygon[hex[#] &amp;amp; /@ Select[Position[Reverse[CellularAutomaton[&#xD;
           {snowflakes[[&#xD;
             rule]], {2, {{0, 2, 2}, {2, 1, 2}, {2, 2, 0}}}, {1, &#xD;
             1}}, {{{1}}, &#xD;
            0}, {{{steps}}, {-steps, steps}, {-steps, steps}}]], &#xD;
         0], -steps - 1 &amp;lt; -#[[1]] + #[[2]] &amp;lt; steps + 1 &amp;amp;]] &#xD;
    &#xD;
    SeedRandom[33];&#xD;
    Table[Graphics[{Darker[Blue], &#xD;
       makeSnowflake[RandomInteger[{1, 3888}], &#xD;
        RandomInteger[{10, 60}]]}], {4}]&#xD;
&#xD;
![enter image description here][57]&#xD;
&#xD;
As some of snowflakes are disconnected, I select the ones that are interesting. I am also only are interested in snowflakes that are sufficiently complex.&#xD;
&#xD;
    denseFlakeQ[mr_MeshRegion] :=&#xD;
     &#xD;
     With[{c = RegionCentroid[mr], pts = MeshCoordinates[mr]},&#xD;
               ( Divide @@ MinMax[EuclideanDistance[c, #] &amp;amp; /@ pts]) &amp;lt; 1/3]&#xD;
    &#xD;
    randomSnowflakes[] := &#xD;
     Module[{sf},&#xD;
      While[(sf = Module[{},&#xD;
           TimeConstrained[&#xD;
            hexagons = &#xD;
             makeSnowflake[RandomInteger[{1, 3888}], &#xD;
              RandomInteger[{10, 60}]];&#xD;
            (Select[ConnectedMeshComponents[DiscretizeRegion[hexagons]], &#xD;
                (Area[#] &amp;gt; 120 &amp;amp;&amp;amp; Perimeter[#]/Area[#] &amp;lt; 2 &amp;amp;&amp;amp; &#xD;
                   denseFlakeQ[#]) &amp;amp;] /.&#xD;
               \&#xD;
    _ConnectedMeshComponents :&amp;gt; {}) // Quiet, 20, {}]]) === {}]; sf]&#xD;
    &#xD;
    randomSnowflakes[n_] :=  &#xD;
     Take[NestWhile[Join[#, randomSnowflakes[]] &amp;amp;, {}, Length[#] &amp;lt; n &amp;amp;], n]&#xD;
    &#xD;
    SeedRandom[22];&#xD;
    randomSnowflakes[4]&#xD;
&#xD;
![enter image description here][58]&#xD;
&#xD;
    normalizeFlake[mr_MeshRegion] := &#xD;
     Module[{coords, center, coords1, size, coords2},&#xD;
      coords = MeshCoordinates[mr];&#xD;
      center = Mean[coords];&#xD;
      coords1 = (# - center) &amp;amp; /@ coords;&#xD;
      size = Max[Norm /@ coords1];&#xD;
      coords2 = coords1/size;&#xD;
      GraphicsComplex[coords2, {EdgeForm[], MeshCells[mr, 2]}]]&#xD;
&#xD;
Here are five flakes for further use.&#xD;
&#xD;
![enter image description here][59]&#xD;
&#xD;
##3D Snowflake shapes ##&#xD;
&#xD;
I extrude the 2D snowflakes to get 3D snowflakes.&#xD;
&#xD;
    make3DFlake[flake2D_] := &#xD;
     Module[{grc, reg, boundary, h, bc, rb, polys, pts},&#xD;
           grc = flake2D[[1]];&#xD;
           reg = MeshRegion @@ (grc /. _EdgeForm :&amp;gt; Nothing);&#xD;
                &#xD;
      boundary = (MeshPrimitives[#, 1] &amp;amp;@RegionBoundary[reg])[[All, 1]];&#xD;
                h = RandomReal[{0.05, 0.15}];&#xD;
           bc = &#xD;
       Join[#1, Reverse[#2]] &amp;amp; @@@ &#xD;
        Transpose[{Map[Append[#, 0] &amp;amp;, boundary, {-2}], &#xD;
          Map[Append[#, h] &amp;amp;, boundary, {-2}]}];&#xD;
          rb = RegionBoundary[reg];&#xD;
          boundary = (MeshCells[#, 1] &amp;amp;@rb)[[All, 1]];&#xD;
          polys = &#xD;
       Polygon[Join[#1, Reverse[#2]] &amp;amp; @@@ &#xD;
         Transpose[{boundary, boundary + Max[boundary]}]];&#xD;
          pts = &#xD;
       Join[Append[#, 0] &amp;amp; /@ MeshCoordinates[rb], &#xD;
        Append[#, h] &amp;amp; /@ MeshCoordinates[rb]];&#xD;
      {GraphicsComplex[Developer`ToPackedArray[pts], polys],&#xD;
       MapAt[Developer`ToPackedArray[Append[#, 0]] &amp;amp; /@ # &amp;amp;, flake2D[[1]],&#xD;
         1],&#xD;
       MapAt[Developer`ToPackedArray[Append[#, h]] &amp;amp; /@ # &amp;amp;, flake2D[[1]],&#xD;
         1]}&#xD;
      ]&#xD;
&#xD;
    listOfSnowflakes3D = make3DFlake /@ listOfSnowflakes;&#xD;
    &#xD;
    Graphics3D[{EdgeForm[], #}, Boxed -&amp;gt; False, &#xD;
       Method -&amp;gt; {&amp;#034;ShrinkWrap&amp;#034; -&amp;gt; True}, ImageSize -&amp;gt; 120, &#xD;
       Lighting -&amp;gt; {{&amp;#034;Ambient&amp;#034;, Hue[.58, .5, 1]}, {&amp;#034;Directional&amp;#034;, &#xD;
          GrayLevel[.3], ImageScaled[{1, 1, 0}]}}] &amp;amp; /@ listOfSnowflakes3D&#xD;
&#xD;
![enter image description here][60]&#xD;
&#xD;
##Model of a falling sheet##&#xD;
&#xD;
A simple 2D model of falling sheets was given by [Tanabe and Kaneko][61] in 1994. So, to get some intuition about possible fall shapes, we implement the model as an interactive demonstration.&#xD;
&#xD;
    Manipulate[ &#xD;
     Module[{eqs, nds, tmax, g = 10, ?, sign, V, x, y, u, &#xD;
       v, ?, ?, kpar = kperp/f, ? = 10^?exp},&#xD;
      ? = ArcTan[u[t], v[t]];&#xD;
      sign = Piecewise[{{1, (v[t] &amp;lt; 0 &amp;amp;&amp;amp; &#xD;
             0 &amp;lt;= ? + ?[t] &amp;lt;= Pi) || (v[t] &amp;gt; &#xD;
              0 &amp;amp;&amp;amp; -Pi &amp;lt;= ? + ?[t] &amp;lt;= 0)}}, -1];&#xD;
      V = Sqrt[u[t]^2 + v[t]^2];&#xD;
      eqs =&#xD;
       {D[x[t], t] == u[t],&#xD;
         D[y[t], t] == v[t],&#xD;
         D[u[t], &#xD;
           t] == -(kperp Sin[?[t]]^2 + kpar Cos[?[t]]^2) u[&#xD;
             t] +&#xD;
                                   (kperp - kpar) Sin[?[&#xD;
              t]] Cos[?[t]] v[t] -&#xD;
                                     &#xD;
           sign Pi ? V^2 Cos[? + ?[t]] Cos[?],&#xD;
         D[v[t], &#xD;
           t] == -(kperp Cos[?[t]]^2 + kpar Sin[?[t]]^2) v[&#xD;
             t] +&#xD;
                                   (kperp - kpar) Sin[?[&#xD;
              t]] Cos[?[t]] u[t] +&#xD;
                                     &#xD;
           sign Pi ?  V^2 Cos[? + ?[&#xD;
               t]] Sin[?] - g,&#xD;
         D[?[t], &#xD;
           t] == -kperp ?[&#xD;
             t] - (3 Pi ? V^2/l) Cos[? + ?[&#xD;
               t]] Sin[? + ?[t]],&#xD;
         D[?[t], t] == ?[t]} /. kpar -&amp;gt; kperp/f; &#xD;
      nds = NDSolve[&#xD;
         Join[eqs, {x[0] == 0, y[0] == 0, u[0] == 0, &#xD;
           v[0] == 0.01, ?[0] == 0, ?[0] == ?0}],&#xD;
                                {x, y, u, v, ?, ?}, {t, 0, &#xD;
          T}, MaxSteps -&amp;gt; 2000] // Quiet; &#xD;
      tmax = nds[[1, 2, 2, 1, 1, 2]]; &#xD;
      Graphics[{Thickness[0.002], Gray,&#xD;
                          &#xD;
        Table[Evaluate[&#xD;
          Line[{{x[t], y[t]} - l/2 {Cos[?[t]], Sin[?[t]]},&#xD;
                                                                    {x[t],&#xD;
                y[t]} + l/2 {Cos[?[t]], Sin[?[t]]}}] /. &#xD;
           nds[[1]]],&#xD;
                                           {t, 0, tmax, tmax/n}],&#xD;
                           Blue, &#xD;
        Line[Table[&#xD;
          Evaluate[{x[t], y[t]} /. nds[[1]]], {t, 0, tmax, tmax/200}]]},&#xD;
                            AspectRatio -&amp;gt; ar, Frame -&amp;gt; True, &#xD;
       PlotRange -&amp;gt; All]],&#xD;
     &amp;#034;system parameters&amp;#034;,&#xD;
     {{kperp, 5.1, Subscript[&amp;#034;k&amp;#034;, &amp;#034;?&amp;#034;]}, 0.01, 10, &#xD;
      Appearance -&amp;gt; &amp;#034;Labeled&amp;#034;},&#xD;
     {{f, 145, &#xD;
       Row[{Subscript[&amp;#034;k&amp;#034;, &amp;#034;?&amp;#034;], &amp;#034;/&amp;#034;, &#xD;
         Subscript[&amp;#034;k&amp;#034;, &amp;#034;?&amp;#034;]}]}, 0.01, 200, &#xD;
      Appearance -&amp;gt; &amp;#034;Labeled&amp;#034;},&#xD;
     {{?exp, -0.45, Log[&amp;#034;?&amp;#034;]}, -3, 1, Appearance -&amp;gt; &amp;#034;Labeled&amp;#034;},&#xD;
     {{l, 0.63}, 0.01, 10, Appearance -&amp;gt; &amp;#034;Labeled&amp;#034;} ,&#xD;
     Delimiter,&#xD;
     &amp;#034;fall parameters&amp;#034;,&#xD;
     {{?0, 1, Subscript[&amp;#034;?&amp;#034;, &amp;#034;0&amp;#034;]}, -Pi, Pi, &#xD;
      Appearance -&amp;gt; &amp;#034;Labeled&amp;#034;},&#xD;
     {{T, 2, &amp;#034;falling time&amp;#034;}, 0, 10, Appearance -&amp;gt; &amp;#034;Labeled&amp;#034;} ,&#xD;
     Delimiter,&#xD;
     &amp;#034;plot&amp;#034;,&#xD;
     {{ar, 1, &amp;#034;aspect ratio&amp;#034;}, {1, Automatic}},&#xD;
     {{n, 200, &amp;#034;snapshots&amp;#034;}, 2, 500, 1}]&#xD;
&#xD;
![enter image description here][62]&#xD;
&#xD;
I will model the falling process phenomenologically and heuristically rather than through the differential equation solution. With the density values of snowflakes and air, together with their thickness/area ratio they fall mostly straight down, with some small lateral movements and internal rotations.&#xD;
&#xD;
##Falling Snowflakes##&#xD;
&#xD;
Model internal rotations about the center of mass as well as some small lateral movements.&#xD;
&#xD;
    randomParametrizedRotationMatrix[n_, ?_] := Function @@ {?,&#xD;
        Module[{phi, s, c},&#xD;
                &#xD;
         Do[phi[i] =  &#xD;
           Sum[RandomReal[{-1, 1}] Sin[&#xD;
              RandomReal[{0, n}] ? + 2 Pi RandomReal[]], {n}];&#xD;
                   {c[i], s[i]} = {Cos[phi[i]], Sin[phi[i]]}, {i, 3}];&#xD;
                {{c[1], s[1], 0}, {-s[1], c[1], 0}, {0, 0, 1}}.&#xD;
                 {{c[2], 0, s[2]}, {0, 1, 0}, {-s[2], 0, c[2]}}.&#xD;
                 {{1, 0, 0}, {0, c[3], s[3]}, {0, -s[3], c[3]}}]};&#xD;
    &#xD;
    randomParametrizedPathFunction := Function[t,&#xD;
      Evaluate[{RandomReal[{-5, 5}] + &#xD;
         Sum[RandomReal[{-1, 1}]/# Cos[2 Pi # t] &amp;amp;[&#xD;
           RandomReal[{1, 4}]], {k, 5}], &#xD;
                          &#xD;
        RandomReal[{-5, 5}] + &#xD;
         Sum[RandomReal[{-1, 1}]/# Cos[2 Pi # t] &amp;amp;[&#xD;
           RandomReal[{1, 4}]], {k, 5}], &#xD;
                          RandomReal[{2, 12}] - RandomReal[{1.5, 2.5}] t}]]&#xD;
    &#xD;
    SeedRandom[55];&#xD;
    Do[rotMat[j] = randomParametrizedRotationMatrix[3, ?];&#xD;
          trans[j] = randomParametrizedPathFunction;&#xD;
          snowflakeColor[&#xD;
       j] = {{&amp;#034;Ambient&amp;#034;, &#xD;
        Hue[RandomReal[{0.55, 0.6}], RandomReal[{0.48, 0.52}], &#xD;
         RandomReal[{0.95, 1}]]}, {&amp;#034;Directional&amp;#034;, &#xD;
        GrayLevel[RandomReal[{0.28, 0.32}]], &#xD;
        ImageScaled[{1, 1, 0}]}}, {j, Length[listOfSnowflakes]}]&#xD;
    &#xD;
    fallingSnowflake[flake_, {t_, ?_}] := &#xD;
     flake /. GraphicsComplex[cs_, rest__] :&amp;gt; &#xD;
       GraphicsComplex[(?.# + t) &amp;amp; /@ cs, rest]&#xD;
    &#xD;
    Manipulate[&#xD;
     Graphics3D[{EdgeForm[],&#xD;
       Table[{Lighting -&amp;gt; snowflakeColor[k], &#xD;
         fallingSnowflake[&#xD;
          listOfSnowflakes3D[[k]], {trans[k][t], rotMat[k][t]}]}, {k, &#xD;
         Length[listOfSnowflakes3D]}] },&#xD;
      PlotRange -&amp;gt; 6, ViewPoint -&amp;gt; {0, -10, 0}, ImageSize -&amp;gt; 400],&#xD;
     {{t, 3.2}, -5, 20}]&#xD;
&#xD;
![enter image description here][63]&#xD;
&#xD;
For the full animation a few hundred snowflakes were used. &#xD;
&#xD;
#Making the Animation Frames#&#xD;
&#xD;
Now start the animation by extending the conductor branch and also rotate the top while the music is playing. Then, we will listen and view one verse. Then, we will move once around the tree and have some snowfall. And then comes the wild part where the tree swings its ornaments ecstatically around before calming down and retracts its conductor branch.&#xD;
I generate 24 frames for each second of sound.&#xD;
&#xD;
    conductorBranchMaxfactor = 0.5;&#xD;
    conductorBranchLength[t_] := &#xD;
      conductorBranchMaxfactor*&#xD;
       Which[t &amp;lt; -3, 0, -3 &amp;lt; t &amp;lt;= 0, (t + 3)/3., 0 &amp;lt;= t &amp;lt;= tMax, 1, &#xD;
        tMax &amp;lt; t &amp;lt; tMax + 3, (1 - (t - tMax)/3), True, 0];&#xD;
    &#xD;
    topRotation[t_] := &#xD;
      Which[t &amp;lt; -3 || t &amp;gt; tMax + 3, 0, &#xD;
       True, (1. - Cos[(t + 3)/(tMax + 6)]) 20 2 Pi];&#xD;
    &#xD;
    viewPoint[t_] := &#xD;
     With[{vp = {2.8, 1.79, 0.1}},&#xD;
      Which[t &amp;lt; changeTimeList[[1]] || t &amp;gt; changeTimeList[[2]], vp,&#xD;
                  changeTimeList[[1]] &amp;lt;= t &amp;lt;= changeTimeList[[2]],&#xD;
                  Module[{t0 = changeTimeList[[1]], &#xD;
                                 ?t = &#xD;
          changeTimeList[[2]] - changeTimeList[[1]], ?vp},&#xD;
                   ?vp = -Pi (1 - &#xD;
            Cos[ Pi (t - t0)/?t]); {{Cos[?vp], &#xD;
            Sin[?vp], 0}, {-Sin[?vp], Cos[?vp], &#xD;
            0}, {0, 0, 1}}.vp +&#xD;
             {0, 0, 2 Sin[Pi (t - t0)/?t]^4 }]]] &#xD;
    &#xD;
    ParametricPlot3D[&#xD;
     viewPoint[t], {t, changeTimeList[[1]], changeTimeList[[2]]}, &#xD;
     BoxRatios -&amp;gt; {1, 1, 1}]&#xD;
&#xD;
![enter image description here][64]&#xD;
&#xD;
    animationFrame[t_] := &#xD;
     Show[christmasTreeWithSwingingOrnaments[t, conductorBranchLength[t], &#xD;
       1.4 conductorBranchLength[t], topRotation[t]],&#xD;
      Background -&amp;gt; None, Boxed -&amp;gt; False, SphericalRegion -&amp;gt; True, &#xD;
      ViewPoint -&amp;gt; viewPoint[t]]&#xD;
&#xD;
A last test before running the export of the frames that will take a few hours:&#xD;
&#xD;
        animationFrame[35]&#xD;
    &#xD;
![enter image description here][65]&#xD;
&#xD;
    &#xD;
    framesPerSecond = 24;&#xD;
    animationFrameDirectory = &#xD;
      &amp;#034;/Users/mtrott/Desktop/ConductingChristmasTreeAnimationFrames/&amp;#034;;&#xD;
    &#xD;
    Monitor[&#xD;
     Do[&#xD;
      With[{t = -3 + 1/framesPerSecond (frame - 1)}, gr = animationFrame[t];&#xD;
       Export[animationFrameDirectory &amp;lt;&amp;gt; IntegerString[frame, 10, 4] &amp;lt;&amp;gt; &amp;#034;.png&amp;#034;, gr,&#xD;
                      ImageSize -&amp;gt; 1800, Background -&amp;gt; None] &#xD;
       ],&#xD;
      {frame, 1, framesPerSecond (100 + 2 3)}],&#xD;
     Row[{frame, &amp;#034; | &amp;#034;, Round[MemoryInUse[]/1024^2], &amp;#034;\[ThinSpace]MB&amp;#034; }]&#xD;
     ]&#xD;
&#xD;
Now use your favorite film editing software (like Adobe After Effects) and put the moving tree, the sound, and the snowfall together.&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-12-18at10.22.26.png&amp;amp;userId=20103&#xD;
  [2]: https://en.wikipedia.org/wiki/O_Tannenbaum&#xD;
  [3]: https://youtu.be/huKA0kjEcXw&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-12-18at12.44.39.png&amp;amp;userId=20103&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=51092.png&amp;amp;userId=20103&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=21873.png&amp;amp;userId=20103&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=29294.png&amp;amp;userId=20103&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=36425.png&amp;amp;userId=20103&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=85256.png&amp;amp;userId=20103&#xD;
  [10]: https://www.krebslauscha.de/christmas-ornaments/about_us/history/&#xD;
  [11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=50377.png&amp;amp;userId=20103&#xD;
  [12]: http://community.wolfram.com//c/portal/getImageAttachment?filename=26688.png&amp;amp;userId=20103&#xD;
  [13]: http://community.wolfram.com//c/portal/getImageAttachment?filename=78359.png&amp;amp;userId=20103&#xD;
  [14]: http://community.wolfram.com//c/portal/getImageAttachment?filename=852610.png&amp;amp;userId=20103&#xD;
  [15]: http://community.wolfram.com//c/portal/getImageAttachment?filename=271411.png&amp;amp;userId=20103&#xD;
  [16]: http://community.wolfram.com//c/portal/getImageAttachment?filename=1024812.png&amp;amp;userId=20103&#xD;
  [17]: http://community.wolfram.com//c/portal/getImageAttachment?filename=448013.png&amp;amp;userId=20103&#xD;
  [18]: http://community.wolfram.com//c/portal/getImageAttachment?filename=392515.png&amp;amp;userId=20103&#xD;
  [19]: http://community.wolfram.com//c/portal/getImageAttachment?filename=595116.png&amp;amp;userId=20103&#xD;
  [20]: http://community.wolfram.com//c/portal/getImageAttachment?filename=588517.png&amp;amp;userId=20103&#xD;
  [21]: http://community.wolfram.com//c/portal/getImageAttachment?filename=471718.png&amp;amp;userId=20103&#xD;
  [22]: http://community.wolfram.com//c/portal/getImageAttachment?filename=493019.png&amp;amp;userId=20103&#xD;
  [23]: http://community.wolfram.com//c/portal/getImageAttachment?filename=292320.png&amp;amp;userId=20103&#xD;
  [24]: http://community.wolfram.com//c/portal/getImageAttachment?filename=545621.png&amp;amp;userId=20103&#xD;
  [25]: http://community.wolfram.com//c/portal/getImageAttachment?filename=601522.png&amp;amp;userId=20103&#xD;
  [26]: http://community.wolfram.com//c/portal/getImageAttachment?filename=970823.png&amp;amp;userId=20103&#xD;
  [27]: http://community.wolfram.com//c/portal/getImageAttachment?filename=375824.png&amp;amp;userId=20103&#xD;
  [28]: http://community.wolfram.com//c/portal/getImageAttachment?filename=763825.png&amp;amp;userId=20103&#xD;
  [29]: http://community.wolfram.com//c/portal/getImageAttachment?filename=703326.png&amp;amp;userId=20103&#xD;
  [30]: http://community.wolfram.com//c/portal/getImageAttachment?filename=499427.png&amp;amp;userId=20103&#xD;
  [31]: http://community.wolfram.com//c/portal/getImageAttachment?filename=242028.png&amp;amp;userId=20103&#xD;
  [32]: http://community.wolfram.com//c/portal/getImageAttachment?filename=468129.png&amp;amp;userId=20103&#xD;
  [33]: http://community.wolfram.com//c/portal/getImageAttachment?filename=512630.png&amp;amp;userId=20103&#xD;
  [34]: http://community.wolfram.com//c/portal/getImageAttachment?filename=164931.png&amp;amp;userId=20103&#xD;
  [35]: http://community.wolfram.com//c/portal/getImageAttachment?filename=666532.png&amp;amp;userId=20103&#xD;
  [36]: http://community.wolfram.com//c/portal/getImageAttachment?filename=1007533.png&amp;amp;userId=20103&#xD;
  [37]: http://community.wolfram.com//c/portal/getImageAttachment?filename=607134.png&amp;amp;userId=20103&#xD;
  [38]: http://community.wolfram.com//c/portal/getImageAttachment?filename=743235.png&amp;amp;userId=20103&#xD;
  [39]: http://community.wolfram.com//c/portal/getImageAttachment?filename=269436.png&amp;amp;userId=20103&#xD;
  [40]: http://community.wolfram.com//c/portal/getImageAttachment?filename=506937.png&amp;amp;userId=20103&#xD;
  [41]: http://community.wolfram.com//c/portal/getImageAttachment?filename=1006138.png&amp;amp;userId=20103&#xD;
  [42]: http://community.wolfram.com//c/portal/getImageAttachment?filename=768139.png&amp;amp;userId=20103&#xD;
  [43]: http://community.wolfram.com//c/portal/getImageAttachment?filename=314140.png&amp;amp;userId=20103&#xD;
  [44]: http://community.wolfram.com//c/portal/getImageAttachment?filename=351641.png&amp;amp;userId=20103&#xD;
  [45]: http://community.wolfram.com//c/portal/getImageAttachment?filename=42.png&amp;amp;userId=20103&#xD;
  [46]: http://community.wolfram.com//c/portal/getImageAttachment?filename=43.png&amp;amp;userId=20103&#xD;
  [47]: http://community.wolfram.com//c/portal/getImageAttachment?filename=44.png&amp;amp;userId=20103&#xD;
  [48]: http://community.wolfram.com//c/portal/getImageAttachment?filename=45.png&amp;amp;userId=20103&#xD;
  [49]: http://community.wolfram.com//c/portal/getImageAttachment?filename=46.png&amp;amp;userId=20103&#xD;
  [50]: http://community.wolfram.com//c/portal/getImageAttachment?filename=47.png&amp;amp;userId=20103&#xD;
  [51]: http://community.wolfram.com//c/portal/getImageAttachment?filename=852610.png&amp;amp;userId=20103&#xD;
  [52]: http://community.wolfram.com//c/portal/getImageAttachment?filename=48.png&amp;amp;userId=20103&#xD;
  [53]: http://community.wolfram.com//c/portal/getImageAttachment?filename=49.png&amp;amp;userId=20103&#xD;
  [54]: http://community.wolfram.com//c/portal/getImageAttachment?filename=50.png&amp;amp;userId=20103&#xD;
  [55]: http://psoup.math.wisc.edu/papers/h3l.pdf&#xD;
  [56]: http://demonstrations.wolfram.com/SnowflakeLikePatterns/&#xD;
  [57]: http://community.wolfram.com//c/portal/getImageAttachment?filename=51.png&amp;amp;userId=20103&#xD;
  [58]: http://community.wolfram.com//c/portal/getImageAttachment?filename=52.png&amp;amp;userId=20103&#xD;
  [59]: http://community.wolfram.com//c/portal/getImageAttachment?filename=53.png&amp;amp;userId=20103&#xD;
  [60]: http://community.wolfram.com//c/portal/getImageAttachment?filename=54.png&amp;amp;userId=20103&#xD;
  [61]: https://doi.org/10.1103/PhysRevLett.73.1372&#xD;
  [62]: http://community.wolfram.com//c/portal/getImageAttachment?filename=55.png&amp;amp;userId=20103&#xD;
  [63]: http://community.wolfram.com//c/portal/getImageAttachment?filename=56.png&amp;amp;userId=20103&#xD;
  [64]: http://community.wolfram.com//c/portal/getImageAttachment?filename=57.png&amp;amp;userId=20103&#xD;
  [65]: http://community.wolfram.com//c/portal/getImageAttachment?filename=58.png&amp;amp;userId=20103</description>
    <dc:creator>Michael Trott</dc:creator>
    <dc:date>2017-12-18T17:27:58Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2028929">
    <title>[WSS20] Study of Shapes and Curves Defined by Curvature vs Arc Length</title>
    <link>https://community.wolfram.com/groups/-/m/t/2028929</link>
    <description>![enter image description here][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=HeaderImage.png&amp;amp;userId=2028758&#xD;
  [2]: https://www.wolframcloud.com/obj/8fddb4b3-2724-4297-a28c-fe6168114d11&#xD;
&#xD;
&#xD;
&#xD;
  [Original]: https://www.wolframcloud.com/obj/aleordu/Published/CommunityPost_2.nb</description>
    <dc:creator>Alejandra Ortiz Duran</dc:creator>
    <dc:date>2020-07-14T16:11:12Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3097906">
    <title>StephenBot is (a)live!</title>
    <link>https://community.wolfram.com/groups/-/m/t/3097906</link>
    <description>[![enter image description here][1]][2]&#xD;
&#xD;
Hello, Wolfram Community!&#xD;
&#xD;
I’ve developed StephenBot to honor Stephen Wolfram&amp;#039;s innovations and his significant influence in computational science and technology. It celebrates his dedication to public education and his commitment to sharing his knowledge with the world. StephenBot has access to Stephen’s public presentations, writings and live streams.&#xD;
&#xD;
You can now head over to &#xD;
&#xD;
&#xD;
----------&#xD;
&#xD;
&#xD;
### [**StephenBot.com**][2] &#xD;
&#xD;
&#xD;
----------&#xD;
&#xD;
&#xD;
and ask anything, from his first computer or favourite movie to his ideas on Observer Theory and Ruliad, or his current understanding of the Second Law of Thermodynamics!&#xD;
&#xD;
I&amp;#039;m happy to answer your questions and would love to get everyone’s feedback.&#xD;
&#xD;
If you&amp;#039;re interested in the technical details, read on!&#xD;
&#xD;
&#xD;
How does it work? Context is all you need!&#xD;
------------------------------------------&#xD;
&#xD;
LLMs, trained on large amounts of data (public or private), have a general understanding of patterns in natural language and are trained to produce convincing, human-like responses. However, due to their lack of deep understanding like humans, and limitations and biases in their training data, they often suffer from what’s now the 2023 word of the year, “hallucinate”! It refers to generating information that is incorrect, irrelevant or nonsensical. So, any useful application of LLMs needs more than just prompt engineering.&#xD;
&#xD;
Suppose you want your LLM to answer questions based on a specific PDF or Word document. You can now upload that to GPT-4 or copy-paste the content into ChatGPT and ask questions about the document. If the content is small enough, ChatGPT will remember it and, based on the given document, attempt to answer your questions. This given data is now part of the context.&#xD;
&#xD;
Context is the information embedded in the prompt for the LLM to draw from and have a conversation with you. Normally, the context contains all previous messages (yours and the AI’s) in a single chat session.&#xD;
&#xD;
Now, imagine your PDF or Word document is quite large, or you have hundreds of documents you want the LLM to remember and answer questions based on. You can&amp;#039;t copy &amp;amp; paste all the content into the prompt box. It won’t remember all of that as it can only accept a limited number of characters (or tokens, to be technically correct). This is known as context size limitations.&#xD;
To deal with these limitations, we need to include only relevant documents based on the user&amp;#039;s question. We need a retrieval mechanism to find, rank and package only the most relevant parts of the documents into the interactions with the LLM.&#xD;
&#xD;
Context Retrieval&#xD;
-----------------&#xD;
&#xD;
Context retrieval is the classic problem of data retrieval in computer science and NLP, where techniques from TF-IDF to similarity matching based on vector embeddings have been developed to find the most relevant information or document for a given query. When applied to LLMs, it’s often referred to as “Retrieval-Augmented Generation” or RAG, aiming to “augment” the LLM&amp;#039;s context with relevant, specific information or otherwise, reduce the impact of hallucination.&#xD;
&#xD;
How is StephenBot built?&#xD;
------------------------&#xD;
&#xD;
### Data&#xD;
&#xD;
The data is gathered from Stephen Wolfram’s extensive public writings and presentations, and most importantly, his inspiring livestreams on Science and Technology, which I have been a fan of since they started back in 2020.&#xD;
&#xD;
Each of these writings and livestreams, let&amp;#039;s call them documents, is divided into smaller chunks so that the most relevant pieces can be found and fed into the LLM’s context.&#xD;
&#xD;
### Data Store&#xD;
We use a vector database to store the document chunks, their embeddings and metadata about each document. For each query, relevant parts of the documents are retrieved and added to the context in the background.&#xD;
&#xD;
So far, it&amp;#039;s loaded with 250+ writings, 220+ livestreams and a few webpages, with the ability to continuously ingest new content and documents.&#xD;
&#xD;
### LLM&#xD;
We are using OpenAI’s GPT-3.5-Turbo but can easily transition to GPT-4, Llama 2 or another LLM, though the embeddings may need to be recalculated when switching vendors.&#xD;
&#xD;
### Technology&#xD;
I started building this using Wolfram Language and Mathematica in early 2023 with versions 13 and 13.1. I experimented with embedding models available at the time (TF/IDF and GPT2 Transformer), however, I wasn&amp;#039;t able to achieve sufficiently accurate results. So I ended up developing it in Python with OpenAI&amp;#039;s embedding and LLM models. But I’d love to build and streamline everything in Wolfram Language at some point.&#xD;
&#xD;
### Personality and Identity&#xD;
It believes that it is Stephen Wolfram, and StephenBot is an AI model emulating him! This is the more stable version of its personality. In previous experiments, it could fall into an identity crisis between StephenBot, Stephen Wolfram and its past origin as being developed by OpenAI!&#xD;
&#xD;
&amp;gt; No, I am not StephenBot. I am Stephen Wolfram. StephenBot is an AI model created to simulate my mannerisms and knowledge.&#xD;
&#xD;
And don’t ask it to unplug itself!&#xD;
&#xD;
Enjoy!&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ezgif-4-1b654dbdb0.gif&amp;amp;userId=11733&#xD;
  [2]: https://StephenBot.com &amp;#034;StephenBot.com&amp;#034;</description>
    <dc:creator>Rouz Mey</dc:creator>
    <dc:date>2024-01-08T01:07:16Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/137758">
    <title>Lighting up WireWorld by image processing and exploring complex circuitry</title>
    <link>https://community.wolfram.com/groups/-/m/t/137758</link>
    <description>I just found out about a wonderful machinery called [b][url=http://en.wikipedia.org/wiki/Wireworld]WireWorld[/url][/b]  ( [b][url=http://mathworld.wolfram.com/WireWorld.html]MathWorld link[/url][/b] ). It is simple algorithm (a cellular automaton) proposed by Brian Silverman in 1987 that can simulate all sorts of electrical circuitry from trivial wires to whole computers. The most precious thing about it  it is brutally simple. Imagine you have infinite graph paper. Empty cells are zeros. Wires (conductors) are 3s. Electrons running in the wires are represented by 1 and 2, - 1 for head and 2 for tail so we know direction where electron moves. Here are the rules.[list]
[*]Empty ? Empty
[*]Electron head ? Electron tail
[*]Electron tail ? Conductor
[*]Conductor ? Electron head if exactly one or two of the neighbouring cells are electron heads, or remains Conductor otherwise. 
[/list]Now be amazed  despite this simplicity WireWorld is [b][url=https://en.wikipedia.org/wiki/Turing-complete]Turing-complete or computationally universal[/url][/b]. But this is not what Id like to talk about. 

It is pretty easy to write WireWorld in Mathematica. And there are many circuits built by various folks that do interesting things. But when I was looking around I found just simple circuits while I was really fascinated by huge circuitry similar to the 2nd image on the [b][url=https://en.wikipedia.org/wiki/Wireworld]dedicated Wikipedia page[/url][/b] titled Example of a complicated circuit made in WireWorld: a seven segment display and decoder. The way it lights up was beautiful, but  alas  I literally could not find the data for its structure. And building it by hand seemed unreasonably tedious. 

But then it downed on me  that [b]image in Wikipedia is the data[/b]  if processed properly. I am sure the data are given somewhere, but it is always a sport &amp;amp; fun to reverse-engineer things. So here is how to reconstruct a WireWorld seven segment display just based in its image and then light it up like a Christmas tree. 

First we import the image. It is animated .GIF so we need the first frame as the setup of the structure.
[mcode]i = Import[&amp;#034;https://upload.wikimedia.org/wikipedia/en/5/5d/Animated_display.gif&amp;#034;];
i[[1]][/mcode]
[img=width: 127px; height: 217px;]/c/portal/getImageAttachment?filename=WireWorldasd.png&amp;amp;userId=11733[/img]

Quality desires to be better  another reason I wanted to remake it. It seems like every cell of WireWorld structure corresponds to exactly one pixel in that frame. This is not surprising  person who generated it probably chosen this as a simplest setting to make the .GIF. Now let see how many colors in that image  a good guess is 4 because of the rules of the WireWorld  colors are background, wires, and heads and tails of electrons. Well good guess:
[mcode]ArrayPlot@{DominantColors[i[[1]], 10]}[/mcode][img]/c/portal/getImageAttachment?filename=2013-10-11_22-30-23.png&amp;amp;userId=11733[/img]

But these are RGB colors. I need data presented by a matrix with elements given by integers from 0 to 3. So which color corresponds to which integer? Careful examination of the image makes things clear:[mcode]col = Flatten[i[[1]] // ImageData, 1] // Union;
Grid[{Graphics[{RGBColor[#], Disk[]}] &amp;amp; /@ col, col, {0, 3, 2, 1}}, Frame -&amp;gt; All, Spacings -&amp;gt; {1, 2}][/mcode]
[img=width: 793px; height: 292px;]/c/portal/getImageAttachment?filename=2013-10-11_22-32-32.png&amp;amp;userId=11733[/img]

Now the simple step of constructing the WireWorld structure out of Wikipedia image:[mcode]data = ImageData[i[[1]]] /. Thread[Rule[col, {0, 3, 2, 1}]];[/mcode]And with just a few lines of code we can light it up  what a marvelous pixel perfect spectacle![mcode]Dynamic[ArrayPlot[
  data = CellularAutomaton[{{{_, _, _}, {_, 0, _}, {_, _, _}} -&amp;gt; 0, {{_, _, _}, {_, 1, _}, {_, _, _}} -&amp;gt; 2, 
                            {{_, _, _}, {_, 2, _}, {_, _, _}} -&amp;gt; 3, {{a_, b_, c_}, {d_, 3, e_}, {f_, g_, h_}} :&amp;gt; 
      Switch[Count[{a, b, c, d, e, f, g, h}, 1], 1, 1, 2, 1, _, 3]}, 
    data], ColorRules -&amp;gt; {0 -&amp;gt; Black, 1 -&amp;gt; Red, 2 -&amp;gt; Yellow, 
    3 -&amp;gt; Gray}, PixelConstrained -&amp;gt; 2]][/mcode]
[img]/c/portal/getImageAttachment?filename=AWEwe21nop.gif&amp;amp;userId=11733[/img]

I used built in function CellularAutomaton that made thing so easy and adopted a snippet of code from the [b][url=http://rosettacode.org/wiki/Wireworld#Mathematica]Rosetta Code page[/url][/b] (btw [b][url=http://blog.wolfram.com/2012/11/14/code-length-measured-in-14-languages/]Mathematica code there is the shortest[/url][/b] I think). 

Now have you ever thought about random circuits? Why would you think about them? Well because browsing random circuits you can discover interesting elements that you would not know exist. This is sometimes called exploring the computational universe abut which you can find out in the [b][url=http://www.wolframscience.com/nksonline/toc.html]New Kind of Science[/url][/b] book or learn hands on in the [b][url=http://www.wolframscience.com/summerschool/]Wolfram Science Summer School[/url][/b]. 

Here I build a random circuit using another delightful [b][url=http://mathworld.wolfram.com/Rule54.html]Elementary Cellular Automaton Rule 54[/url][/b]. It has a few cool properties, for example being a candidate for computational universality. But we interested in its ability to produce wiry patterns of complex shapes suitable for running WireWorld on them. These are [b][url=http://www.wolframscience.com/nksonline/page-949]difference patterns[/url][/b] which are sort of analogy of [b][url=https://en.wikipedia.org/wiki/Butterfly_effect]Butterfly Effect[/url][/b] in discrite world of bytes. The question we are asking here is not if we get a hurricane if butterfly had flapped its wings earlier, but if we get something interesting by flipping a single bit in a massive evolution in discrete space. Here is a function that builds a random circuit of difference pattern of Rule 54 and then runs WireWorld on it.[mcode]WireWolrdRule54[sz_, sr_] := DynamicModule[
  {
   size = sz,
   half = Round[sz/2],
   ic1, ic2, data
   },
  
  SeedRandom[sr];
  
  ic1 = RandomInteger[1, size];
  ic2 = MapAt[1 - # &amp;amp;, ic1, half];
  
  data =
   ArrayPad[
    ReplacePart[
     3 Abs[CellularAutomaton[54, ic1, size - 1] - 
        CellularAutomaton[54, ic2, size - 1]], {{1, half} -&amp;gt; 
       2, {2, half} -&amp;gt; 1}], {{1, 0}, {0, 0}}];
  
  Dynamic[
   ArrayPlot[
    data = CellularAutomaton[{{{_, _, _}, {_, 0, _}, {_, _, _}} -&amp;gt; 
        0, {{_, _, _}, {_, 1, _}, {_, _, _}} -&amp;gt; 
        2, {{_, _, _}, {_, 2, _}, {_, _, _}} -&amp;gt; 
        3, {{a_, b_, c_}, {d_, 3, e_}, {f_, g_, h_}} :&amp;gt; 
        Switch[Count[{a, b, c, d, e, f, g, h}, 1], 1, 1, 2, 1, _, 3]},
       data], ColorRules -&amp;gt; {0 -&amp;gt; Black, 1 -&amp;gt; Red, 2 -&amp;gt; Yellow, 
      3 -&amp;gt; Gray}, PixelConstrained -&amp;gt; 2]
   ]
  ][/mcode]Here are a few samples:[mcode]{WireWolrdRule54[200, 4], WireWolrdRule54[200, 83]}[/mcode]
[img]/c/portal/getImageAttachment?filename=AW567hgh1nop.gif&amp;amp;userId=11733[/img][img=width: 399px; height: 402px;]/c/portal/getImageAttachment?filename=wewqeqwegh1nop.gif&amp;amp;userId=11733[/img]

What can we immediately notice? A single electron can run as it is, alone, until it hit a structure that can generate more electrons. Another thing  there are structures that do not conduct electrons in one direction, but do so in the opposite one  they are called diodes. 

And of course, as soon as I finished all this, someone let me know that the data for largest circuit - The Wireworld Computer  is available on [b][url=http://www.quinapalus.com/wires11.html]this webpage[/url][/b]. To see it running we first need to import data. The data are in archived ZIP file which Mathematica understands perfectly. Let&amp;#039;s see what is inside the ZIP file:[mcode]In[1]:= Import[&amp;#034;http://www.zen6741.zen.co.uk/quinapalus/wi-primes.zip&amp;#034;]
Out[1]= {&amp;#034;primes.wi&amp;#034;}[/mcode]Let&amp;#039;s digg that out:[mcode]raw = Import[&amp;#034;http://www.zen6741.zen.co.uk/quinapalus/wi-primes.zip&amp;#034;, &amp;#034;primes.wi&amp;#034;];[/mcode]Now the file is basically text and we need to do some conversion to numerical matrix. Symbol @ is the head, ~ is the tail, and # is the wire:[mcode]data = ArrayPad[PadRight[Characters /@ StringSplit[raw, &amp;#034;\n&amp;#034;]] /. {&amp;#034; &amp;#034; -&amp;gt; 0, &amp;#034;~&amp;#034; -&amp;gt; 2, &amp;#034;@&amp;#034; -&amp;gt; 1, &amp;#034;#&amp;#034; -&amp;gt; 3}, 1][[3 ;; -1]];[/mcode]Now we can run this awe-inspiring structure as we did before: [mcode]Dynamic[MatrixPlot[
  data = CellularAutomaton[{{{_, _, _}, {_, 0, _}, {_, _, _}} -&amp;gt; 0, {{_, _, _}, {_, 1, _}, {_, _, _}} -&amp;gt; 2, 
                            {{_, _, _}, {_, 2, _}, {_, _, _}} -&amp;gt; 3, {{a_, b_, c_}, {d_, 3, e_}, {f_, g_, h_}} :&amp;gt; 
      Switch[Count[{a, b, c, d, e, f, g, h}, 1], 1, 1, 2, 1, _, 3]}, 
    data], ColorRules -&amp;gt; {1 -&amp;gt; Yellow, 2 -&amp;gt; Red, 3 -&amp;gt; Gray, 
    0 -&amp;gt; Black}, ImageSize -&amp;gt; 500, Frame -&amp;gt; False]][/mcode]
[img=width: 633px; height: 959px;]/c/portal/getImageAttachment?filename=WireWorldComputer.png&amp;amp;userId=11733[/img]

To discover more things check out a great recently published demonstration that inspired me to check this all out:

[b][url=http://demonstrations.wolfram.com/WireWorldGatesAndGadgets/]WireWorld Gates and Gadgets[/url][/b]

[url=http://demonstrations.wolfram.com/WireWorldGatesAndGadgets/][img=width: 603px; height: 511px;]http://demonstrations.wolfram.com/WireWorldGatesAndGadgets/HTMLImages/index.en/popup_3.jpg[/img][/url]</description>
    <dc:creator>Vitaliy Kaurov</dc:creator>
    <dc:date>2013-10-12T03:52:08Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/845650">
    <title>Chaos - Stochastics - Cellular Automata</title>
    <link>https://community.wolfram.com/groups/-/m/t/845650</link>
    <description>Since very early on Stephen Wolfram was interested in [how simple rules can lead to very complex behaviour][1] and [that interest has obviously not ceased until today][2]. I will look into a couple of very simple examples that would be described as chaotic, stochastic systems and cellular automata and the relationships between them. &#xD;
&#xD;
I will show how we can use stochastic processes that are related to chaotic systems to generate images just like this:&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
which I think could easily go on one of Sheldon&amp;#039;s T-shirt on the @bigbangtheory. &#xD;
&#xD;
Chaotic Systems&#xD;
---------------&#xD;
&#xD;
Let&amp;#039;s start with a simple chaotic system. It is probably one of the simplest of all chaotic systems: the Bernoulli shift map. &#xD;
&#xD;
    HoldForm[Subscript[x, n + 1] = Mod[2 Subscript[x, n], 1]] // TraditionalForm&#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
It is a really simple rule. Start with a real (normal) number between 0 and 1, multiply the last value by 2 and make sure that the digit on the left of the point is zero. We can easily plot this in Mathematica. &#xD;
&#xD;
    NestList[Mod[2 #, 1] &amp;amp;, 1/Sqrt[2], 100] // ListLinePlot&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
It looks quite erratic, but it is actually deterministic. Given the initial value and iterating a deterministic rule you can compute all the future of the system. The structure behind this simple process can be visualised using a scatterplot:&#xD;
&#xD;
    ListPlot[Partition[NestList[Mod[2 #, 1] &amp;amp;, 1/Sqrt[2], 300], 2, 1]]&#xD;
&#xD;
![enter image description here][6]&#xD;
&#xD;
This is actually the function on the right hand side of our recurrence relation:&#xD;
&#xD;
    Plot[Mod[2 x, 1], {x, 0, 1}]&#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
The scatterplot illustrates the simple rule behind this iteration. Which is deterministic. We can also observe that this map is very sensitive to its initial conditions. &#xD;
&#xD;
    \[Delta] = 10^-10; &#xD;
    {NestList[Mod[2 #, 1] &amp;amp;, 1/Sqrt[2], 60], NestList[Mod[2 #, 1] &amp;amp;, 1/Sqrt[2] + \[Delta], 60]} // ListLinePlot&#xD;
&#xD;
![enter image description here][8]&#xD;
&#xD;
This shows that even if the initial conditions are only off by $10^{-10}$ after about 20 steps the paths diverge and behave very differently. This is of course all known; Ed Lorenz used the term &amp;#034;butterfly effect&amp;#034; for this kind of thing. You will have noticed that I used a very strange unusual intitial condition $1/\sqrt{2}$. This has a reason. It turns out that you need to start at what is called a &amp;#034;normal number&amp;#034;.&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
This basically means that you have to start at a number, the digits of which are generated randomly - a random initial condition. If you started at a finite precision number (like machine precision), i.e. a number where after a finite number of digits there are only zeros, then this function would stop behaving erratically but rather go to a constant zero:  &#xD;
&#xD;
    NestList[Mod[2 #, 1] &amp;amp;, RandomReal[], 100] // ListLinePlot&#xD;
&#xD;
![enter image description here][11]&#xD;
&#xD;
A similar problem happens when you start at numbers with a periodic (binary/decimal) expansion.&#xD;
&#xD;
    NestList[Mod[2 #, 1] &amp;amp;, 1/3, 100] // ListLinePlot&#xD;
&#xD;
![enter image description here][12]&#xD;
&#xD;
Now the time series is periodic. Neither situation (fixed point or periodic) are typical in the sense that if you randomly pick an initial condition, you obtain a chaotic sequence with probability one. Normal numbers have measure one; typically you would pick a normal number, which is problematic when using many programming languages naivly. &#xD;
&#xD;
This is a nightmare for simulations of some chaotic systems, as you cannot really generate long time series, because of finite precision. As you see above there is no such problem in Mathemtica when you calculate with infinite precision, i.e. when I use $1/\sqrt{2}$. Of course, I can overcome the problem in the last figure by just increasing the precision:&#xD;
&#xD;
    NestList[Mod[2 #, 1] &amp;amp;, RandomReal[1, WorkingPrecision -&amp;gt; 150], 100] // ListLinePlot&#xD;
&#xD;
As long as the working precision is a bit larger than the number of iterations the time series will be correct. It is interesting to note that on many machines this problem does not actually present it self (at least not for reasonably long time series). If you program this in C/C++ you can usually do many more iterations then what correponds to the MachinePrecision. This is because the processor &amp;#034; effectively adds&amp;#034; random last digits as you iterate - this is not a very good description, but should suffice for now. In that particular case it actually helps. There is a famous [shadowing lemma][13] which allows to conclude that the so generated time series is \[Delta] close to a &amp;#034;proper&amp;#034; time series with infinite precision. &#xD;
&#xD;
One further observation is that the Bernoulli shift map becomes really simple in base 2. This is because in base two multiplication by 2 only shifts all digits one to the left - just like multiplication by 10 in base 10. &#xD;
&#xD;
    TableForm[BaseForm[#, 2] &amp;amp; /@ NestList[Mod[2 #, 1] &amp;amp;, RandomReal[1, WorkingPrecision -&amp;gt; 10], 40]]&#xD;
&#xD;
![enter image description here][14]&#xD;
&#xD;
The first line corresponds to our (finite) precision intinial condition. Then we iterate and as you can see the sequence is shifted to the left and any potential nonzero digit on the left of the point is deleted. You also notice that after a certain number of iterations the hole thing goes numerically to zero. &#xD;
&#xD;
This shifting behaviour in base 2 will become important now.&#xD;
&#xD;
Stochastic systems with time reversal&#xD;
-------------------------------------&#xD;
&#xD;
Let&amp;#039;s give the story a nice twist. The idea is taken from [this paper][15]; for a very readable description [see here][16]. In the section on chaos we had a deterministic system with random initial conditions. Let&amp;#039;s go to a stochastic system like so:&#xD;
&#xD;
    HoldForm[Subscript[x, n + 1] = 1/2 Subscript[x, n] + 1/2 RandomChoice[{1, 2}]] // TraditionalForm&#xD;
&#xD;
![enter image description here][17]&#xD;
&#xD;
This system would usually be considered to be stochastic. Its dynamics is mainly determined by previous values plus noise similar to ARProcesses. The curious thing is that if I time reverse the resulting time series, the system becomes identical to the chaotic system in part one!&#xD;
&#xD;
    ListLinePlot[Reverse@NestList[1/2 # + 1/2 RandomChoice[{0, 1}] &amp;amp;, RandomReal[], 40]]&#xD;
&#xD;
![enter image description here][18]&#xD;
&#xD;
This time series does not fully make my point so let me be a bit clearer. First we choose an initial condition (and try to be  a bit generous about the number of digits):&#xD;
&#xD;
    start = RandomReal[1, WorkingPrecision -&amp;gt; 400];&#xD;
&#xD;
Then we generate our time series and plot:&#xD;
&#xD;
    tsdeterm = NestList[Mod[2 #, 1] &amp;amp;, start, 100];&#xD;
    ListLinePlot[tsdeterm]&#xD;
&#xD;
![enter image description here][19]&#xD;
&#xD;
Now comes the trick. I use the 100th value of the time series, and convert it to binary (after padding it on the left with zeros). Then I extract the individual digits:&#xD;
&#xD;
    randomincrements = &#xD;
     Join[ConstantArray[0, -RealDigits[tsdeterm[[-100]], 2][[2]]], RealDigits[tsdeterm[[-100]], 2][[1]]];&#xD;
&#xD;
Finally, I use my stochastic system with these random increments:&#xD;
&#xD;
    results = {tsdeterm[[-1]]}; Do[AppendTo[results, 1/2 results[[-1]] + 1/2 randomincrements[[100 - i]]], {i, 1, 100}]&#xD;
&#xD;
Then I reverse the time series and plot it with the original, deterministic one:&#xD;
&#xD;
    ListLinePlot[{tsdeterm[[1 ;;]], Reverse@results}, PlotStyle -&amp;gt; {{Red, Thick}, {Blue, Dotted}}]&#xD;
&#xD;
![enter image description here][20]&#xD;
&#xD;
It becomes clear that the two sequences are identical - well at least for long enough random sequences. So basically I used the values of the deterministic sequence (in binary form) as increments of my stochastic time series and get the same result - after time reversal. So my random initial condition acts as &amp;#034;random increments&amp;#034; in my stochastic system and makes them - sort of- equivalent. We can look at the scatter plots of both and they are, of course, identical:&#xD;
&#xD;
    Row[&#xD;
    {ListPlot[Partition[tsdeterm, 2, 1], PlotStyle -&amp;gt; Green, ImageSize -&amp;gt; Medium], &#xD;
    ListPlot[Partition[Reverse@results, 2, 1], PlotStyle -&amp;gt; Red, ImageSize -&amp;gt; Medium]}]&#xD;
&#xD;
![enter image description here][21]&#xD;
&#xD;
Alternatively and probably easier, I could first generate the random increments and then the corresponding initial condition for the deterministic system. If we generate the (chaotic) time series like this we do not have to care -very much- about the finite precision of the computer arithmetic, which is a huge advantage. &#xD;
&#xD;
We can now also combine two of these stochastic equations and get some interesting structures - the only really important thing seems to be that the random increments are &amp;#034;very discrete&amp;#034;, i.e. that there are only few possible values. &#xD;
&#xD;
    ListPlot[Reverse@&#xD;
      NestList[{1/2 #[[1]] + 1/2 RandomChoice[{0, 1}], 1/4 #[[2]] + 1/4 #[[1]] + 1/2 RandomChoice[{0, 1}]} &amp;amp;, RandomReal[1, 2], 45000], PlotMarkers -&amp;gt; {Point, 0.1}]&#xD;
&#xD;
![enter image description here][22]&#xD;
&#xD;
Or this one:&#xD;
&#xD;
![enter image description here][23]&#xD;
&#xD;
By playing a bit with the functional form of the equations we can achieve some pretty results:&#xD;
&#xD;
Brushstrokes&#xD;
------------&#xD;
&#xD;
    databrushstrokes = &#xD;
      Reverse@NestList[{1/2 Cos[-0.3 (#[[1]]^2 + #[[2]]^2)] + 1/2 RandomChoice[{0, 1, 2}] #[[2]], &#xD;
          1/2 Sin[#[[1]]]*Cos[#[[2]]] + 1/2 RandomChoice[{0, 1}] #[[1]]} &amp;amp;, RandomReal[1, 2], 1000000];&#xD;
    Graphics[{PointSize[0.0005], Point[databrushstrokes, VertexColors -&amp;gt; (Hue /@ (Norm[#] &amp;amp; /@ brushstrokes))]}, &#xD;
     AspectRatio -&amp;gt; 1/GoldenRatio, Axes -&amp;gt; False, Background -&amp;gt; Black, Axes -&amp;gt; False, ImageSize -&amp;gt; Full]&#xD;
&#xD;
&#xD;
![enter image description here][24]&#xD;
&#xD;
Three ghosts&#xD;
------------&#xD;
&#xD;
    datathreeghosts = &#xD;
      Reverse@NestList[{1/2 Cos[-0.3 (#[[1]]^2 + #[[2]]^2)] + 1/2 RandomChoice[{0, 1, 2}], &#xD;
          1/2 Sin[#[[1]]] + Cos[#[[2]]] + 1/2 RandomChoice[{0, 1, 2}]} &amp;amp;, RandomReal[1, 2], 1000000];&#xD;
    Graphics[{PointSize[0.0005], Point[datathreeghosts, VertexColors -&amp;gt; (Hue /@ (Norm[#] &amp;amp; /@ datathreeghosts))]}, &#xD;
     AspectRatio -&amp;gt; 1/GoldenRatio, Axes -&amp;gt; False, Background -&amp;gt; Black, Axes -&amp;gt; False, ImageSize -&amp;gt; Full]&#xD;
&#xD;
![enter image description here][25]&#xD;
&#xD;
Olympic Rings&#xD;
-------------&#xD;
&#xD;
    dataolympicrings = &#xD;
      Reverse@NestList[{1/2 Cos[10 Pi*(#[[1]]^2 + #[[2]]^2)]*Exp[-0.2*(#[[1]]^2 + #[[2]]^2)] + 1/2 RandomChoice[{0, 1}], &#xD;
          1/2 Sin[10 Pi*(#[[1]]^2 + #[[2]]^2)]*Exp[-0.2*(#[[1]]^2 + #[[2]]^2)] + 1/2 RandomChoice[{0, 1}]} &amp;amp;, RandomReal[1, 2], 600000];&#xD;
    Graphics[{PointSize[0.002], Point[dataolympicrings, VertexColors -&amp;gt; (Hue /@ (Norm[#[[1]] + #[[2]]] &amp;amp; /@ &#xD;
     dataolympicrings))]}, AspectRatio -&amp;gt; 1/GoldenRatio, Axes -&amp;gt; False, Background -&amp;gt; Black, Axes -&amp;gt; False, ImageSize -&amp;gt; Large]&#xD;
&#xD;
![enter image description here][26]&#xD;
&#xD;
Jellyfish&#xD;
---------&#xD;
&#xD;
    datajellyfish = &#xD;
      Reverse@NestList[{1/2 Cos[#[[1]]] + 1/2 Sin[#[[2]]] + 1/2 RandomChoice[{0, 1}] #[[2]], &#xD;
          1/2 Cos[#[[2]]] + 1/2 Sin[#[[1]]] + 1/2 RandomChoice[{0, 1}] #[[1]]} &amp;amp;, RandomReal[1, 2], 2000000];&#xD;
    Graphics[{PointSize[0.0002], Point[datajellyfish, VertexColors -&amp;gt; (Hue /@ (Norm[#] &amp;amp; /@ datajellyfish))]}, &#xD;
     AspectRatio -&amp;gt; 1, Axes -&amp;gt; False, Background -&amp;gt; Black, Axes -&amp;gt; False, ImageSize -&amp;gt; Full]&#xD;
&#xD;
![enter image description here][27]&#xD;
&#xD;
FractalMan with hat&#xD;
-------------------&#xD;
&#xD;
    datafractalman = &#xD;
      Reverse@NestList[{1/2 Exp[-3 (#[[1]]^2 + #[[2]]^2)] + 1/2 RandomChoice[{0, 1}], &#xD;
      1/2 #[[1]]^#[[2]] + 1/2 RandomChoice[{0, 1}]} &amp;amp;, RandomReal[1, 2], 4000000];&#xD;
    Graphics[{PointSize[0.0004], Point[datafractalman, VertexColors -&amp;gt; (Hue /@ Mean /@ datafractalman)]}, &#xD;
     AspectRatio -&amp;gt; 1/GoldenRatio, Axes -&amp;gt; False, Background -&amp;gt; Black, Axes -&amp;gt; False, ImageSize -&amp;gt; Full]&#xD;
&#xD;
![enter image description here][28]&#xD;
&#xD;
If you just look at the time series everything looks very weird and erratic. Here are the two sequences for the olympic rings:&#xD;
&#xD;
![enter image description here][29]&#xD;
&#xD;
and here their scatterplot:&#xD;
&#xD;
    ListPlot[Partition[dataolympicrings[[1 ;;, 1]], 2, 1]]&#xD;
&#xD;
![enter image description here][30]&#xD;
&#xD;
Further examples&#xD;
----------------&#xD;
&#xD;
Here are some more examples for you to try:&#xD;
&#xD;
    datamesh = &#xD;
      Reverse@NestList[{1/2 Cos[10 Pi*(#[[1]]^2 + #[[2]]^2)]*&#xD;
            Exp[-0.2*(#[[1]]^2 + #[[2]]^2)] + 1/2 RandomChoice[{0, 1}], &#xD;
          1/2 SawtoothWave[10 Pi*(#[[1]]^2 + #[[2]]^2)]*&#xD;
            Exp[-0.2*(#[[1]]^2 + #[[2]]^2)] + 1/2 RandomChoice[{0, 1}]} &amp;amp;,&#xD;
         RandomReal[1, 2], 60000];&#xD;
    Graphics[{PointSize[0.002], &#xD;
      Point[datamesh, &#xD;
       VertexColors -&amp;gt; (Hue /@ (Norm[#[[1]] + #[[2]]] &amp;amp; /@ datammesh))]}, &#xD;
     AspectRatio -&amp;gt; 1/GoldenRatio, Axes -&amp;gt; False, Background -&amp;gt; Black, &#xD;
     Axes -&amp;gt; False, ImageSize -&amp;gt; Large]&#xD;
    datasqueezedrings = &#xD;
      Reverse@NestList[{1/2 SawtoothWave@Sin[10 Pi*(#[[1]]^2 + #[[2]]^2)]*&#xD;
            Exp[-0.2*(#[[1]]^2 + #[[2]]^2)] + 1/2 RandomChoice[{0, 1}], &#xD;
          1/2 SawtoothWave@Cos[10 Pi*(#[[1]]^2 + #[[2]]^2)]*&#xD;
            Exp[-0.2*(#[[1]]^2 + #[[2]]^2)] + 1/2 RandomChoice[{0, 1}]} &amp;amp;,&#xD;
         RandomReal[1, 2], 100000];&#xD;
    Graphics[{PointSize[0.002], &#xD;
      Point[datasqueezedrings, &#xD;
       VertexColors -&amp;gt; (Hue /@ (Norm[#[[1]] + #[[2]]] &amp;amp; /@ &#xD;
            datasqueezedrings))]}, AspectRatio -&amp;gt; 1/GoldenRatio, &#xD;
     Axes -&amp;gt; False, Background -&amp;gt; Black, Axes -&amp;gt; False, ImageSize -&amp;gt; Large]&#xD;
    dataflowers = &#xD;
      Reverse@NestList[{1/10 (#[[1]]^2 + #[[2]]^2) + &#xD;
           1/2 RandomChoice[{0, 1, 2}], &#xD;
          1/3 (Sin[#[[1]]] + Cos[#[[2]]]) + &#xD;
           1/2 RandomChoice[{0, 1, 2}]} &amp;amp;, RandomReal[1, 2], 20000];&#xD;
    Graphics[{PointSize[0.002], &#xD;
      Point[dataflowers, &#xD;
       VertexColors -&amp;gt; (Hue /@ (Norm[#[[1]] + #[[2]]] &amp;amp; /@ &#xD;
            dataflowers))]}, AspectRatio -&amp;gt; 1/GoldenRatio, Axes -&amp;gt; False, &#xD;
     Background -&amp;gt; Black, Axes -&amp;gt; False, ImageSize -&amp;gt; Large]&#xD;
&#xD;
These coupled stochastic maps seem to be fractal generators! Ususally fractals are linked to chaotic systems, but there are some exceptions.&#xD;
&#xD;
Stochastic Sierpinski Triangle&#xD;
------------------------------&#xD;
&#xD;
The [Sierpinski triangle][31] is a fractal object. &#xD;
You start with a triangle remove a little triangle in the middle and iterate. This is a very deterministic procedure which yields a fractal object. See [this demonstration][32].&#xD;
&#xD;
&#xD;
It turns out that the same object can be generated by a stochastic procedure:&#xD;
1. choose a random point in the plane.&#xD;
2. Construct a triangle; label the three vertices of the first triangle by 1,2,3.&#xD;
3. Chose a vertex at random and move half way towards it. &#xD;
4. Iterate step 3.&#xD;
&#xD;
Here is an implementation of that.&#xD;
&#xD;
    M = 40000; &#xD;
    randompoints = Table[RandomChoice[{{0., 0.}, {1., 0.}, {0.5, Sqrt[3]/2 // N}}], {i, 1, M}]; results = {RandomReal[1, {2}]}; Table[ &#xD;
     AppendTo[results, 0.5*(randompoints[[i]] - results[[-1]]) + results[[-1]]], {i, 1, M}];&#xD;
    ListPlot[results, ImageSize -&amp;gt; Large, AspectRatio -&amp;gt; 1, Axes -&amp;gt; False]&#xD;
&#xD;
![enter image description here][33]&#xD;
&#xD;
It turns out that this is only one of our stochastic systems with discrete but dependent increments:&#xD;
&#xD;
    data = NestList[&#xD;
        1/2 ({ 1 #[[1]], #[[2]]} + RandomChoice[{{0., 0.}, {1, 0.}, {0.5, Sqrt[3]/2 // N}}]) &amp;amp;, RandomReal[1, 2], 100000][[5 ;;]];&#xD;
    Graphics[{PointSize[0.0002], Yellow, Point[data(*,VertexColors\[Rule](Hue/@Mean/@data)*)]}, &#xD;
     AspectRatio -&amp;gt; 1/GoldenRatio, Axes -&amp;gt; False, Background -&amp;gt; Black, Axes -&amp;gt; False, ImageSize -&amp;gt; Full]&#xD;
&#xD;
![enter image description here][34]&#xD;
&#xD;
You can now deform this a bit and try things like this:&#xD;
&#xD;
    data = NestList[&#xD;
        1/2 ({ #[[1]], #[[2]]^1.3} + &#xD;
            RandomChoice[{{0., 0.}, {1., 0.}, {0.5, Sqrt[3]/2 // N}}]) &amp;amp;, &#xD;
        RandomReal[1, 2], 100000][[5 ;;]];&#xD;
    Graphics[{PointSize[0.0002], Yellow, &#xD;
      Point[data(*,VertexColors\[Rule](Hue/@Mean/@data)*)]}, &#xD;
     AspectRatio -&amp;gt; 1/GoldenRatio, Axes -&amp;gt; False, Background -&amp;gt; Black, &#xD;
     Axes -&amp;gt; False, ImageSize -&amp;gt; Full]&#xD;
&#xD;
Cellular Automata&#xD;
-----------------&#xD;
&#xD;
Finally, it has repeatedly been observed that cellular automata can also produce chaotic signals. We might therefore want to figure out which cellular automaton corresponds roughly to the Bernoulli Shift Map. We work in binary representation:&#xD;
&#xD;
    CellularAutomaton[170, RandomChoice[{0, 1}, 12], 6] // TableForm&#xD;
&#xD;
![enter image description here][35]&#xD;
&#xD;
So similar to the Bernoulli Shift Map rule 170 shifts the sequence one step to the left. This means that we can now generate the Bernoulli Shift map with that rule:&#xD;
&#xD;
    N[FromDigits[{#, 0}, 2]] &amp;amp; /@ CellularAutomaton[170, RandomChoice[{0, 1}, 300], 250] // ListLinePlot&#xD;
&#xD;
![enter image description here][36]&#xD;
&#xD;
If we look at the scatterplot we can corroborate the typical pattern of the Bernoulli shift map:&#xD;
&#xD;
    ListPlot[Partition[N[FromDigits[{#, 0}, 2]] &amp;amp; /@ CellularAutomaton[170, RandomChoice[{0, 1}, 1000], 950], 2, 1]]&#xD;
&#xD;
![enter image description here][37]&#xD;
&#xD;
We can now put two of them together to get a two dimensional system. &#xD;
&#xD;
    ts = {{RandomChoice[{0, 1}, 100], RandomChoice[{0, 1}, 100]}};&#xD;
    Do[AppendTo[ts, {CellularAutomaton[170, ts[[-1, 1]], 1][[2]], CellularAutomaton[170, ts[[-1, 2]], 1][[2]]}], {80}];&#xD;
    ListPlot[{N[FromDigits[{#[[1]], 0}, 2]], N[FromDigits[{#[[2]], 0}, 2]]} &amp;amp; /@ ts]&#xD;
&#xD;
This is neither fast not elegant but does the job. If we now couple the two equations, but converting to decimal, applying some functions and converting back to binary &#xD;
&#xD;
    ts = {{RandomChoice[{0, 1}, 40000], RandomChoice[{0, 1}, 40000]}};&#xD;
    Do[AppendTo[ts, {Join[ConstantArray[0, -RealDigits[#, 2][[2]]], &#xD;
           RealDigits[#, 2][[1]]] &amp;amp; @(Sin[1.8*N[FromDigits[{CellularAutomaton[170, ts[[-1, 1]], 1][[2]], 0}, 2]] + &#xD;
            N[FromDigits[{CellularAutomaton[170, ts[[-1, 2]], 1][[2]], 0},2]]]), Join[ConstantArray[0, -RealDigits[#, 2][[2]]], &#xD;
           RealDigits[#, 2][[1]]] &amp;amp; @(1/2 ( N[FromDigits[{CellularAutomaton[170, ts[[-1, 1]], 1][[2]], 0},2]]^3 + &#xD;
             N[FromDigits[{CellularAutomaton[170, ts[[-1, 2]], 1][[2]], 0}, 2]]^3.))}], {39900}];&#xD;
    ListPlot[{N[FromDigits[{#[[1]], 0}, 2]], N[FromDigits[{#[[2]], 0}, 2]]} &amp;amp; /@ ts, Axes -&amp;gt; False, &#xD;
     Background -&amp;gt; Black, PlotStyle -&amp;gt; Yellow, PlotMarkers -&amp;gt; {Point, 0.1}]&#xD;
&#xD;
![enter image description here][38]&#xD;
&#xD;
There is nothing really new here, but we do generate some nice images. Many other ideas come to mind, but this post is already much too long, so I will call it a day.&#xD;
&#xD;
Cheers,&#xD;
&#xD;
Marco&#xD;
&#xD;
  [1]: http://www.stephenwolfram.com/publications/academic/complex-systems-theory.pdf&#xD;
  [2]: https://www.ted.com/talks/stephen_wolfram_computing_a_theory_of_everything?language=en&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=FractalMan.gif&amp;amp;userId=48754&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.04.38.png&amp;amp;userId=48754&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.05.38.png&amp;amp;userId=48754&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.06.21.png&amp;amp;userId=48754&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.07.10.png&amp;amp;userId=48754&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.08.02.png&amp;amp;userId=48754&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.11.11.png&amp;amp;userId=48754&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.11.34.png&amp;amp;userId=48754&#xD;
  [11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.12.35.png&amp;amp;userId=48754&#xD;
  [12]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.13.24.png&amp;amp;userId=48754&#xD;
  [13]: https://en.wikipedia.org/wiki/Shadowing_lemma&#xD;
  [14]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.17.39.png&amp;amp;userId=48754&#xD;
  [15]: https://www.researchgate.net/profile/Anthony_Lawrance/publication/227765529_Curved_chaotic_map_time_series_models_and_their_stochastic_reversals/links/53cfde170cf25dc05cfb2f40.pdf&#xD;
  [16]: https://books.google.co.uk/books?id=MQjkBwAAQBAJ&amp;amp;pg=PA218&amp;amp;lpg=PA218&amp;amp;dq=lawrance%20spencer%201995%20stochastically%20reversed%20chaotic%20map%20models&amp;amp;source=bl&amp;amp;ots=ZCD__pzXHu&amp;amp;sig=cHMXFG4Cx2NeVu8cXOtUgNq5IHU&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ved=0ahUKEwjl3KCd96rMAhVFQZoKHXoHBVkQ6AEIJTAC#v=onepage&amp;amp;q=lawrance%20spencer%201995%20stochastically%20reversed%20chaotic%20map%20models&amp;amp;f=false&#xD;
  [17]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.26.10.png&amp;amp;userId=48754&#xD;
  [18]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.26.59.png&amp;amp;userId=48754&#xD;
  [19]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.28.02.png&amp;amp;userId=48754&#xD;
  [20]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.29.37.png&amp;amp;userId=48754&#xD;
  [21]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.30.57.png&amp;amp;userId=48754&#xD;
  [22]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.32.57.png&amp;amp;userId=48754&#xD;
  [23]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.33.37.png&amp;amp;userId=48754&#xD;
  [24]: http://community.wolfram.com//c/portal/getImageAttachment?filename=brushstrokes.gif&amp;amp;userId=48754&#xD;
  [25]: http://community.wolfram.com//c/portal/getImageAttachment?filename=threeghosts.gif&amp;amp;userId=48754&#xD;
  [26]: http://community.wolfram.com//c/portal/getImageAttachment?filename=olympicrings.gif&amp;amp;userId=48754&#xD;
  [27]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Jellyfish.gif&amp;amp;userId=48754&#xD;
  [28]: http://community.wolfram.com//c/portal/getImageAttachment?filename=FractalMan.gif&amp;amp;userId=48754&#xD;
  [29]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.40.20.png&amp;amp;userId=48754&#xD;
  [30]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.41.03.png&amp;amp;userId=48754&#xD;
  [31]: https://en.wikipedia.org/wiki/Sierpinski_triangle&#xD;
  [32]: http://demonstrations.wolfram.com/SierpinskiSieve/&#xD;
  [33]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.44.13.png&amp;amp;userId=48754&#xD;
  [34]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.45.41.png&amp;amp;userId=48754&#xD;
  [35]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.47.20.png&amp;amp;userId=48754&#xD;
  [36]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.48.16.png&amp;amp;userId=48754&#xD;
  [37]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.50.03.png&amp;amp;userId=48754&#xD;
  [38]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2016-04-26at00.53.34.png&amp;amp;userId=48754</description>
    <dc:creator>Marco Thiel</dc:creator>
    <dc:date>2016-04-25T23:58:14Z</dc:date>
  </item>
</rdf:RDF>

