Commit be4a6ac1 authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

numpy

parent f8b3b016
......@@ -24,7 +24,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 4,
"metadata": {},
"outputs": [
{
......@@ -53,7 +53,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 5,
"metadata": {},
"outputs": [
{
......@@ -63,7 +63,7 @@
" [3.+0.j, 4.+0.j]])"
]
},
"execution_count": 9,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
......@@ -75,7 +75,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 6,
"metadata": {},
"outputs": [
{
......@@ -86,7 +86,7 @@
" [0., 0., 0., 0.]])"
]
},
"execution_count": 10,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
......@@ -98,7 +98,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 7,
"metadata": {},
"outputs": [
{
......@@ -109,7 +109,7 @@
" [1., 1., 1., 1.]])"
]
},
"execution_count": 12,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
......@@ -120,7 +120,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 8,
"metadata": {},
"outputs": [
{
......@@ -131,7 +131,7 @@
" [1., 1., 1., 1.]])"
]
},
"execution_count": 14,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
......@@ -149,17 +149,17 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"a = np.array( [20,30,40,50] )\n",
"a = np.array([20,30,40,50] )\n",
"b = np.arange( 4 )"
]
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 10,
"metadata": {},
"outputs": [
{
......@@ -168,7 +168,7 @@
"array([20, 29, 38, 47])"
]
},
"execution_count": 25,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
......@@ -180,7 +180,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 11,
"metadata": {},
"outputs": [
{
......@@ -189,7 +189,7 @@
"array([ 40, 60, 80, 100])"
]
},
"execution_count": 26,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
......@@ -201,7 +201,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 12,
"metadata": {},
"outputs": [
{
......@@ -210,7 +210,7 @@
"array([0, 1, 4, 9])"
]
},
"execution_count": 27,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
......@@ -222,7 +222,7 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 13,
"metadata": {},
"outputs": [
{
......@@ -231,7 +231,7 @@
"array([ True, True, True, False])"
]
},
"execution_count": 29,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
......@@ -243,7 +243,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 14,
"metadata": {},
"outputs": [
{
......@@ -252,7 +252,7 @@
"array([ 0, 30, 80, 150])"
]
},
"execution_count": 34,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
......@@ -262,9 +262,16 @@
"a*b"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[**Producto punto**](https://en.wikipedia.org/wiki/Dot_product) y [**Multiplicacion Matricial**](https://en.wikipedia.org/wiki/Matrix_multiplication)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": 15,
"metadata": {},
"outputs": [
{
......@@ -273,13 +280,12 @@
"True"
]
},
"execution_count": 38,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Multiplicacion Matricial / Producto Punto\n",
"a@b == a.dot(b)"
]
},
......@@ -556,6 +562,156 @@
" print(element)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Cambio de forma"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[9., 7., 7., 6.],\n",
" [1., 2., 2., 8.],\n",
" [9., 2., 4., 1.]])"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a = np.floor(10*np.random.random((3,4)))\n",
"a"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(3, 4)"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.shape"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[9., 7.],\n",
" [7., 6.],\n",
" [1., 2.],\n",
" [2., 8.],\n",
" [9., 2.],\n",
" [4., 1.]])"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.reshape(6,2)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[9., 1., 9.],\n",
" [7., 2., 2.],\n",
" [7., 2., 4.],\n",
" [6., 8., 1.]])"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.T"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ True, True, True],\n",
" [ True, True, True],\n",
" [ True, True, True],\n",
" [ True, True, True]])"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.transpose()==a.T"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(4, 3)"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.T.shape"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"a.reshape(3,-1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -570,6 +726,13 @@
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment