[ create a new paste ] login | about

Link: http://codepad.org/E9zll3yR    [ raw code | output | fork ]

Python, pasted on Jan 7:
class Graficos(object):
    def __init__(self):
        self.rango = X
        self.funcion = Y
        self.titulo = t
        if m == 'f1':
            X = np.linspace(-100,100,1000)
            Y = (3*X)/(np.sqrt(X**2))
            t = '(3*X)/(np.sqrt(X**2)'
        if m == 'f2':
            X = np.linspace(-100,100,1000)
            Y = (X+5)
            t = 'X+5'
        if m == 'f3':
            X = np.linspace(1,10,50)
            Y = (np.log (X))/X
            t = 'lnx/x'
        if m == 'f4':
            X = np.linspace(-100,100,1000)
            Y = (X*2)*(np.exp(x**2))
            t = '2x *e(x**2)'
    def histograma (self):
        plt.figure ('histograma')
        plt.title (self.titulo)
        plt.hist(self.funcion,10000, self.rango)
        plt.show ()
if __name__=='__main__':
    m=raw_input('Introduce la funciĆ³n que quieres mostrar: ')
    g=Graficos()
    g.histograma()


Output:
1
2
  Line 28
SyntaxError: Non-ASCII character '\xc3' in file t.py on line 28, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details


Create a new paste based on this one


Comments: