# Mobius Transformations

``````

In [1]:

%matplotlib inline
import sys; sys.path.append('..')
import matplotlib.pyplot as plt
import numpy as np

from conformalmapping import *

``````

Create a basic Mobius transformation.

``````

In [2]:

z3 = [1, 1j, -1]
w3 = [-1, -2j, 0]
m1 = Mobius.from_vectors(z3, w3)

``````

The Mobius transform is a conformal map

``````

In [3]:

if isinstance(m1, ConformalMap):
print('m1 is a conformal map.')
else:
print('m1 is not a conformal map.')

``````
``````

m1 is a conformal map.

``````

Plotting a conformal map gives an image in the range of a grid in the domain.

``````

In [4]:

m1.plot()

``````
``````

``````
``````

In [5]:

# Let's see that again in slow motion.
# (NOTE:
# Technically a Mobius map is an entire function, but for visualization
# convenience it uses the 3-vectors it was given on construction to define
# circles for its domain and range.)

# Plot the original
plt.subplot(1,2,1)
m1.domain.grid().plot()
m1.domain.plot()
plt.gca().set_xlim(-1.2,1.2)
plt.gca().set_ylim(-1.2,1.2)
plt.gca().set_aspect('equal')

# Plot the conformally mapped domain
plt.subplot(1,2,2)
m1(m1.domain.grid()).plot()
m1.range.plot()
plt.gca().set_aspect('equal')

``````
``````

``````
``````

In [6]:

# Another transformation for a composition example.
s3 = [0, 3, 1j]
m2 = Mobius.from_vectors(w3, s3)

``````