Hi Everyone,
I am not experienced with the different programming paradigms offered by the current version of Mathematica.
I have written the following code to produce visualisations of complex functions, in the style of Daniel Velleman's very nice plots.
My code runs pretty slowly.
Please can anyone give me some ideas for how to optimise it ?
Thank you very much !
Clear[complexcolourplot, f, saturationscalefactor,
brightnessscalefactor, sidelength, increment, phi, t,
halfsidelength, halfincrement, x, y];
phi[t_] := t/(1 + t);
complexcolourplot[f_, saturationscalefactor_, brightnessscalefactor_,
sidelength_, increment_] :=
Module[{halfsidelength, halfincrement, x, y},
halfsidelength = sidelength/2;
halfincrement = increment/2;
Graphics[
Table[{Hue[Arg[f[x + I y]]/(2 Pi),
1 - phi[saturationscalefactor Abs[f[x + I y]]],
phi[brightnessscalefactor Abs[f[x + I y]]]],
Rectangle[{x - halfincrement,
y - halfincrement}, {x + halfincrement,
y + halfincrement}]}, {x, -halfsidelength, halfsidelength,
increment}, {y, -halfsidelength, halfsidelength, increment}]]]
For example, here is the identity function, which shows which colours are assigned to which complex numbers:
complexcolourplot[Identity, .2, 2, 20, .2]
and here is a simple monomial:
Clear[f, z];
f[z_] := z^2;
complexcolourplot[f, .2, 2, 20, .2]