In [1]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [2]:
from sympy import *

In [3]:
init_printing()

In [4]:
g = symbols('gamma')
w = symbols('omega')
w0 = symbols('omega_0')
dn = symbols('delta_n')

In [32]:
subs = {dn:1, w0:115, g:2}

In [33]:
n_real = 1 + dn*(2*(w0 - w)*g)/((w0 - w)**2 + g**2)

In [34]:
n_imag = dn*(g**2)/((w0-w)**2 + g**2)

In [35]:
ng = n_real + w*diff(n_real,w)

In [48]:
plot(n_real.subs(subs),(w,100,125))
plot(n_imag.subs(subs),(w,100,125))
plot(ng.subs(subs),(w,100,125))


Out[48]:
<sympy.plotting.plot.Plot at 0x114d4d050>

In [ ]: