python es un lenguaje genérico, así que, casi siempre, hay que importar módulos, o bien enteros:
In [3]:
import scipy as np
o bien submódulos:
In [4]:
from matplotlib import pyplot as plt
Para ver los gráficos dentro de la hoja (% es un comando "mágico")
In [5]:
%matplotlib inline
In [6]:
x=np.linspace(1,10,100)
In [7]:
x
Out[7]:
In [8]:
plt.plot(x)
Out[8]:
In [9]:
y=np.cos(x)
In [11]:
plt.plot(x , y )
Out[11]:
In [12]:
x[0]
Out[12]:
In [13]:
y[0]
Out[13]:
Probar: x.[TAB]
In [17]:
x.size
Out[17]:
In [19]:
x[100] # OJO!!!!
In [20]:
x[99]
Out[20]:
In [21]:
x[0:2]
Out[21]:
¡¡ Atención al sangrado !!
In [24]:
for xx in x:
print xx
In [30]:
if x[0] < 1.2 :
print "Menor que 1.2"
In [32]:
for xx in x:
if xx < 1.2 :
print "Menor que 1.2"