#!/usr/bin/env python # coding: utf-8 # # Periodic Spline # # This notebook replicates spec_splinep.m as an Jupyter/IPython notebook # In[3]: get_ipython().run_line_magic('matplotlib', 'inline') import matplotlib.pyplot as plt import numpy as np import sys; sys.path.append('..') from conformalmapping import * # In[5]: # Python Syntax for complex numbers is uses j rather than i pts = [ 0.5896 + 1.2486j, -0.1426 + 1.5954j, -0.9133 + 1.1561j, -0.8465 + 0.3536j, -1.1116 - 0.2398j, -1.2695 - 0.9643j, -0.5660 - 1.1075j, 0.2013 - 0.7552j, 0.8362 - 0.9634j, 1.5838 - 0.7013j, 1.3141 + 0.4008j, 0.8474 + 0.7291j ] # This looks slightly different to the matlab - we'll use a classmethod # constructor rather than trying to combine all the overloads into one # place. This makes testing a little easier, and it makes coverage testing # a lot easier. s = Splinep.from_complex_list(pts) print s # In[6]: ts = np.linspace(0.0, 1.0, 201) ps = s.point(ts) plt.plot(ps.real, ps.imag) plt.plot(s.zpts.real, s.zpts.imag, 'r.') plt.gca().set_aspect('equal') # In[ ]: