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

numpy

parent f8b3b016
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 4,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
" [3.+0.j, 4.+0.j]])" " [3.+0.j, 4.+0.j]])"
] ]
}, },
"execution_count": 9, "execution_count": 5,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
" [0., 0., 0., 0.]])" " [0., 0., 0., 0.]])"
] ]
}, },
"execution_count": 10, "execution_count": 6,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
" [1., 1., 1., 1.]])" " [1., 1., 1., 1.]])"
] ]
}, },
"execution_count": 12, "execution_count": 7,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
" [1., 1., 1., 1.]])" " [1., 1., 1., 1.]])"
] ]
}, },
"execution_count": 14, "execution_count": 8,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -149,17 +149,17 @@ ...@@ -149,17 +149,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"a = np.array( [20,30,40,50] )\n", "a = np.array([20,30,40,50] )\n",
"b = np.arange( 4 )" "b = np.arange( 4 )"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -168,7 +168,7 @@ ...@@ -168,7 +168,7 @@
"array([20, 29, 38, 47])" "array([20, 29, 38, 47])"
] ]
}, },
"execution_count": 25, "execution_count": 10,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -180,7 +180,7 @@ ...@@ -180,7 +180,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
"array([ 40, 60, 80, 100])" "array([ 40, 60, 80, 100])"
] ]
}, },
"execution_count": 26, "execution_count": 11,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
"array([0, 1, 4, 9])" "array([0, 1, 4, 9])"
] ]
}, },
"execution_count": 27, "execution_count": 12,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29, "execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
"array([ True, True, True, False])" "array([ True, True, True, False])"
] ]
}, },
"execution_count": 29, "execution_count": 13,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34, "execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
"array([ 0, 30, 80, 150])" "array([ 0, 30, 80, 150])"
] ]
}, },
"execution_count": 34, "execution_count": 14,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -262,9 +262,16 @@ ...@@ -262,9 +262,16 @@
"a*b" "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", "cell_type": "code",
"execution_count": 38, "execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -273,13 +280,12 @@ ...@@ -273,13 +280,12 @@
"True" "True"
] ]
}, },
"execution_count": 38, "execution_count": 15,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
], ],
"source": [ "source": [
"#Multiplicacion Matricial / Producto Punto\n",
"a@b == a.dot(b)" "a@b == a.dot(b)"
] ]
}, },
...@@ -556,6 +562,156 @@ ...@@ -556,6 +562,156 @@
" print(element)" " 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", "cell_type": "markdown",
"metadata": {}, "metadata": {},
...@@ -570,6 +726,13 @@ ...@@ -570,6 +726,13 @@
"outputs": [], "outputs": [],
"source": [] "source": []
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "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