In [1]:
import numpy as np
import matplotlib.pyplot as plt


Populating the interactive namespace from numpy and matplotlib

In [21]:
def Deriva(pot,a,b, NPoints):
    h = (b-a)/(NPoints-1)
    pAdelante = np.roll(pot,-1)
    pAtras = np.roll(pot,1)
    dCentral = ((pAdelante-pAtras)/(2.0*h+1e-5))
    dCentral = dCentral[1:-1]
    return dCentral

In [22]:
datos = np.loadtxt('pot.dat')

In [27]:
N = 2000
x = datos[:,0][1:-1]
E = -Deriva(datos[:,1],0,100,N)

In [28]:
E


Out[28]:
array([  3.03036100e+04,   2.56458201e+04,   2.19869502e+04, ...,
         3.98364742e+00,   3.97574409e+00,   3.96786426e+00])

In [29]:
x


Out[29]:
array([  1.0990991,   1.1981982,   1.2972973, ...,  99.7027027,
        99.8018018,  99.9009009])

In [30]:
plt.scatter(x,E)
plt.title('Campo en funcion de ladistancia')
plt.xlabel('r')
plt.ylabel('$|E|$')
plt.savefig('campo.pdf')



In [ ]: