Implement rms without numpy
<p>I have to implement a function to calculate rms without using numpy, using data that is in txt. I have the following:</p>

<pre><code>import numpy as np
import matplotlib.pyplot as plt
import math

def main():

    # Cargando los datos

    avrgPress = []
    press = []

    with open("C:\Users\SAULO\Downloads\prvspy.txt","r") as a:
        for x in a:
            columnas = x.split('\t')
            avrgPress.append(float(columnas[0]))
            press.append(float(columnas[1]))

def error(avrgPress, press):
    lista3 = [0]*len(lista)
    for x in xrange(len(lista)):
        lista3[x] = lista3[x] * sum(sqrt(float(1.0/1064) * (avrgPress - press)**2)) 
    return lista3

if __name__ == '__main__':
    main()
</code></pre>

<p>When you are building, not out rms. Any suggestions or solution?</p>

<p>Is this what you want, <code>rms( avrgPress )</code> ?</p>

<pre><code>from __future__ import division  # necessary
import math

def rms( alist ):
    """ rms( [1, 2, 3] ) = sqrt( average( 1**2 + 2**2 + 3**2 )) = 2.16 """
    sum_squares = sum([ x**2 for x in alist ])
    return math.sqrt( sum_squares / len(alist) )

...
print rms( [1, 2, 3] )
</code></pre>

python matplotlib