# Author: Ika, 2013-08-24
import math as m
import numpy as np
import matplotlib.pyplot as plt
import scipy.special as sp
import random
plt.figure()
plt.axes([0.02,0.13,0.9,0.8])
plt.hold(True)
Q = []
# Draw the function curves.
X = np.arange(-3, 3, 0.001)
i=1
Y = 1+(-1)**i*(X**(-2*i))/m.factorial(i)
a = plt.plot(X, Y, '-', color='#b30000', lw=4)
Q.append(a)
i=2
Y = Y+(-1)**i*(X**(-2*i))/m.factorial(i)
a = plt.plot(X, Y, '-', color='#00b300', lw=4)
Q.append(a)
i=3
Y = Y+(-1)**i*(X**(-2*i))/m.factorial(i)
a = plt.plot(X, Y, '-', color='#0000b3', lw=4)
Q.append(a)
i=4
Y = Y+(-1)**i*(X**(-2*i))/m.factorial(i)
a = plt.plot(X, Y, '-', color='#b3b300', lw=4)
Q.append(a)
i=5
Y = Y+(-1)**i*(X**(-2*i))/m.factorial(i)
a = plt.plot(X, Y, '-', color='#00b3b3', lw=4)
Q.append(a)
i=6
Y = Y+(-1)**i*(X**(-2*i))/m.factorial(i)
a = plt.plot(X, Y, '-', color='#b300b3', lw=4)
Q.append(a)
i=7
Y = Y+(-1)**i*(X**(-2*i))/m.factorial(i)
a = plt.plot(X, Y, '-', color='#b3b3b3', lw=4)
Q.append(a)
while (i<50):
i=i+1
Y = Y+(-1)**i*(X**(-2*i))/m.factorial(i)
a = plt.plot(X, Y, '-', color='#33b300', lw=4)
Q.append(a)
Y = np.exp(-1/(X*X))
a = plt.plot(X, Y, '-', color='black', lw=4)
Q.append(a)
plt.xlim(-3,3)
plt.ylim(-2,4)
# Set up the spines
ax = plt.gca()
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.xaxis.set_ticks_position('bottom')
ax.spines['bottom'].set_position(('data',0))
ax.yaxis.set_ticks_position('left')
ax.spines['left'].set_position(('data',0))
plt.savefig("Expinvsqlau_SVG.svg")