Hi everyone, My first post in 2018..
Well, this post does not have any mathematics. Rather, this post is about, as the title says, visualizing conformal mapping. I recently came across an amazing Youtube Channel, 3Blue1Brown. If you haven't seen it, you should definitely check it out.
Most of the videos are pretty amazing. If you think Mathematics is beautiful with just equations, then visualizing Math is possibly the only thing better than Math itself (in my humble opinion).
Especially the video Visualizing the Riemann Zeta function is outstanding, simply the best video I've seen on Youtube, I think. Ever since I saw that, I wanted to create those animations. A simple Google search led me the fact that Grant Sanderson, creator of the Channel, uses his own Python module manim to create these animations.
I'm just a beginner in Python and using a specialized module is far from my relationship with Python. So I turned to the next best thing at my disposal, Mathematica. It took me about four evenings to get everything right to get an Animation and save it as GIF using Mathematica. But now after seeing those animations, I feel like it's really worth it.
So here's one of my first animations. The Inverse of a complex number.
Pretty neat, don't you think?
Now for the Zeta function itself. Mathematica takes about 5 mins to create the following animation.
Look at that.. So beautiful...
Moreover, looking at the two mappings we can get to see how the Zeta function has a simple pole at 1. Both graphs look almost the same at the final stage except that the Zeta function is translated by a unit distance along the real axis.
I also created one with a darker background but it doesn't look all that nice. The different colors are not by choice. In fact I'm not sure how to make all the curves along the real axis look the same color. Hope you would let me know in case you are aware of that.
Now for the code.
Clear["Global`*"];
f[z_] := Zeta[z];
Lim = 5;
DiscreteXValues =
Join[Range[-Lim, -2], Table[j/10, {j, -15, 15}],
Range[2, Lim]]; ContinuousYValues = {-Lim, Lim};
DiscreteYValues =
Join[Range[-Lim, -2], Table[j/10, {j, -15, 15}],
Range[2, Lim]]; ContinuousXValues = {-Lim, Lim};
RangeofthePlot = {{-Lim, Lim}, {-Lim, Lim}};
slides = Table[
Show[ParametricPlot[
Evaluate[
Table[{XVaries (1 - t) + t Re[f[XVaries + I k]],
k (1 - t) + t Im[f[XVaries + I k]]}, {k,
DiscreteYValues}]], {XVaries, First[ContinuousXValues],
Last[ContinuousXValues]}],
ParametricPlot[
Evaluate[
Table[{k (1 - t) + t Re[f[k + I YVaries]],
YVaries (1 - t) + t Im[f[k + I YVaries]]}, {k,
DiscreteXValues}]], {YVaries, First[ContinuousYValues],
Last[ContinuousYValues]}], PlotRange -> RangeofthePlot,
AxesOrigin -> {0, 0}, GridLines -> Automatic], {t, 0, 1,
1/40}]; // AbsoluteTiming
ListAnimate[slides, AnimationDirection -> ForwardBackward,
AnimationRunning -> True, AnimationRate -> 8]
(*Export["ZetaFunction.gif",slides,ConversionRules\[Rule]{\
"ControlAppearance"\[Rule]None,"DisplayDurations"\[Rule]1/5}]*)
Export["ZetaFunction.gif",
Flatten[{slides,
Table[slides[[i]], {i, Length[slides] - 1, 2, -1}]}],
"ControlAppearance" -> None, "DisplayDurations" -> 1/8]
After several iterations, I ended up with the above. It has options to control how many grid lines you want in each direction, and for each of them how long you wanna plot in the perpendicular direction. Play with DiscreteXValues, DiscreteYValues, ContinuousXValues and ContinuousYValues.
And before I finish, while we are on the 3Blue1Brown, his video on Pi hiding in prime irregularities, inspired me to find the following two 'non-obvious' results.
$\displaystyle \frac{\sqrt{2}\pi}{5}=\left\vert \frac{1}{1} + \frac{i}{2}- \frac{i}{3} - \frac{1}{4} + \frac{1}{5} + \frac{i}{6} - \frac{i}{7} - \frac{1}{8} + \cdots\right\vert$
$\displaystyle \frac{\pi}{\sqrt{10}}=\left\vert \frac{1}{1} + \frac{i}{3}- \frac{i}{7} - \frac{1}{9} + \frac{1}{11} + \frac{i}{13} - \frac{i}{17} - \frac{1}{19} + \cdots\right\vert$
Hope you enjoyed them.
Until then,
Yours Aye
Me.
Well, this post does not have any mathematics. Rather, this post is about, as the title says, visualizing conformal mapping. I recently came across an amazing Youtube Channel, 3Blue1Brown. If you haven't seen it, you should definitely check it out.
Most of the videos are pretty amazing. If you think Mathematics is beautiful with just equations, then visualizing Math is possibly the only thing better than Math itself (in my humble opinion).
Especially the video Visualizing the Riemann Zeta function is outstanding, simply the best video I've seen on Youtube, I think. Ever since I saw that, I wanted to create those animations. A simple Google search led me the fact that Grant Sanderson, creator of the Channel, uses his own Python module manim to create these animations.
I'm just a beginner in Python and using a specialized module is far from my relationship with Python. So I turned to the next best thing at my disposal, Mathematica. It took me about four evenings to get everything right to get an Animation and save it as GIF using Mathematica. But now after seeing those animations, I feel like it's really worth it.
So here's one of my first animations. The Inverse of a complex number.
Pretty neat, don't you think?
Now for the Zeta function itself. Mathematica takes about 5 mins to create the following animation.
Look at that.. So beautiful...
Moreover, looking at the two mappings we can get to see how the Zeta function has a simple pole at 1. Both graphs look almost the same at the final stage except that the Zeta function is translated by a unit distance along the real axis.
I also created one with a darker background but it doesn't look all that nice. The different colors are not by choice. In fact I'm not sure how to make all the curves along the real axis look the same color. Hope you would let me know in case you are aware of that.
Now for the code.
Clear["Global`*"];
f[z_] := Zeta[z];
Lim = 5;
DiscreteXValues =
Join[Range[-Lim, -2], Table[j/10, {j, -15, 15}],
Range[2, Lim]]; ContinuousYValues = {-Lim, Lim};
DiscreteYValues =
Join[Range[-Lim, -2], Table[j/10, {j, -15, 15}],
Range[2, Lim]]; ContinuousXValues = {-Lim, Lim};
RangeofthePlot = {{-Lim, Lim}, {-Lim, Lim}};
slides = Table[
Show[ParametricPlot[
Evaluate[
Table[{XVaries (1 - t) + t Re[f[XVaries + I k]],
k (1 - t) + t Im[f[XVaries + I k]]}, {k,
DiscreteYValues}]], {XVaries, First[ContinuousXValues],
Last[ContinuousXValues]}],
ParametricPlot[
Evaluate[
Table[{k (1 - t) + t Re[f[k + I YVaries]],
YVaries (1 - t) + t Im[f[k + I YVaries]]}, {k,
DiscreteXValues}]], {YVaries, First[ContinuousYValues],
Last[ContinuousYValues]}], PlotRange -> RangeofthePlot,
AxesOrigin -> {0, 0}, GridLines -> Automatic], {t, 0, 1,
1/40}]; // AbsoluteTiming
ListAnimate[slides, AnimationDirection -> ForwardBackward,
AnimationRunning -> True, AnimationRate -> 8]
(*Export["ZetaFunction.gif",slides,ConversionRules\[Rule]{\
"ControlAppearance"\[Rule]None,"DisplayDurations"\[Rule]1/5}]*)
Export["ZetaFunction.gif",
Flatten[{slides,
Table[slides[[i]], {i, Length[slides] - 1, 2, -1}]}],
"ControlAppearance" -> None, "DisplayDurations" -> 1/8]
After several iterations, I ended up with the above. It has options to control how many grid lines you want in each direction, and for each of them how long you wanna plot in the perpendicular direction. Play with DiscreteXValues, DiscreteYValues, ContinuousXValues and ContinuousYValues.
And before I finish, while we are on the 3Blue1Brown, his video on Pi hiding in prime irregularities, inspired me to find the following two 'non-obvious' results.
$\displaystyle \frac{\sqrt{2}\pi}{5}=\left\vert \frac{1}{1} + \frac{i}{2}- \frac{i}{3} - \frac{1}{4} + \frac{1}{5} + \frac{i}{6} - \frac{i}{7} - \frac{1}{8} + \cdots\right\vert$
$\displaystyle \frac{\pi}{\sqrt{10}}=\left\vert \frac{1}{1} + \frac{i}{3}- \frac{i}{7} - \frac{1}{9} + \frac{1}{11} + \frac{i}{13} - \frac{i}{17} - \frac{1}{19} + \cdots\right\vert$
Hope you enjoyed them.
Until then,
Yours Aye
Me.
How did you make that gif. I have been using java from long time and i still feels difficult to produce these graphs and animation. Can you help me out?
ReplyDeleteLooking at thw code seems to tell that mathematica is designed for that nope?
ReplyDelete