I want to generate a set of $N$ random waves, where the wave vector and phase are random numbers, this is my code
`Nwaves = 3;
theta := 2*Pi*RandomReal[];
phi := ArcCos@RandomReal[{-1, 1}] ;
alpha := RandomReal[{0, 1}];
u = Sum[ Sin[ Cos[theta] Sin[phi] x + Sin[theta] Sin[phi] y +
Cos[theta] z + alpha], {Nwaves}]
v = Sum[-Cos[ Cos[theta] Sin[phi] x + Sin[theta] Sin[phi] y +
Cos[theta] z + alpha], {Nwaves}]`
This code changes the parameters for each N. And the problem needs to have the same values for cosine, sine, and alpha. And after each iteration they have to change as N varies.
u
andv
tou:=
andv:=
you can get different waves. Each of theu
andv
are generated by different wave pararmeters as you have settheta
andalpha
to beRandomReal
. $\endgroup$