In [2]:
# iPython setup
%matplotlib inline
from IPython import display
#%config InlineBackend.close_figures = False

from sympy.interactive import printing
printing.init_printing(use_latex='mathjax')

import matplotlib.pyplot as plt

# supporting packages
import itertools

#%qtconsole

In [3]:
import numpy as np

Flows


In [4]:
import numpy as np
import sympy as sp
import mpp
mpp.DIM = 2
mpp.N = 2
mpp.SIGMA = 1.

In [5]:
mpp.test_functions();


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-eb42691e8c85> in <module>()
----> 1 mpp.test_functions();

TypeError: test_functions() takes exactly 1 argument (0 given)

In [29]:
#q = [[0.,.5],[0.,-.5]]
#p = [[1.,0.],[1.,0.]]
Nt = 1
phis = np.linspace(0,2*np.pi*(Nt-1)/Nt,Nt)
q = np.vstack( (np.sin(phis), np.cos(phis), ) ).T
p = -.5*np.vstack( (np.sin(phis), np.cos(phis), ) ).T
plt.plot(q[:,0],q[:,1])
plt.quiver(q[:,0],q[:,1],p[:,0],p[:,1])
plt.axis('equal');



In [30]:
mpp.N = q.shape[0]
state = mpp.weinstein_darboux_to_state(q,p)
(ts,ys)=mpp.integrate(state, T=.2)

In [31]:
mppenergy(state)-mpp.energy(ys[-1,:])


Out[31]:
$$0.0$$

In [32]:
np.save('state_data',ys)
np.save('time_data',ts)
np.save('setup',[mpp.N,mpp.DIM,mpp.eps,mpp.eta,mpp.pp,mpp.nn])

In [33]:
import generate_images


setup: N 1, DIM 2, eps 0, eta 1, p 2, n 2
generating png files
done

In [76]:
from PIL import Image
def load_image( infilename ) :
    img = Image.open( infilename )
    img.load()
    data = np.asarray( img )
    return data

frame = 'movie_frames/frame_19.png'
frame_im = load_image(frame)
plt.imshow(frame_im)
ax = plt.axes()
ax.axes.get_yaxis().set_visible(False)
ax.axes.get_xaxis().set_visible(False)
plt.setp(ax, frame_on=False);



In [50]:


In [ ]: