-
Notifications
You must be signed in to change notification settings - Fork 0
/
moebius.html
313 lines (254 loc) · 22 KB
/
moebius.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>fritzm.github.io - Moebious transformation animated GIFs</title>
<meta name="description" content="">
<meta name="author" content="Fritz Mueller">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="https://fritzm.github.io/theme/html5.js"></script>
<![endif]-->
<!-- Le styles -->
<link href="https://fritzm.github.io/theme/bootstrap.min.css" rel="stylesheet">
<link href="https://fritzm.github.io/theme/bootstrap.min.responsive.css" rel="stylesheet">
<link href="https://fritzm.github.io/theme/local.css" rel="stylesheet">
<link href="https://fritzm.github.io/theme/pygments.css" rel="stylesheet">
<!-- Photoswipe -->
<link rel="stylesheet" href="https://fritzm.github.io/theme/photoswipe.css">
<link rel="stylesheet" href="https://fritzm.github.io/theme/default-skin/default-skin.css">
<script src="https://fritzm.github.io/theme/photoswipe.min.js"></script>
<script src="https://fritzm.github.io/theme/photoswipe-ui-default.min.js"></script>
<script src="https://fritzm.github.io/galleries.js"></script>
<script type="text/javascript">
var pswipe = function(gname, index) {
var pswpElement = document.querySelectorAll('.pswp')[0];
var items = galleries[gname];
var options = { index: index };
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
gallery.init();
};
</script>
<!-- So Firefox can bookmark->"abo this site" -->
<link href="https://fritzm.github.io/feeds/all.rss.xml" rel="alternate" title="fritzm.github.io" type="application/rss+xml">
</head>
<body>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="https://fritzm.github.io">fritzm.github.io</a>
<div class="nav-collapse">
<ul class="nav">
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<div class="content">
<div class="row">
<div class="span9">
<div class='article'>
<div class="content-title">
<h1>Moebious transformation animated GIFs</h1>
Mon 01 December 2014
by <a class="url fn" href="https://fritzm.github.io/author/fritz-mueller.html">Fritz Mueller</a>
</div>
<div><p>Here are some animated GIFs that I created a few years ago with MATLAB. These characterize the action of the four classes of Moebius transformations, mapping the complex plane to itself. They were inspired by the illustrations and analysis in a section of Tristan Needham's excellent book <a href="http://books.google.com/books?vid=ISBN0198534469"><em>Visual Complex Analysis</em></a>:</p>
<figure><img src="/images/moebius/elliptic.gif"><figcaption>elliptic</figcaption></figure>
<figure><img src="/images/moebius/hyperbolic.gif"><figcaption>hyperbolic</figcaption></figure>
<figure><img src="/images/moebius/loxodromic.gif"><figcaption>loxodromic</figcaption></figure>
<figure><img src="/images/moebius/parabolic.gif"><figcaption>parabolic</figcaption></figure>
<p>So what's it all about? A Moebius transformation is a mapping on the complex numbers of the form </p>
<div class="math">$$ M(z) = \frac{az + b}{cz + d}, $$</div>
<p> where <span class="math">\(a, b, c, d\)</span> are complex constants. Moebius tranformations have many nice features: they are one-to-one and onto on the complex plane (extended with the addition of the "point at <span class="math">\(\infty\)</span>"), they form a group under composition, they are conformal (angle preserving). Interestingly, though conformality only implies that they map infinitesimal circles to other infinitesimal circles, Moebius transformations actually map circles of <em>any</em> size in the complex plane to other circles in the plane. For a really nice exposition and proofs of these qualities, see Needham.</p>
<p>Fixed points on the plane under a Moebius transform will simply be solutions of </p>
<div class="math">$$ z = \frac{az+b}{cz+d}, $$</div>
<p> which is just quadratic in <span class="math">\(z\)</span>. So a (non-identity) Moebius transform will have at most two fixed points, or one when there is a repeated root. Following Needham, for the remainder of this discussion we'll refer to the fixed points of a given Moebius transformation as <span class="math">\(\xi_+\)</span>, <span class="math">\(\xi_-\)</span> in the two root case, or just <span class="math">\(\xi\)</span> in the repeated root case.</p>
<p>Most of the qualities above are readily observable in the animations: one or two fixed points, circles mapping to circles, one-to-one, easy to imagine extension to the whole plane. Conformality is a little harder to see, but if you look closely you can see that the angles at each of the corners in these crazed checkerboards always remain 90°.</p>
<p>The GIFs were generated using a transform method. Given a Moebius transformation with two fixed points (we will revisit the single fixed point case shortly), consider the additional Moebius transformation defined by </p>
<div class="math">$$ F(z) = \frac{z - \xi_+}{z - \xi_-}. $$</div>
<p> This will send <span class="math">\(\xi_+\)</span> to <span class="math">\(0\)</span>, and <span class="math">\(\xi_-\)</span> to <span class="math">\(\infty\)</span>. We can now construct </p>
<div class="math">$$ \widetilde{M} = F \circ M \circ F^{-1}, $$</div>
<p> which is itself a Moebius transformation (since the Moebius transformations are a group under composition) and which will have fixed points at <span class="math">\(0\)</span> and <span class="math">\(\infty\)</span>. We can consider <span class="math">\(M\)</span> and <span class="math">\(\widetilde{M}\)</span> to be a transform pair; for any <span class="math">\(M\)</span> there is a corresponding <span class="math">\(\widetilde{M}\)</span> with fixed points at <span class="math">\(0\)</span> and <span class="math">\(\infty\)</span>.</p>
<p>Now it turns out that Moebius transformations with fixed points at both <span class="math">\(0\)</span> and <span class="math">\(\infty\)</span> reduce to a particularly simple form — that of a single complex multiplication, i.e. just a dilation and/or rotation about the origin of the complex plane. See Needham for exposition of this. The elliptic, hyperbolic, and loxodromic classes of Moebius transformations turn out to be those whose corresponding <span class="math">\(\widetilde{M}\)</span> is a pure rotation, pure dilation, or general combination of the two, respectively.</p>
<p>To generate these GIFs, we decorate the complex plane on the <span class="math">\(\widetilde{M}\)</span> side like a circular checkerboard or dart board, and represent the action of a given class of <span class="math">\(\widetilde{M}\)</span> transformations by rotating it, dilating it, or a combination of both, e.g.:</p>
<figure><img src="/images/moebius/pre-elliptic.gif"><figcaption>elliptic \(\widetilde{M}\)</figcaption></figure>
<figure><img src="/images/moebius/pre-hyperbolic.gif"><figcaption>hyperbolic \(\widetilde{M}\)</figcaption></figure>
<p>On the <span class="math">\(M\)</span> side, we can pick fixed points <span class="math">\(\xi_+\)</span>, <span class="math">\(\xi_-\)</span> wherever we like, and then derive the corresponding <span class="math">\(F\)</span> as above. For each frame, we take each point on the <span class="math">\(M\)</span> side, map it through <span class="math">\(F\)</span> to find the corresponding point on the <span class="math">\(\widetilde{M}\)</span> side, and check that against a dynamic checkerboard model to see if the point should be black or white in this frame.</p>
<p>Returning to the repeated root, single fixed point case: we treat this similarly, but set </p>
<div class="math">$$ F = \frac{1}{z - \xi}, $$</div>
<p> which sends <span class="math">\(\xi\)</span> to <span class="math">\(\infty\)</span>. As before, it turns out that Moebius transformations of this form (repeated fixed point at <span class="math">\(\infty\)</span>) reduce to a very simple form: this time, a pure translation. The parabolic class of Moebius transformations are those whose corresponding <span class="math">\(\widetilde{M}\)</span> transformation is a pure translation. To illustrate these, we use a translating dynamic checkerboard on the <span class="math">\(\widetilde{M}\)</span> side that looks like this:</p>
<figure><img src="/images/moebius/pre-parabolic.gif"><figcaption>parabolic \(\widetilde{M}\)</figcaption></figure>
<p>All of this can be done quite succinctly in MATLAB, once it is understood what needs to be done. Below is the MATLAB snippet which was used to generate these GIFs. Commenting and uncommenting various lines chooses different <span class="math">\(F\)</span> and <span class="math">\(\widetilde{M}\)</span> side checkerboard models, resulting in the different outputs.</p>
<p>The first few lines create a 512x512 matrix of complex numbers, ranging from -3 to 3 on both the real and imaginary axes, to represent a portion of the complex plane. This is then pre-mapped through an appropriate <span class="math">\(F\)</span>. The <code>for</code> loop iterates on each frame. The dynamic checkerboard result is calculated as the <code>xor</code> of various versions of functions <code>g1</code> and <code>g2</code> operating over the premapped points. Each frame is downsampled and written to disk as a separate file, then at the end all the frames are stitched into a movie. I must then have used some non-matlab utility to convert the movies to animated GIFs, but I'm not sure what that was...</p>
<div class="highlight"><pre><span></span><span class="n">Z</span> <span class="p">=</span> <span class="o">-</span><span class="mi">3</span><span class="p">:</span><span class="mi">6</span><span class="o">/</span><span class="mi">512</span><span class="p">:</span><span class="mi">3</span><span class="o">-</span><span class="p">(</span><span class="mi">6</span><span class="o">/</span><span class="mi">512</span><span class="p">);</span> <span class="n">Z</span> <span class="p">=</span> <span class="n">Z</span><span class="p">(</span><span class="nb">ones</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="nb">length</span><span class="p">(</span><span class="n">Z</span><span class="p">)),:);</span> <span class="n">Z</span> <span class="p">=</span> <span class="nb">complex</span><span class="p">(</span><span class="n">Z</span><span class="p">,</span><span class="n">Z</span><span class="o">'</span><span class="p">);</span>
<span class="c">%Z = 1 ./ Z; % one finite fixed point</span>
<span class="n">Z</span> <span class="p">=</span> <span class="p">(</span><span class="n">Z</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span><span class="o">./</span><span class="p">(</span><span class="n">Z</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span> <span class="c">% two finite fixed points</span>
<span class="n">im</span> <span class="p">=</span> <span class="p">[];</span> <span class="n">g1</span> <span class="p">=</span> <span class="p">[];</span> <span class="n">g2</span> <span class="p">=</span> <span class="p">[];</span>
<span class="k">for</span> <span class="n">frame</span> <span class="p">=</span> <span class="mi">1</span><span class="p">:</span><span class="mi">30</span>
<span class="n">g1</span> <span class="p">=</span> <span class="nb">mod</span><span class="p">(</span><span class="nb">log</span><span class="p">(</span><span class="nb">abs</span><span class="p">(</span><span class="n">Z</span><span class="p">))</span><span class="o">*</span><span class="mi">4</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span><span class="o"><</span><span class="mi">1</span><span class="p">;</span> <span class="c">% radial, static</span>
<span class="c">% g1 = mod(log(abs(Z))*4+(frame-1)/15,2)<1; % radial, dynamic</span>
<span class="c">% g1 = mod(real(Z)+(frame-1)*.8/30,.8)<.4; % vertical, dynamic</span>
<span class="c">% g2 = mod(angle(Z), pi/6)<(pi/12); % circumferential, static</span>
<span class="n">g2</span> <span class="p">=</span> <span class="nb">mod</span><span class="p">(</span><span class="nb">angle</span><span class="p">(</span><span class="n">Z</span><span class="p">)</span><span class="o">+</span><span class="p">(</span><span class="n">frame</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="nb">pi</span><span class="o">/</span><span class="mi">180</span><span class="p">,</span> <span class="nb">pi</span><span class="o">/</span><span class="mi">6</span><span class="p">)</span><span class="o"><</span><span class="p">(</span><span class="nb">pi</span><span class="o">/</span><span class="mi">12</span><span class="p">);</span> <span class="c">% circumferential, dynamic</span>
<span class="c">% g2 = mod(imag(Z),.8)<.4; % horizontal, static</span>
<span class="n">im</span><span class="p">(:,:,</span><span class="mi">1</span><span class="p">,</span><span class="n">frame</span><span class="p">)</span> <span class="p">=</span> <span class="n">imresize</span><span class="p">(</span><span class="n">xor</span><span class="p">(</span><span class="n">g1</span><span class="p">,</span><span class="n">g2</span><span class="p">),</span> <span class="p">.</span><span class="mi">25</span><span class="p">,</span> <span class="s">'bilinear'</span><span class="p">);</span>
<span class="n">imwrite</span><span class="p">(</span><span class="n">im</span><span class="p">(:,:,</span><span class="mi">1</span><span class="p">,</span><span class="n">frame</span><span class="p">),</span> <span class="n">sprintf</span><span class="p">(</span><span class="s">'frame%.2d.bmp'</span><span class="p">,</span> <span class="n">frame</span><span class="p">));</span>
<span class="k">end</span>
<span class="n">mov</span> <span class="p">=</span> <span class="n">immovie</span><span class="p">(</span><span class="mi">255</span><span class="o">*</span><span class="n">im</span><span class="p">,</span><span class="n">gray</span><span class="p">(</span><span class="mi">255</span><span class="p">));</span>
<span class="n">movie</span><span class="p">(</span><span class="n">mov</span><span class="p">,</span><span class="mi">50</span><span class="p">);</span>
</pre></div>
<script type="text/javascript">if (!document.getElementById('mathjaxscript_pelican_#%@#$@#')) {
var align = "center",
indent = "0em",
linebreak = "false";
if (false) {
align = (screen.width < 768) ? "left" : align;
indent = (screen.width < 768) ? "0em" : indent;
linebreak = (screen.width < 768) ? 'true' : linebreak;
}
var mathjaxscript = document.createElement('script');
mathjaxscript.id = 'mathjaxscript_pelican_#%@#$@#';
mathjaxscript.type = 'text/javascript';
mathjaxscript.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/latest.js?config=TeX-AMS-MML_HTMLorMML';
var configscript = document.createElement('script');
configscript.type = 'text/x-mathjax-config';
configscript[(window.opera ? "innerHTML" : "text")] =
"MathJax.Hub.Config({" +
" config: ['MMLorHTML.js']," +
" TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'none' } }," +
" jax: ['input/TeX','input/MathML','output/HTML-CSS']," +
" extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']," +
" displayAlign: '"+ align +"'," +
" displayIndent: '"+ indent +"'," +
" showMathMenu: true," +
" messageStyle: 'normal'," +
" tex2jax: { " +
" inlineMath: [ ['\\\\(','\\\\)'] ], " +
" displayMath: [ ['$$','$$'] ]," +
" processEscapes: true," +
" preview: 'TeX'," +
" }, " +
" 'HTML-CSS': { " +
" availableFonts: ['STIX', 'TeX']," +
" preferredFont: 'STIX'," +
" styles: { '.MathJax_Display, .MathJax .mo, .MathJax .mi, .MathJax .mn': {color: 'inherit ! important'} }," +
" linebreaks: { automatic: "+ linebreak +", width: '90% container' }," +
" }, " +
"}); " +
"if ('default' !== 'default') {" +
"MathJax.Hub.Register.StartupHook('HTML-CSS Jax Ready',function () {" +
"var VARIANT = MathJax.OutputJax['HTML-CSS'].FONTDATA.VARIANT;" +
"VARIANT['normal'].fonts.unshift('MathJax_default');" +
"VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
"VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
"VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
"});" +
"MathJax.Hub.Register.StartupHook('SVG Jax Ready',function () {" +
"var VARIANT = MathJax.OutputJax.SVG.FONTDATA.VARIANT;" +
"VARIANT['normal'].fonts.unshift('MathJax_default');" +
"VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
"VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
"VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
"});" +
"}";
(document.body || document.getElementsByTagName('head')[0]).appendChild(configscript);
(document.body || document.getElementsByTagName('head')[0]).appendChild(mathjaxscript);
}
</script></div>
<hr>
</div>
</div>
<div class="span3">
<div class="well" style="padding: 8px 0; background-color: #FBFBFB;">
<ul class="nav nav-list">
<li class="nav-header">
Site
</li>
<li><a href="https://fritzm.github.io/archives.html">Archives</a>
<li><a href="https://fritzm.github.io/tags.html">Tags</a>
<li><a href="https://fritzm.github.io/feeds/all.rss.xml" rel="alternate">RSS feed</a></li>
</ul>
</div>
<div class="well" style="padding: 8px 0; background-color: #FBFBFB;">
<ul class="nav nav-list">
<li class="nav-header">
Categories
</li>
<li><a href="https://fritzm.github.io/category/arcade-games.html">Arcade Games</a></li>
<li><a href="https://fritzm.github.io/category/math.html">Math</a></li>
<li><a href="https://fritzm.github.io/category/micros.html">Micros</a></li>
<li><a href="https://fritzm.github.io/category/pdp-11.html">PDP-11</a></li>
<li><a href="https://fritzm.github.io/category/programming.html">Programming</a></li>
<li><a href="https://fritzm.github.io/category/radios.html">Radios</a></li>
</ul>
</div>
<div class="social">
<div class="well" style="padding: 8px 0; background-color: #FBFBFB;">
<ul class="nav nav-list">
<li class="nav-header">
Social
</li>
<li><a href="http://facebook.com/fritzmueller">facebook</a></li>
<li><a href="http://instagram.com/infrafritz">Instagram</a></li>
<li><a href="http://www.linkedin.com/pub/fritz-mueller/a/679/62/">LinkedIn</a></li>
<li><a href="http://jsfiddle.net/user/fritzm/fiddles/">JSFiddle</a></li>
<li><a href="https://github.com/fritzm">GitHub</a></li>
</ul>
</div>
</div>
</div>
</div> </div>
<footer>
<br />
<p><a href="https://fritzm.github.io">fritzm.github.io</a> © Fritz Mueller 2023</p>
</footer>
</div> <!-- /container -->
<!-- Photoswipe -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
<div class="pswp__bg"></div>
<div class="pswp__scroll-wrap">
<div class="pswp__container">
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class="pswp__item"></div>
</div>
<div class="pswp__ui pswp__ui--hidden">
<div class="pswp__top-bar">
<div class="pswp__counter"></div>
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
<button class="pswp__button pswp__button--share" title="Share"></button>
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
<div class="pswp__preloader">
<div class="pswp__preloader__icn">
<div class="pswp__preloader__cut">
<div class="pswp__preloader__donut"></div>
</div>
</div>
</div>
</div>
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
<div class="pswp__share-tooltip"></div>
</div>
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
</button>
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
</button>
<div class="pswp__caption">
<div class="pswp__caption__center"></div>
</div>
</div>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://fritzm.github.io/theme/bootstrap-collapse.js"></script>
</body>
</html>