In [1]:
import os
setup_script = os.path.join(os.environ['ENV_JUPYTER_SETUPS_DIR'], 'setup_sci_env_basic.py')
%run $setup_script
In [2]:
a = np.array([2.0, 3.0, 4.0, 5.0])
b = np.array([[2.0], [3.0], [4.0], [5.0]])
In [3]:
a
Out[3]:
In [4]:
a.shape
Out[4]:
In [5]:
a.flags
Out[5]:
In [6]:
a.itemsize
Out[6]:
In [7]:
a.strides
Out[7]:
Accessing an element
In [8]:
a[0]
Out[8]:
In [9]:
a[0,0]
In [10]:
b
Out[10]:
In [11]:
b.shape
Out[11]:
In [12]:
b.flags
Out[12]:
In [13]:
b.itemsize
Out[13]:
In [14]:
b.strides
Out[14]:
In [15]:
b[0]
Out[15]:
In [16]:
b[0,0]
Out[16]:
In [17]:
a + b
Out[17]:
In [18]:
a * b
Out[18]:
In [19]:
a.dot(b)
Out[19]:
In [20]:
c = a.reshape(2,2)
In [21]:
c
Out[21]:
In [22]:
d = b.reshape(2,2)
In [23]:
d
Out[23]:
In [24]:
M = np.array([[2.0, 3.0, 3.0, 4.0], [9.0, 5.0, 1.0, 1.0], [2.0, 4.0, 5.0, 9.0], [8.0, 3.0, 4.0, 5.0]])
In [25]:
M
Out[25]:
In [26]:
M.dot(a)
Out[26]:
In [27]:
M.dot(b)
Out[27]: