from matplotlib.pyplot import *
from mpl_toolkits.axes_grid.axislines import SubplotZero
from numpy import *
N, L, fs = 500., 15., 12.
M = [.5,3]
x1 = linspace(-L,L,N)
f = lambda x: sin(x) / x
g = lambda x: 1. - (x**2)/6.
y = lambda m,x: exp(m * f(x))
z = lambda m,x: exp(m * g(x))
fig = figure(figsize=(3,6))
ax1 = SubplotZero(fig,211)
ax2 = SubplotZero(fig,212)
fig.add_subplot(ax1)
fig.add_subplot(ax2)
ax1.axis["top"].set_visible(False)
ax1.axis["right"].set_visible(False)
ax1.axis["left"].set_axisline_style("->")
ax1.axis["bottom"].set_axisline_style("->")
ax1.set_yticks([0,.5,1,1.5])
ax1.set_xticks([-10,0,10])
ax2.axis["top"].set_visible(False)
ax2.axis["right"].set_visible(False)
ax2.axis["left"].set_axisline_style("->")
ax2.axis["bottom"].set_axisline_style("->")
ax2.set_yticks([0,5,10,15,20])
ax2.set_xticks([-10,0,10])
#ax.set_xlim(-1,10)
#ax.set_ylim(-3,3)
ax1.plot(x1,z(M[0],x1),'r',lw=2)
ax1.plot(x1,y(M[0],x1),'b',lw=2)
ax2.plot(x1,z(M[1],x1),'r',lw=2)
ax2.plot(x1,y(M[1],x1),'b',lw=2)
#ax.text(10,-2.8,u'$n$')
#ax.text(-.75,3,u'$X_n$')
fig.savefig
("Laplaces_method.svg",bbox_inches="tight",pad_inches=.15)