In [1]:
import numpy as np
import matplotlib.pyplot as pp
In [2]:
%matplotlib inline
In [3]:
x = np.linspace(0,10,40)
In [4]:
x
Out[4]:
In [6]:
sinx = np.sin(x)
In [7]:
pp.plot(x,sinx)
Out[7]:
In [8]:
cosx = np.cos(x)
In [9]:
pp.plot(x,sinx)
pp.plot(x,cosx)
pp.legend(['sin(x)','cos(x)'])
Out[9]:
In [10]:
y = sinx * cosx
z = cosx**2 - sinx**2
pp.plot(x,y)
pp.plot(x,z)
Out[10]:
In [11]:
np.dot(sinx,cosx)
Out[11]:
In [12]:
np.outer(sinx,cosx)
Out[12]:
In [13]:
v = np.linspace(0,10,5)
v + 1
Out[13]:
In [14]:
vv = np.outer(v,v)
vv + v
Out[14]:
In [15]:
vv + v[:,np.newaxis]
Out[15]:
In [ ]: