Waves radiating from the Mandelbrot set: Index of refraction decreasing with escape time
Channel: Nils Berglund
Date: 2022-05-24

This variant of the video https://youtu.be/QPuRUmlwXCI shows waves escaping the Mandelbrot set, but when the index of refraction of the medium outside the set decreases as one gets further away from it. As a result, waves accelerate as they move away from the set. A forthcoming video will show what happens when the index of refraction increases instead of decreasing. 
To choose the index of refraction at point c = x + i*y, the code computes the sequence defined by z(0) = 0 and z(n+1) = z(n)^2 + c, until either the modulus of z exceeds 100, or n = 1000. In the latter case, the point is considered as being in the Mandelbrot set. In the former case, the index of refraction decreases like 1/log(n). The logarithmic dependence on n has been chosen to partly compensate for the fact that orbits starting outside the set tend to accelerate more and more (the distance to the origin at time n varies approximately like r(n) = r(0)^(2^n)). One can see that the effect of n being discrete in the radiating wave pattern. 
The simulation has two parts, showing the same solution of the wave equation with two different color gradients:
Average wave energy: 0:00
Average wave energy (log scale): 1:08
In both parts, the height of the surface and color hue represent the energy of the wave integrated (or summed) from the beginning of the simulation to the current time, except that a logarithmic scale is used in the second part. The energy is the sum of the kinetic energy (proportional to the square of the time derivative of the wave height) and of the potential energy (proportional to the norm squared of the spatial gradient). It behaves roughly like the square of the wave height, which is why it oscillates approximately with twice the spatial frequency.
In both parts, the luminosity depends on the cosine of the angle between a normal vector to the surface, and a constant direction representing the position of a light source. There are imperfect absorbing boundary conditions on the sides of the displayed rectangular region. 

Render time: 58 minutes 15 seconds
Color scheme: Part 1 - Viridis by Nathaniel J. Smith, Stefan van der Walt and Eric Firing
https://github.com/BIDS/colormap
Part 2 - Magma by Nathaniel J. Smith and Stefan van der Walt
https://github.com/BIDS/colormap
https://github.com/yuki-koyama/tinycolormap

Music: "Plaidness" by Francis Preve@francispreve

See also https://images.math.cnrs.fr/Des-ondes-dans-mon-billard-partie-I.html for more explanations (in French) on  a few previous simulations of wave equations. 

The simulation solves the wave equation by discretization. The algorithm is adapted from the paper https://hplgit.github.io/fdm-book/doc/pub/wave/pdf/wave-4print.pdf 
C code: https://github.com/nilsberglund-orleans/YouTube-simulations
https://www.idpoisson.fr/berglund/software.html
Many thanks to my colleague Marco Mancini for helping me to accelerate my code!