# trajectory density plot

I want to make a plot that shows the density of trajectories (x-y plots). In other words I want a plot that's analogous to this but with curves instead of points as data. Here's what I'm doing right now (with a simplified function) which gives okay results for 100 curves but doesn't scale to 10,000:

ta = RandomVariate[NormalDistribution[0, 0.3], {100}];
p = Map[Cos[t - #] &, ta];
Plot[p, {t, 0, 10}, PlotStyle -> {{Black, Opacity[0.05]}}] I'd also prefer to not have to quantize the x-y space. But if that's the only solution I'll accept it.

• Have you seen DensityPlot, could you use that to display the number of trajectories that pass through the X-Y space? Jun 27, 2015 at 0:07
• I have. I'm not sure how i'd compute a density function from 10,000 stochastic trajectories though... Jun 27, 2015 at 5:17
• At each of may constant-x surfaces, compute the distribution (in y) of lines that pass through it. Of course, this will require discretizing x-y space. Jun 27, 2015 at 6:29

Here is a method to compute a density function of a large number of arbitrary positive real functions.

Create a list of the functions required:

fs = Function[{s, t}, (1 + Cos[t - #]) (1 + Sin[s - #])] & /@
RandomReal[{0, 2 π}, {1000}];


Compute the density plot by mapping the arguments over the functions and then summing them:

DensityPlot[Plus @@ (#[x, y] & /@ fs), {x, 0, 2 π}, {y, 0, 2 π}] 