Dmitry Belyaev at Oxford is an expert on zero sets of functions composed form random plane waves and related problems. Here is an example he has looked at:

tic LW = 'linewidth'; XT = 'xtick'; YT = 'ytick'; FS = 'fontsize'; rng(1); a = randn(1,4) + 1i*rand(1,4); cheb.xy wave = @(k) real(a(1)*exp(i*pi*(k*x-y)) + a(2)*exp(i*pi*(k*x+y)) ... + a(3)*exp(i*pi*(k*y-x)) + a(4)*exp(i*pi*(k*y+x))); r = roots(wave(8)); plot(r, LW, 2) axis([-1 1 -1 1]), axis square, set(gca,XT,[],YT,[]) title(['number of components: ' int2str(size(r,2))],FS,12)

The Chebfun2 `roots`

command has picked out the distinct components of the zero set in the unit square: the result is a quasimatrix with 23 columns:

size(r)

ans = Inf 23

Here are the arc lengths of the pieces, sorted from smallest to largest:

arclength = @(f) norm(diff(f),1); np = size(r,2); al = zeros(np,1); for k = 1:np al(k) = arclength(r(:,k)); end sort(al)

ans = 0.462332000495365 0.469593881675550 0.471827328194039 0.485442458935588 0.491254619532166 0.512513541254507 0.533473811745957 0.716762824181920 1.049356894183591 1.051361726613542 1.081904486477993 1.270740175884586 1.337865116448304 1.425305902994319 1.534662678361227 1.542105031994015 1.792398615642381 2.447271420800797 2.472054349165598 2.737113953117976 2.872453451514048 4.280542705507891 5.347711530511945

Computations with `roots`

in Chebfun2 are delicate, and the number of components does not always come out right, nor are the curves always accurate. Here we seem to be doing well, though. We repeat the computation with $k=16$:

r = roots(wave(16)); plot(r, LW, 1.2) axis([-1 1 -1 1]), axis square, set(gca,XT,[],YT,[]) title(['number of components: ' int2str(size(r,2))],FS,12)

And with $k=32$:

r = roots(wave(32)); plot(r, LW, .7) axis([-1 1 -1 1]), axis square, set(gca,XT,[],YT,[]) title(['number of components: ' int2str(size(r,2))],FS,12)

Total time for this example:

toc

Elapsed time is 11.452681 seconds.