Numpy

parent 3f637aed
......@@ -5,16 +5,6 @@
"metadata": {},
"source": [
"# 2. Python\n",
<<<<<<< HEAD
"## 2.1 Comprensiónes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2.2 Generadores"
=======
"## 2.1 Comprensiónes\n",
"Las comprensiones de python proveen de una forma consisa de crear listas, diccionarios y conjuntos. Su nombre proviene de teria de conjuntos en donde la *notación contructiva de conjuntos* o comprensión se define como:\n",
"\n",
......@@ -251,7 +241,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 55,
"metadata": {},
"outputs": [
{
......@@ -307,54 +297,40 @@
"print(list(doublesG))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2.4 Ejercicios\n",
"### 2.4.1\n",
"Dada una lista de enteros **a**, utilisando una comprensión, Imprimir una nueva lista que contenga \"par\" o \"impar\" en cada uno de sus elementos, dependiendo del valor del elemento en la lista orginal."
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Cuatos Fibonacci?: 6\n",
"0\n",
"1\n",
"1\n",
"2\n",
"3\n",
"5\n"
"['Par', 'Non', 'Par', 'Non', 'Par', 'Non', 'Par', 'Non', 'Par', 'Non']\n"
]
}
],
"source": [
"a = int(input('Cuatos Fibonacci?: '))\n",
"a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n",
"'''Operador Ternanio\n",
"par=[True if num%2==0 else False for num in a]\n",
"par'''\n",
"\n",
"def fib(n):\n",
" a, b = 0, 1\n",
" for _ in range(n):\n",
" yield a\n",
" a, b = b, a + b\n",
"def parLogico(l1):\n",
" par=[\"Par\" if num%2==0 else \"Non\" for num in l1]\n",
" return par\n",
"\n",
"for n in fib(a):\n",
" print(n)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2.4 Ejercicios\n",
"### 2.4.1\n",
"Dada una lista de enteros **a**, utilisando una comprensión, Imprimir una nueva lista que contenga \"par\" o \"impar\" en cada uno de sus elementos, dependiendo del valor del elemento en la lista orginal."
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [],
"source": [
"a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"
"pars=parLogico(a)\n",
"print(pars)\n"
]
},
{
......@@ -367,11 +343,29 @@
},
{
"cell_type": "code",
"execution_count": 69,
"execution_count": 70,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[(0, 'apple'), (1, 'banana'), (2, 'grapes'), (3, 'pear')]\n"
]
}
],
"source": [
"my_list = ['apple', 'banana', 'grapes', 'pear']\n"
"my_list = ['apple', 'banana', 'grapes', 'pear']\n",
" \n",
"'''indice=[(my_list.index(i),i) for i in my_list]\n",
"indice'''\n",
"\n",
"def listaTuplasComprension(l1):\n",
" indice=[(l1.index(i),i) for i in l1]\n",
" return indice\n",
"\n",
"ltupla=listaTuplasComprension(my_list)\n",
"print(ltupla)"
]
},
{
......@@ -384,12 +378,31 @@
},
{
"cell_type": "code",
"execution_count": 72,
"execution_count": 64,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[(0, 'a'), (0, 'b'), (0, 'c'), (0, 'd'), (0, 'e'), (0, 'f'), (1, 'a'), (1, 'b'), (1, 'c'), (1, 'd'), (1, 'e'), (1, 'f'), (2, 'a'), (2, 'b'), (2, 'c'), (2, 'd'), (2, 'e'), (2, 'f'), (3, 'a'), (3, 'b'), (3, 'c'), (3, 'd'), (3, 'e'), (3, 'f'), (4, 'a'), (4, 'b'), (4, 'c'), (4, 'd'), (4, 'e'), (4, 'f'), (5, 'a'), (5, 'b'), (5, 'c'), (5, 'd'), (5, 'e'), (5, 'f'), (6, 'a'), (6, 'b'), (6, 'c'), (6, 'd'), (6, 'e'), (6, 'f')]\n"
]
}
],
"source": [
"a = [0,1,2,3,4,5,6]\n",
"b = [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"]"
"b = [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"]\n",
"\n",
"'''\n",
"posibles=[(num,letr) for num in a for letr in b]\n",
"posibles\n",
"'''\n",
"def posibildad(l1,l2):\n",
" posibles=[(num,letr) for num in l1 for letr in l2]\n",
" return posibles\n",
"\n",
"l3=posibildad(a,b)\n",
"print(l3)"
]
},
{
......@@ -402,11 +415,24 @@
},
{
"cell_type": "code",
"execution_count": 74,
"execution_count": 64,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"[True, True, False, True, False, False, True, True, True, True]"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a=[5, 7, 22, 97, 54, 62, 77, 23, 73, 61]"
"a=[5, 7, 22, 97, 54, 62, 77, 23, 73, 61]\n",
"impar=list(map(lambda x:x%2==1,a))\n",
"impar"
]
},
{
......@@ -419,11 +445,51 @@
},
{
"cell_type": "code",
"execution_count": 76,
"execution_count": 84,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"193\n",
"193\n",
"\n",
"Como funciona la funcion reduce:\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAADOCAYAAAA9krkAAABKUklEQVR4nO2deXwURfqHn54jJ+G+QcUVROXwQFxwxRNUVBZRUA4PBFlRETnEE1EERBYFQVaFn4iKB7iroiIIgiKKCBi8AUUQkTMQjiQkmemuqt8f3T3pmYRDCDDJ1PP5wEyma2Z66q361ttvvVVtKKUUGo1Goyn3+I73CWg0Go3m2KAFX6PRaBIELfgajUaTIBQTfDekr0P78Ym2S3yj7aOJZ6IEXymFYRhIKTEM43id02GTCJ3NMIwy+TuVUmXyvP8qZdU+LmX53P8KZfV3Hul5G7FZOq7of/zxPLZu3YrPd6yiPgagPM9LOOz90ylqmiZtLryARo0aYhiJE6H64YcfWbHiGwIB/zH6xoPYJ/ZlZf8pleLUUxvRunWrMulEHC47duzggw8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QP0cUJvnlaKeBuvu9DHMAw++OADvv32W0aNGsX69euLbQSlx9yD491n5euvv46IvV5QFX/E3o1qz549DBs2jMsvv5x69eppsT+OaA//KONt2N999x2vvPIK5557LjfddFOx45rieD34GTNmsHHjRu6//37t2cc5brs2TZPbbruNAQMGcO655+r2fpzRgn8UKSnEEwqF+M9//kNWVhajRo0iEAho8doP3vr797//zebNm5kwYcJ+y2iOP96J9XA4zL333ssdd9zBOeecoyfW4wAd0jmKxE7QGoZBcnIygwcPplOnTlx//fUsXbq02H7fegyOFvIXXniBChUqMGHCBKSz2tlFC0d8opRi1KhRdOjQIUrsQdvseKI9/GNIrIeTn5/PmDFjqFSpEn369CEjI0N7QQ7u73/hhRcoKChg4MCBgBaLeMbbZh988EGaNWtGjx49dJuOI7SHfwzxNnqlFKmpqQwbNowLLriAnj17snz58oTuGLGTfUOGDCEQCDBo0CAgejsFTfzgDUkKIejVqxdXXHEFPXr0iCqTiG063tAe/nEi1uuRUnLddddx++23c+mll5KWlpZQncRbHwAvvvgiBQUFDBo0SHuIcY5XQqZMmUKtWrW49tprtb3iEC34cYDbMYQQvPTSS+zYsYOLLrqINm3aJJTYub/x2Wefxefz0b9//4T6/WURr3f/xBNPUK1aNe68886oeSltt/hBC/5xpiRB2759O+PGjePMM8+ke/fuCZHF4/7+YcOGUa9ePe64446E+N1llVghv/fee2nXrh1XX311VDltu/hCC34c4o1hV6lShT59+lCjRo0oASwPnpP3N0gpeeaZZ8jNzeWJJ57Qnn0ZwLvyefv27dx1113aXnGOFvw4I7bDfPXVV8yaNYuWLVvSpUuXqDLloXN5wzgVK1akV69eSCn1Cto4JbbtTZs2jQ0bNvDII48QDAbLTbssr2jBj1O83nx+fj4TJkxgw4YNTJw4MXIbuLLauWLP/YEHHqB27dqR1Muy/NvKM7F2mT59Or/99hvDhw8/3qemOUS04Mc5XuFftmwZTz/9NEOGDKFly5aR191y8S6OJa08vu+++zjzzDO55ZZbdMy+DODacM6cOXz66ac8/fTTZaLtaWy04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KOQw+sTo+Ifho/WoG/LaRmsnpZPgNkFAowmwOhahW6WT+6TfYZwqkaYeALGfBlg7paOIZLfiacoBi197dfLcxmz/D9kVrhj9I7q5ccqRih7WR7Rc0or4QrN26jTXbciiQBmBQwfCTvTsPIQWLUrdzV91q+EyDS2ueRKc9+1i6Zw9bQ/Z3BAJBzq/8N+6t1hCfKZy9cySWRVE4yJJ2Hr7eW0ETh2jB15R5lIIGJ5zClwNPwIxJkBFC4idIupSYQnHZGS1Z1uBMzMgErR1/F0IRVAGMsMQ0JUawOk+eej67CsPkO+EaQ/hIlz6EKQib7mRv0WStdLJ2pKTEeQSN5nijBV9T5rE3TDOomJLivGLnW7oCbOfWS6wwSGGQ4U9CKoklJcInkX6FUArLmXh1t0sIm5Kg8lNB+RBKIaQgbApnkteTxul49pYziatX2mriFS34mnKHcrNxHLGXjtgLS0SLtJONY5melbLC2S4hMiFri7sQtqDLiNhLexfNyK6aCilAhpUO6WjiFi34mrgnKSlAbq7Fjz9up6DAOkhp28MWwhZrJZSzC6a97bH07GxpSLCc1bJueWk62yMLd7sFd/CwUzSFKRFSoZyFWsoSWBJnEFFIS1AQrnTI98DVaI4l+o5XmrhHKcWCBR8RCuUcIAPG3gLZ3i/fvd2gitpqQbn/KUBJ/H4/QkikVMWPO98b+T73FoferRsUKLewM3cglaJGrbpc0u4qAgHtT2niCy34mrjHbaJlxVtW2OfsKyPnq0kctAuiiWvKWljEvp+5fc5l7dw15R/t4Ws0Gk2CoLdW0Gg0mgRBC75Go9EkCFrwNRqNJkHQgq/RaDQJghZ8jUajSRC04Gs0Gk2CoAVfo9FoEoT/BysLaj3ZwegjAAAAAElFTkSuQmCC\n",
"text/plain": [
"<PIL.PngImagePlugin.PngImageFile image mode=RGBA size=380x206 at 0x7F4463154BA8>"
]
},
"execution_count": 84,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a = [5, 8, 10, 20, 50, 100] "
"from functools import reduce\n",
"from PIL import Image \n",
"ima = \"reduce.png\"\n",
"\n",
"a = [5, 8, 10, 20, 50, 100]\n",
"\n",
"suma=reduce((lambda x,y: x+y),a)\n",
"print(suma)\n",
"\n",
"def sumaReduceLambda(l1):\n",
" suma=reduce((lambda x,y: x+y),l1)\n",
" return suma\n",
"\n",
"sumred=sumaReduceLambda(a)\n",
"print(sumred)\n",
"\n",
"print(\"\\nComo funciona la funcion reduce:\")\n",
"Image.open(ima)\n",
"\n"
]
},
{
......@@ -436,13 +502,28 @@
},
{
"cell_type": "code",
"execution_count": 78,
"execution_count": 46,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[35, 45, 55, 65]\n"
]
}
],
"source": [
"a = [5, 10, 15, 20]\n",
" \n",
"b = [30, 35, 40, 45]"
"b = [30, 35, 40, 45]\n",
"\n",
"def mapLambdaSuma(l1,l2):\n",
" suma=list(map(lambda x,y: x+y, l1,l2))\n",
" return suma\n",
" \n",
"sumi=mapLambdaSuma(a,b)\n",
"print(sumi)\n"
]
},
{
......@@ -455,6 +536,55 @@
"[Wikipedia](https://es.wikipedia.org/wiki/Terna_pitag%C3%B3rica): Una terna pitagórica es un conjunto ordenado de tres números enteros positivos a, b, c, y son solución de la ecuación diofantina cuadrática $a^{2}+b^{2}=c^{2}$.\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[(4, 3, 5), (5, 12, 13), (6, 8, 10)]\n"
]
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def tripletaPita(valor):\n",
" for i in range(4, valor + 1):\n",
" if i % 2:\n",
" #Impar\n",
" valores = i**2 // 2\n",
" yield i, valores, valores + 1\n",
" else:\n",
" #par\n",
" valores = (i // 2)**2\n",
" yield i, valores - 1, valores + 1\n",
"\n",
"\n",
"print (list(tripletaPita(6)))\n",
"\n",
"#a,b,c\n",
"#4,-7,9\n",
"(4**2)//2\n",
"\n",
"#a,b,c\n",
"#4,3,5\n",
"(5//2)**2\n",
"\n",
"bool(1%2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -465,11 +595,38 @@
},
{
"cell_type": "code",
"execution_count": 80,
"execution_count": 115,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n",
"1\n",
"2\n",
"3\n",
"4\n",
"5\n"
]
}
],
"source": [
"a = [\"a\", \"b\", \"c\"]"
"def recursive_generator(some_list):\n",
" #some_list.reverse()\n",
" if len(some_list)>1:\n",
" for i in recursive_generator(some_list[1:]):\n",
" yield i\n",
" else:\n",
" yield some_list[0]\n",
" else:\n",
" yield some_list[0]\n",
"\n",
"some_list = [6,3,9,1]\n",
"lista=[0,1,2,3,4,5]\n",
"lista.reverse()\n",
"for k in recursive_generator(lista):\n",
" print(k)"
]
},
{
......@@ -489,7 +646,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 13,
"metadata": {},
"outputs": [
{
......@@ -505,18 +662,9 @@
"helloWorld.hello()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2.6 Documentacion (docstring)\n",
"\n",
"Python **Docstring** es el texto de documentación que puede aprecer en la definición de una clase, módulo, función o método, y se escribe como la primera declaración. Se puede acceder a las cadenas de documenacion desde el atributo doc para cualquiera de los objetos de Python y también con la función incorporada **help()**."
]
},
{
"cell_type": "code",
"execution_count": 89,
"execution_count": 5,
"metadata": {},
"outputs": [
{
......@@ -587,6 +735,15 @@
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2.6 Documentacion (docstring)\n",
"\n",
"Python **Docstring** es el texto de documentación que puede aprecer en la definición de una clase, módulo, función o método, y se escribe como la primera declaración. Se puede acceder a las cadenas de documenacion desde el atributo doc para cualquiera de los objetos de Python y también con la función incorporada **help()**."
]
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -597,18 +754,26 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"wrote helloWorld.html\n"
]
}
],
"source": [
"%%bash\n",
"cd miModulo\n",
"pydoc -w helloWorld.py"
"pydoc -w helloWorld"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"outputs": [
{
......@@ -625,7 +790,7 @@
"<td valign=bottom>&nbsp;<br>\n",
"<font color=\"#ffffff\" face=\"helvetica, arial\">&nbsp;<br><big><big><strong>helloWorld</strong></big></big></font></td\n",
"><td align=right valign=bottom\n",
"><font color=\"#ffffff\" face=\"helvetica, arial\"><a href=\".\">index</a><br><a href=\"file:/home/mchc/git/tap1012/miModulo/helloWorld.py\">/home/mchc/git/tap1012/miModulo/helloWorld.py</a></font></td></tr></table>\n",
"><font color=\"#ffffff\" face=\"helvetica, arial\"><a href=\".\">index</a><br><a href=\"file:/home/carlosgarcia8/repos/tap1012/miModulo/helloWorld.py\">/home/carlosgarcia8/repos/tap1012/miModulo/helloWorld.py</a></font></td></tr></table>\n",
" <p><tt>This&nbsp;example&nbsp;module&nbsp;shows&nbsp;various&nbsp;types&nbsp;of&nbsp;documentation&nbsp;available&nbsp;for&nbsp;use<br>\n",
"with&nbsp;pydoc.&nbsp;&nbsp;To&nbsp;generate&nbsp;HTML&nbsp;documentation&nbsp;for&nbsp;this&nbsp;module&nbsp;issue&nbsp;the<br>\n",
"command:<br>\n",
......@@ -646,7 +811,7 @@
"<IPython.core.display.HTML object>"
]
},
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
......@@ -667,7 +832,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 7,
"metadata": {},
"outputs": [
{
......@@ -684,11 +849,12 @@
"Expecting:\n",
" 'aaa'\n",
"ok\n",
"1 items had no tests:\n",
"2 items had no tests:\n",
" __main__\n",
" __main__.tripletaPita\n",
"1 items passed all tests:\n",
" 2 tests in __main__.multiply\n",
"2 tests in 2 items.\n",
"2 tests in 3 items.\n",
"2 passed and 0 failed.\n",
"Test passed.\n"
]
......@@ -699,7 +865,7 @@
"TestResults(failed=0, attempted=2)"
]
},
"execution_count": 10,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
......@@ -716,7 +882,6 @@
"import doctest\n",
"\n",
"doctest.testmod(verbose=True)\n"
>>>>>>> master
]
},
{
......@@ -726,6 +891,617 @@
"## 2.8 Ejercicios\n",
"Escribe la documentacion y los casos de prueba para todos los ejercicios de la semana 1 y 2."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"wrote tarea2.html\n"
]
}
],
"source": [
"%%bash\n",
"cd miModulo\n",
"pydoc -w tarea2"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n",
"<html><head><title>Python: module tarea2</title>\n",
"<meta charset=\"utf-8\">\n",
"</head><body bgcolor=\"#f0f0f8\">\n",
"\n",
"<table width=\"100%\" cellspacing=0 cellpadding=2 border=0 summary=\"heading\">\n",
"<tr bgcolor=\"#7799ee\">\n",
"<td valign=bottom>&nbsp;<br>\n",
"<font color=\"#ffffff\" face=\"helvetica, arial\">&nbsp;<br><big><big><strong>tarea2</strong></big></big></font></td\n",
"><td align=right valign=bottom\n",
"><font color=\"#ffffff\" face=\"helvetica, arial\"><a href=\".\">index</a><br><a href=\"file:/home/carlosgarcia8/repos/tap1012/miModulo/tarea2.py\">/home/carlosgarcia8/repos/tap1012/miModulo/tarea2.py</a></font></td></tr></table>\n",
" <p><tt>Documentación&nbsp;para&nbsp;la&nbsp;segunda&nbsp;tarea&nbsp;de&nbsp;la&nbsp;materia&nbsp;de&nbsp;Tópicos&nbsp;Avanzados&nbsp;de&nbsp;Programación.<br>\n",
"Maestría&nbsp;GeoInteligencia&nbsp;Computacional&nbsp;a&nbsp;27&nbsp;de&nbsp;Enero&nbsp;del&nbsp;2019.</tt></p>\n",
"<p>\n",
"<table width=\"100%\" cellspacing=0 cellpadding=2 border=0 summary=\"section\">\n",
"<tr bgcolor=\"#eeaa77\">\n",
"<td colspan=3 valign=bottom>&nbsp;<br>\n",
"<font color=\"#ffffff\" face=\"helvetica, arial\"><big><strong>Functions</strong></big></font></td></tr>\n",
" \n",
"<tr><td bgcolor=\"#eeaa77\"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>\n",
"<td width=\"100%\"><dl><dt><a name=\"-listaTuplasComprension\"><strong>listaTuplasComprension</strong></a>(l1)</dt><dd><tt>Función&nbsp;que&nbsp;devuelve&nbsp;el&nbsp;indice&nbsp;y&nbsp;el&nbsp;valor&nbsp;en&nbsp;una&nbsp;tupla&nbsp;con&nbsp;la&nbsp;estructura&nbsp;de&nbsp;una&nbsp;lista.</tt></dd></dl>\n",
" <dl><dt><a name=\"-mapLambdaSuma\"><strong>mapLambdaSuma</strong></a>(l1, l2)</dt><dd><tt>Función&nbsp;para&nbsp;la&nbsp;suma,&nbsp;elemento&nbsp;a&nbsp;elemento&nbsp;de&nbsp;dos&nbsp;listas&nbsp;(vectores).</tt></dd></dl>\n",
" <dl><dt><a name=\"-parLogico\"><strong>parLogico</strong></a>(l1)</dt><dd><tt>Función&nbsp;que&nbsp;devuelve&nbsp;True&nbsp;o&nbsp;False&nbsp;para&nbsp;cada&nbsp;elemento&nbsp;de&nbsp;una&nbsp;lista,&nbsp;si&nbsp;el&nbsp;valor&nbsp;del&nbsp;elemento&nbsp;es&nbsp;par.</tt></dd></dl>\n",
" <dl><dt><a name=\"-posibildad\"><strong>posibildad</strong></a>(l1, l2)</dt><dd><tt>Función&nbsp;que&nbsp;devuelve&nbsp;todas&nbsp;las&nbsp;combinaciones&nbsp;posibilidades&nbsp;entre&nbsp;dos&nbsp;listas.</tt></dd></dl>\n",
" <dl><dt><a name=\"-sumaReduceLambda\"><strong>sumaReduceLambda</strong></a>(l1)</dt><dd><tt>Función&nbsp;que&nbsp;suma,&nbsp;elemento&nbsp;a&nbsp;elemento,&nbsp;una&nbsp;sola&nbsp;lista&nbsp;con&nbsp;ayuda&nbsp;de&nbsp;la&nbsp;función&nbsp;reduce&nbsp;(importada&nbsp;de&nbsp;functools).</tt></dd></dl>\n",
" <dl><dt><a name=\"-tripletaPita\"><strong>tripletaPita</strong></a>(valor)</dt><dd><tt>Función&nbsp;que&nbsp;genera&nbsp;la&nbsp;tripleta&nbsp;de&nbsp;Pitágoras&nbsp;lo&nbsp;cual&nbsp;es&nbsp;la&nbsp;suma&nbsp;de&nbsp;dos&nbsp;números&nbsp;elevados&nbsp;al&nbsp;cuadrado&nbsp;que&nbsp;resulten&nbsp;en&nbsp;un&nbsp;tercero&nbsp;elevado&nbsp;al&nbsp;cuadrado</tt></dd></dl>\n",
"</td></tr></table>\n",
"</body></html>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import HTML\n",
"HTML(filename=\"miModulo/tarea2.html\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ejercicios de la tarea 1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1.5.1 Imprimir todos los numeros pares entre 0 y 20 usando for o while.\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def numerPar():\n",
" lista=[x for x in range(0,21) if x%2==0]\n",
" return lista\n",
"\n",
"numerPar()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1.5.2 Imprimir todos los numeros mayores a 10 de la lista A"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[13, 21, 34, 55, 89]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def numerMay(l1):\n",
" lista=[x for x in l1 if x>10]\n",
" return lista\n",
"\n",
"A = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]\n",
"numerMay(A)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1.5.3 Dadas dos listas A y B, obten una lista con sus elementos comunes (A∩B)."
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{1, 2, 3, 5, 8, 13}\n"
]
}
],
"source": [
"a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]\n",
"b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]\n",
"\n",
"def coincide(l1,l2):\n",
" coin=set([x for x in l1 if x in l2])\n",
" return coin\n",
"\n",
"coincide=coincide(a,b)\n",
"print(coincide)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1.5.4 Pregunta al usario cuantos numeros de la secuancia Fibonacci quiere calcular y escribe una funcion que calcule la secuencia e imprima el resultado."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#Falta\n",
"def fibonacci(n):\n",
" if n == 0:\n",
" return [0]\n",
" elif n == 1:\n",
" return [0, 1]\n",
" else:\n",
" listaF = fibonacci(n-1)\n",
" listaF.append(listaF[-1] + listaF[-2])\n",
" return listaF\n",
" \n",
"tamaño=int(input(\"Ingresa los N elementos de la secuencia de Fibonacci?\\n: \"))\n",
"tamaño=tamaño-1\n",
"fibonacci(tamaño)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1.5.5 Escribe una funcion que sume todos los numeros en una lista.\n"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20\n"
]
}
],
"source": [
"from functools import reduce\n",
"\n",
"a = [8, 2, 3, 0, 7]\n",
"\n",
"def sumar1(l1):\n",
" sumado=reduce((lambda x,y: x+y),l1)\n",
" return sumado\n",
"\n",
"sumar=sumar1(a)\n",
"print(sumar)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1.5.6 Escribe una funcion que tome una lista y regrese los elementos unicos en la lista."
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 2, 3, 4, 5]\n",
"None\n"
]
}
],
"source": [
"a = [1,2,2,3,3,3,3,4,5,5]\n",
"\n",
"def unicos(l1):\n",
" norep=[]\n",
" [norep.append(x) for x in l1 if x not in norep]\n",
" print(norep)\n",
"\n",
"uniqu=unicos(a)\n",
"print(uniqu)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1.5.7 Escribe una funcion que indique si un numero es o no perfecto.\n",
"\n",
"Wikipedia: Un número perfecto es un número natural que es igual a la suma de sus divisores propios positivos. Dicho de otra forma, un número perfecto es aquel que es amigo de sí mismo. Así, 6 es un número perfecto porque sus divisores propios son 1, 2 y 3; y 6 = 1 + 2 + 3. Los siguientes números perfectos son 28, 496 y 8128.\n"
]
},
{
"cell_type": "code",
"execution_count": 93,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ingresa tu numero\n",
": 496\n",
"True\n"
]
}
],
"source": [
"def perfect(n):\n",
" suma = 0\n",
" for x in range(1, n):\n",
" if n % x == 0:\n",
" suma += x\n",
" return suma == n\n",
"\n",
"def perfeto(n):\n",
" lam=[x for x in range(1,n) if n%x==0]\n",
" sumado=reduce((lambda x,y: x+y),lam)\n",
" return (sumado==n)\n",
" \n",
"numero = int(input(\"Ingresa tu numero\\n: \"))\n",
"prueba=perfeto(numero)\n",
"print(prueba)"
]
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (<ipython-input-73-e10a4c95830a>, line 2)",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<ipython-input-73-e10a4c95830a>\"\u001b[0;36m, line \u001b[0;32m2\u001b[0m\n\u001b[0;31m lam=lambda x%n: x in range(n+1) x%n\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"n=6\n",
"lam=lambda x%n: x in range(n+1) x%n\n",
"lam"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1.5.8 Escribe una funcion que imprima las prieras n filas del triangulo de Pascal.\n",
"\n",
"Wolfram: El triángulo de Pascal es un triángulo numérico con números dispuestos en filas escalonadas de manera tal que: 𝑎𝑛𝑟=𝑛!𝑟!(𝑛−𝑟)!=(𝑛𝑟)"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Indica el numero de filas\n",
":2\n",
"[[1], [1, 1], [1, 2, 1]]\n"
]
}
],
"source": [
"#Falta\n",
"def pascal(n):\n",
" lista = [[1],[1,1]]\n",
" for i in range(1,n):\n",
" linea = [1]\n",
" for j in range(0,len(lista[i])-1):\n",
" #Suerte de Join\n",
" linea.extend([ lista[i][j] + lista[i][j+1] ])\n",
" linea += [1]\n",
" lista.append(linea) \n",
" print (lista)\n",
" \n",
"numero = int(input(\"Indica el numero de filas\\n:\"))\n",
"pascal(numero)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1.5.9 Escribe una funcion que indique si una frase es un panagrama.\n",
"\n",
"Wikipedia:Un pangrama (del griego: παν γραμμα, «todas las letras») o frase holoalfabética es un texto que usa todas las letras posibles del alfabeto de un idioma."
]
},
{
"cell_type": "code",
"execution_count": 143,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Escriba su frase aqui: \n",
"José compró una vieja zampona en Perú. Excusándose, Sofía tiró su whisky al desagüe de la banqueta\n",
"No soy un pangrama :(\n"
]
}
],
"source": [
"#!/usr/bin/env python\n",
"# -*- coding: utf-8 -*-\n",
"\n",
"def pangramo():\n",
" alfabeto = \"abcdefghijklmnñopqrstuvwxyz\"\n",
" frase=input(\"Escriba su frase aqui: \\n\")\n",
" frase=frase.lower()\n",
" frase=set(frase)\n",
" lista=[letr for letr in frase if letr in alfabeto]\n",
" if len(lista)==27:\n",
" print(\"Soy un pangrama :)\")\n",
" else:\n",
" print(\"No soy un pangrama :(\")\n",
" \n",
"pangramo()\n",
"#José compró una vieja zampona en Perú. Excusándose, Sofía tiró su whisky al desagüe de la banquetañ"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1.5.10 Escribe un programa que imprima el siguiente un for anidado.\n",
"\n",
"1\n",
"\n",
"22\n",
"\n",
"333\n",
"\n",
"4444\n",
"\n",
"55555\n",
"\n",
"666666\n",
"\n",
"7777777\n",
"\n",
"88888888\n",
"\n",
"999999999\n"
]
},
{
"cell_type": "code",
"execution_count": 167,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"22\n",
"333\n",
"4444\n",
"55555\n",
"666666\n",
"7777777\n",
"88888888\n",
"999999999\n"
]
}
],
"source": [
"def piramide():\n",
" repeticion=[str(x)*x for x in range(1,10)]\n",
" for elemento in repeticion:\n",
" print(elemento)\n",
" \n",
"piramide()"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"wrote tarea2_ejercicios1.html\n"
]
}
],
"source": [
"%%bash\n",
"cd miModulo\n",
"pydoc -w tarea2_ejercicios1"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n",
"<html><head><title>Python: module tarea2_ejercicios1</title>\n",
"<meta charset=\"utf-8\">\n",
"</head><body bgcolor=\"#f0f0f8\">\n",
"\n",
"<table width=\"100%\" cellspacing=0 cellpadding=2 border=0 summary=\"heading\">\n",
"<tr bgcolor=\"#7799ee\">\n",
"<td valign=bottom>&nbsp;<br>\n",
"<font color=\"#ffffff\" face=\"helvetica, arial\">&nbsp;<br><big><big><strong>tarea2_ejercicios1</strong></big></big></font></td\n",
"><td align=right valign=bottom\n",
"><font color=\"#ffffff\" face=\"helvetica, arial\"><a href=\".\">index</a><br><a href=\"file:/home/carlosgarcia8/repos/tap1012/miModulo/tarea2_ejercicios1.py\">/home/carlosgarcia8/repos/tap1012/miModulo/tarea2_ejercicios1.py</a></font></td></tr></table>\n",
" <p><tt>Documentación&nbsp;para&nbsp;la&nbsp;segunda&nbsp;tarea&nbsp;(ejercicios&nbsp;1)&nbsp;de&nbsp;la&nbsp;materia&nbsp;de&nbsp;Tópicos&nbsp;Avanzados&nbsp;de&nbsp;Programación.<br>\n",
"Maestría&nbsp;GeoInteligencia&nbsp;Computacional&nbsp;a&nbsp;27&nbsp;de&nbsp;Enero&nbsp;del&nbsp;2019.</tt></p>\n",
"<p>\n",
"<table width=\"100%\" cellspacing=0 cellpadding=2 border=0 summary=\"section\">\n",
"<tr bgcolor=\"#eeaa77\">\n",
"<td colspan=3 valign=bottom>&nbsp;<br>\n",
"<font color=\"#ffffff\" face=\"helvetica, arial\"><big><strong>Functions</strong></big></font></td></tr>\n",
" \n",
"<tr><td bgcolor=\"#eeaa77\"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>\n",
"<td width=\"100%\"><dl><dt><a name=\"-coincide\"><strong>coincide</strong></a>(l1, l2)</dt><dd><tt>Función&nbsp;que&nbsp;devuelve&nbsp;todos&nbsp;los&nbsp;elementos&nbsp;coincidentes&nbsp;de&nbsp;un&nbsp;par&nbsp;de&nbsp;listas&nbsp;que&nbsp;el&nbsp;usuario&nbsp;pase&nbsp;como&nbsp;argumento</tt></dd></dl>\n",
" <dl><dt><a name=\"-numerMay\"><strong>numerMay</strong></a>(l1)</dt><dd><tt>Función&nbsp;que&nbsp;devuelve&nbsp;los&nbsp;números&nbsp;estrictamente&nbsp;mayores&nbsp;a&nbsp;10&nbsp;de&nbsp;una&nbsp;lista&nbsp;que&nbsp;el&nbsp;usuario&nbsp;pase&nbsp;como&nbsp;argumento</tt></dd></dl>\n",
" <dl><dt><a name=\"-numerPar\"><strong>numerPar</strong></a>()</dt><dd><tt>Función&nbsp;que&nbsp;devuelve&nbsp;los&nbsp;números&nbsp;pares&nbsp;de&nbsp;una&nbsp;lista&nbsp;que&nbsp;el&nbsp;usuario&nbsp;pase&nbsp;como&nbsp;argumento</tt></dd></dl>\n",
"</td></tr></table>\n",
"</body></html>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import HTML\n",
"HTML(filename=\"miModulo/tarea2_ejercicios1.html\")"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"wrote Test1.html\n"
]
}
],
"source": [
"%%bash\n",
"cd miModulo\n",
"pydoc -w Test1"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n",
"<html><head><title>Python: module Test1</title>\n",
"<meta charset=\"utf-8\">\n",
"</head><body bgcolor=\"#f0f0f8\">\n",
"\n",
"<table width=\"100%\" cellspacing=0 cellpadding=2 border=0 summary=\"heading\">\n",
"<tr bgcolor=\"#7799ee\">\n",
"<td valign=bottom>&nbsp;<br>\n",
"<font color=\"#ffffff\" face=\"helvetica, arial\">&nbsp;<br><big><big><strong>Test1</strong></big></big></font></td\n",
"><td align=right valign=bottom\n",
"><font color=\"#ffffff\" face=\"helvetica, arial\"><a href=\".\">index</a><br><a href=\"file:/home/carlosgarcia8/repos/tap1012/miModulo/Test1.py\">/home/carlosgarcia8/repos/tap1012/miModulo/Test1.py</a></font></td></tr></table>\n",
" <p><tt>Documentación&nbsp;para&nbsp;el&nbsp;test&nbsp;1&nbsp;de&nbsp;la&nbsp;materia&nbsp;de&nbsp;Tópicos&nbsp;Avanzados&nbsp;de&nbsp;Programación.<br>\n",
"Maestría&nbsp;GeoInteligencia&nbsp;Computacional&nbsp;a&nbsp;27&nbsp;de&nbsp;Enero&nbsp;del&nbsp;2019.</tt></p>\n",
"<p>\n",
"<table width=\"100%\" cellspacing=0 cellpadding=2 border=0 summary=\"section\">\n",
"<tr bgcolor=\"#eeaa77\">\n",
"<td colspan=3 valign=bottom>&nbsp;<br>\n",
"<font color=\"#ffffff\" face=\"helvetica, arial\"><big><strong>Functions</strong></big></font></td></tr>\n",
" \n",
"<tr><td bgcolor=\"#eeaa77\"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>\n",
"<td width=\"100%\"><dl><dt><a name=\"-ejercicio1\"><strong>ejercicio1</strong></a>(lista)</dt><dd><tt>Ejercicio&nbsp;1:&nbsp;Devuelve&nbsp;el&nbsp;promedio&nbsp;de&nbsp;todos&nbsp;los&nbsp;elemntos&nbsp;de&nbsp;una&nbsp;lista.&nbsp;Recibe&nbsp;como&nbsp;parametro&nbsp;una&nbsp;lista&nbsp;y&nbsp;devuelve&nbsp;un&nbsp;valor&nbsp;único.</tt></dd></dl>\n",
" <dl><dt><a name=\"-ejercicio2\"><strong>ejercicio2</strong></a>(lista, numero)</dt><dd><tt>Ejercicio&nbsp;2:&nbsp;Devuelve&nbsp;todos&nbsp;los&nbsp;numeros&nbsp;del&nbsp;campo&nbsp;de&nbsp;los&nbsp;numeros&nbsp;enteros&nbsp;divisibles&nbsp;por&nbsp;un&nbsp;valor&nbsp;que&nbsp;el&nbsp;usuario&nbsp;determina.&nbsp;Recibe&nbsp;como&nbsp;parametro&nbsp;una&nbsp;lista&nbsp;y&nbsp;un&nbsp;divisor&nbsp;y&nbsp;devuelve&nbsp;una&nbsp;lista&nbsp;de&nbsp;valores.</tt></dd></dl>\n",
" <dl><dt><a name=\"-ejercicio3\"><strong>ejercicio3</strong></a>(numero)</dt><dd><tt>Ejercicio&nbsp;3:&nbsp;Devuelve&nbsp;el&nbsp;factorial&nbsp;de&nbsp;un&nbsp;número&nbsp;ingresado&nbsp;por&nbsp;el&nbsp;usuario.&nbsp;Recibe&nbsp;como&nbsp;parámetro&nbsp;un&nbsp;valor&nbsp;único&nbsp;y&nbsp;devuelve&nbsp;otro&nbsp;valor&nbsp;único</tt></dd></dl>\n",
" <dl><dt><a name=\"-ejercicio4\"><strong>ejercicio4</strong></a>(minimo, maximo)</dt><dd><tt>Ejercicio&nbsp;4:&nbsp;Devuelve&nbsp;una&nbsp;lista&nbsp;de&nbsp;numeros&nbsp;enteros&nbsp;que&nbsp;tienen&nbsp;la&nbsp;característica&nbsp;de&nbsp;ser&nbsp;palíndromos&nbsp;y&nbsp;nones.&nbsp;Recibe&nbsp;como&nbsp;parámetro&nbsp;un&nbsp;valor&nbsp;único&nbsp;mínimo&nbsp;y&nbsp;otro&nbsp;máximo.</tt></dd></dl>\n",
" <dl><dt><a name=\"-ejercicio5\"><strong>ejercicio5</strong></a>(intentos<font color=\"#909090\">=2</font>)</dt><dd><tt>Ejercicio&nbsp;5:&nbsp;Programa&nbsp;que&nbsp;simula&nbsp;el&nbsp;juego&nbsp;del&nbsp;\"Ahorcado\".&nbsp;Tiene&nbsp;interacción&nbsp;con&nbsp;el&nbsp;usuario&nbsp;(máximo&nbsp;3)&nbsp;con&nbsp;ingresar&nbsp;la&nbsp;palabra&nbsp;y&nbsp;dos&nbsp;posibles&nbsp;soluciones&nbsp;(perder)&nbsp;o&nbsp;ganar.</tt></dd></dl>\n",
" <dl><dt><a name=\"-ejercicio6\"><strong>ejercicio6</strong></a>()</dt><dd><tt>Ejercicio&nbsp;6:&nbsp;Devuelve&nbsp;el&nbsp;conteo&nbsp;de&nbsp;número&nbsp;de&nbsp;palabras&nbsp;de&nbsp;un&nbsp;texto&nbsp;ingresado&nbsp;por&nbsp;el&nbsp;usuario.&nbsp;No&nbsp;recibe&nbsp;ningún&nbsp;parámetro&nbsp;ya&nbsp;que&nbsp;internamente&nbsp;se&nbsp;pide&nbsp;el&nbsp;texto&nbsp;para&nbsp;procesar.</tt></dd></dl>\n",
" <dl><dt><a name=\"-ejercicio8\"><strong>ejercicio8</strong></a>()</dt><dd><tt>Ejercicio&nbsp;8:&nbsp;Devuelve&nbsp;cuadrados&nbsp;mágicos&nbsp;de&nbsp;tamaño&nbsp;definido&nbsp;por&nbsp;el&nbsp;usuario.&nbsp;No&nbsp;recibe&nbsp;ningún&nbsp;parámetro&nbsp;ya&nbsp;que&nbsp;internamente&nbsp;se&nbsp;pide&nbsp;el&nbsp;tamaño&nbsp;de&nbsp;la&nbsp;matriz.&nbsp;Ocupa&nbsp;la&nbsp;biblioteca&nbsp;Numpy.&nbsp;No&nbsp;está&nbsp;habilitado&nbsp;para&nbsp;matrices&nbsp;pares.</tt></dd></dl>\n",
"</td></tr></table>\n",
"</body></html>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import HTML\n",
"HTML(filename=\"miModulo/Test1.html\")"
]
}
],
"metadata": {
......
......@@ -24,7 +24,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 159,
"metadata": {},
"outputs": [
{
......@@ -47,7 +47,7 @@
" [10, 11, 12, 13, 14]], dtype=int16)"
]
},
"execution_count": 6,
"execution_count": 159,
"metadata": {},
"output_type": "execute_result"
}
......@@ -868,47 +868,83 @@
},
{
"cell_type": "code",
"execution_count": 75,
"execution_count": 20,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Cuantos elementos tienen tus vectores: \n",
"2\n",
"Ingresa los elementos uno a uno del vector 1 \n",
"\n",
"Ingresa el elemento: 1\n",
"10\n",
"Ingresa el elemento: 2\n",
"20\n",
"\n",
"Ingresa los elementos uno a uno del vector 2 \n",
"\n",
"Ingresa el elemento: 1\n",
"2\n",
"Ingresa el elemento: 2\n",
"4\n",
"\n",
"Vector 1: [10, 20]\n",
"Vector 2: [2, 4]\n",
"Suma Producto: 100\n"
]
}
],
"source": [
"from functools import reduce\n",
"#Tarea, generar el producto punto\n",
"def prod_punto(v1,v2):\n",
" '''\n",
" Soy un docstring\n",
" '''\n",
" pass\n",
" #return prod_punto"
" v1,v2,v3=[],[],[]\n",
" elementos=int(input(\"Cuantos elementos tienen tus vectores: \\n\"))\n",
" \n",
" print(\"Ingresa los elementos uno a uno del vector 1 \\n\")\n",
" for elemento in range(0,elementos):\n",
" elem=int(input(\"Ingresa el elemento: \"+str(elemento+1)+\"\\n\"))\n",
" v1.append(elem)\n",
" \n",
" print(\"\\nIngresa los elementos uno a uno del vector 2 \\n\")\n",
" for elemento in range(0,elementos):\n",
" elem=int(input(\"Ingresa el elemento: \"+str(elemento+1)+\"\\n\"))\n",
" v2.append(elem)\n",
" \n",
" v3=list(map(lambda x,y: y*x, v1,v2))\n",
" sumap=reduce((lambda x,y: x+y),v3)\n",
" \n",
" print(\"\\nVector 1: \"+str(v1)+\"\\n\"+\"Vector 2: \"+str(v2)+\"\\n\"+\"Suma Producto: \"+str(sumap))\n",
" return sumap\n",
" #return prod_punto\n",
"x=prod_punto(3,4)"
]
},
{
"cell_type": "code",
"execution_count": 170,
"execution_count": 162,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[1, 2, 3], [4, 5, 6]]\n"
]
},
{
"data": {
"text/plain": [
"2"
"100"
]
},
"execution_count": 170,
"execution_count": 162,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Matriz sin numpy para la tarea\n",
"aaa=[[1,2,3],[4,5,6]]\n",
"print(aaa)\n",
"aaa[0][1]"
"#Comprobacion con Numpy\n",
"np.matmul([10,20], [2,4])"
]
},
{
......@@ -920,32 +956,232 @@
},
{
"cell_type": "code",
"execution_count": 165,
"execution_count": 173,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'def matmult(a,b):\\n zip_b = zip(*b)\\n #uncomment next line if python 3 : \\n zip_b = list(zip_b)\\n return [[sum(ele_a*ele_b for ele_a, ele_b in zip(row_a, col_b)) \\n for col_b in zip_b] for row_a in a]\\n'"
]
},
"execution_count": 173,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def tamMatriz():\n",
" n=int(input(\"Ingrese las filas de la matriz: \\n\"))\n",
" m=int(input(\"Ingrese las columnas de la matriz: \\n\"))\n",
" return [n,m]\n",
"\n",
"def creaMatriz(nFila, nCol):\n",
" matriz = []\n",
" for i in range(nFila):\n",
" listaFila = []\n",
" for j in range(nCol):\n",
" val=int(input(\"Ingresa el valor del elemento\"+str(i)+\",\"+str(j)+\": \\n\"))\n",
" listaFila.append(val)\n",
" matriz.append(listaFila)\n",
"\n",
" return matriz\n",
"\n",
"def mmult1(m1, m2):\n",
" fila_A = len(m1)\n",
" cols_A = len(m1[0])\n",
" fila_B = len(m2)\n",
" cols_B = len(m2[0])\n",
"\n",
" if cols_A != fila_B:\n",
" print (\"Imposible resolver, la dimensionalidad de las matrices no cuadra.\")\n",
" return\n",
"\n",
" C = [[0 for fila in range(cols_B)] for col in range(fila_A)]\n",
" print (C)\n",
"\n",
" for i in range(fila_A):\n",
" for j in range(cols_B):\n",
" for k in range(cols_A):\n",
" C[i][j] += m1[i][k] * m2[k][j]\n",
" return C\n",
"\n",
"#Me encantaria que me podieran explicar esta ya que es extremadamente eficiente :O\n",
"\n",
"'''def matmult(a,b):\n",
" zip_b = zip(*b)\n",
" #uncomment next line if python 3 : \n",
" zip_b = list(zip_b)\n",
" return [[sum(ele_a*ele_b for ele_a, ele_b in zip(row_a, col_b)) \n",
" for col_b in zip_b] for row_a in a]\n",
"'''\n",
"\n",
"'''b=mat2\n",
"print(b)\n",
"zip_b = zip(*b)\n",
"for col_b in zip_b:\n",
" print(col_b)\n",
"'''\n",
"\n",
"### Muy PRO\n",
"m = np.array([[sum(row_a*col_b) for col_b in b.T] for row_a in a])\n",
"print(m, type(m))\n",
"###"
]
},
{
"cell_type": "code",
"execution_count": 212,
"metadata": {},
"outputs": [],
"source": [
"A = [[1,2,3],\n",
" [4,5,6]]\n",
"B = [[7,8],[9,10],[11,12]]"
"a=np.array(mat1)\n",
"b=np.array(mat2)\n"
]
},
{
"cell_type": "code",
"execution_count": 162,
"execution_count": 118,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ingrese las filas de la matriz: \n",
"2\n",
"Ingrese las columnas de la matriz: \n",
"3\n"
]
}
],
"source": [
"aa=tamMatriz()"
]
},
{
"cell_type": "code",
"execution_count": 133,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[1, 2, 3], [4, 5, 6]]\n",
"[[7, 8], [9, 10], [11, 12]]\n"
"Ingrese las filas de la matriz: \n",
"3\n",
"Ingrese las columnas de la matriz: \n",
"2\n"
]
}
],
"source": [
"print(A)\n",
"print(B)"
"bb=tamMatriz()"
]
},
{
"cell_type": "code",
"execution_count": 119,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ingresa el valor del elemento0,0: \n",
"1\n",
"Ingresa el valor del elemento0,1: \n",
"2\n",
"Ingresa el valor del elemento0,2: \n",
"3\n",
"Ingresa el valor del elemento1,0: \n",
"4\n",
"Ingresa el valor del elemento1,1: \n",
"5\n",
"Ingresa el valor del elemento1,2: \n",
"6\n"
]
}
],
"source": [
"mat1 = creaMatriz(aa[0],aa[1])"
]
},
{
"cell_type": "code",
"execution_count": 134,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ingresa el valor del elemento0,0: \n",
"10\n",
"Ingresa el valor del elemento0,1: \n",
"20\n",
"Ingresa el valor del elemento1,0: \n",
"30\n",
"Ingresa el valor del elemento1,1: \n",
"40\n",
"Ingresa el valor del elemento2,0: \n",
"50\n",
"Ingresa el valor del elemento2,1: \n",
"60\n"
]
}
],
"source": [
"mat2=creaMatriz(bb[0],bb[1])"
]
},
{
"cell_type": "code",
"execution_count": 210,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[0, 0], [0, 0]]\n"
]
},
{
"data": {
"text/plain": [
"[[220, 280], [490, 640]]"
]
},
"execution_count": 210,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mmult1(mat1,mat2)"
]
},
{
"cell_type": "code",
"execution_count": 206,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[220, 280],\n",
" [490, 640]])"
]
},
"execution_count": 206,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Comprobacion con Numpy\n",
"np.matmul(mat1, mat2)"
]
},
{
......@@ -957,9 +1193,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 23,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
......
......@@ -560,7 +560,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
......@@ -591,7 +591,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 4,
"metadata": {},
"outputs": [
{
......@@ -633,7 +633,7 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
......@@ -652,7 +652,7 @@
},
{
"cell_type": "code",
"execution_count": 43,
"execution_count": 10,
"metadata": {},
"outputs": [
{
......@@ -660,7 +660,7 @@
"output_type": "stream",
"text": [
"Soy la fuente: El Universal\n",
"Titulo de la nota\t02-14-19\n",
"Titulo de la nota\t02-19-19\n",
"CGarcia\n",
"Sección: Investigacion\n",
"La Jornada\n",
......
......@@ -24,7 +24,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 159,
"metadata": {},
"outputs": [
{
......@@ -47,7 +47,7 @@
" [10, 11, 12, 13, 14]], dtype=int16)"
]
},
"execution_count": 6,
"execution_count": 159,
"metadata": {},
"output_type": "execute_result"
}
......@@ -868,47 +868,83 @@
},
{
"cell_type": "code",
"execution_count": 75,
"execution_count": 20,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Cuantos elementos tienen tus vectores: \n",
"2\n",
"Ingresa los elementos uno a uno del vector 1 \n",
"\n",
"Ingresa el elemento: 1\n",
"10\n",
"Ingresa el elemento: 2\n",
"20\n",
"\n",
"Ingresa los elementos uno a uno del vector 2 \n",
"\n",
"Ingresa el elemento: 1\n",
"2\n",
"Ingresa el elemento: 2\n",
"4\n",
"\n",
"Vector 1: [10, 20]\n",
"Vector 2: [2, 4]\n",
"Suma Producto: 100\n"
]
}
],
"source": [
"from functools import reduce\n",
"#Tarea, generar el producto punto\n",
"def prod_punto(v1,v2):\n",
" '''\n",
" Soy un docstring\n",
" '''\n",
" pass\n",
" #return prod_punto"
" v1,v2,v3=[],[],[]\n",
" elementos=int(input(\"Cuantos elementos tienen tus vectores: \\n\"))\n",
" \n",
" print(\"Ingresa los elementos uno a uno del vector 1 \\n\")\n",
" for elemento in range(0,elementos):\n",
" elem=int(input(\"Ingresa el elemento: \"+str(elemento+1)+\"\\n\"))\n",
" v1.append(elem)\n",
" \n",
" print(\"\\nIngresa los elementos uno a uno del vector 2 \\n\")\n",
" for elemento in range(0,elementos):\n",
" elem=int(input(\"Ingresa el elemento: \"+str(elemento+1)+\"\\n\"))\n",
" v2.append(elem)\n",
" \n",
" v3=list(map(lambda x,y: y*x, v1,v2))\n",
" sumap=reduce((lambda x,y: x+y),v3)\n",
" \n",
" print(\"\\nVector 1: \"+str(v1)+\"\\n\"+\"Vector 2: \"+str(v2)+\"\\n\"+\"Suma Producto: \"+str(sumap))\n",
" return sumap\n",
" #return prod_punto\n",
"x=prod_punto(3,4)"
]
},
{
"cell_type": "code",
"execution_count": 170,
"execution_count": 162,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[1, 2, 3], [4, 5, 6]]\n"
]
},
{
"data": {
"text/plain": [
"2"
"100"
]
},
"execution_count": 170,
"execution_count": 162,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Matriz sin numpy para la tarea\n",
"aaa=[[1,2,3],[4,5,6]]\n",
"print(aaa)\n",
"aaa[0][1]"
"#Comprobacion con Numpy\n",
"np.matmul([10,20], [2,4])"
]
},
{
......@@ -920,32 +956,232 @@
},
{
"cell_type": "code",
"execution_count": 165,
"execution_count": 173,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'def matmult(a,b):\\n zip_b = zip(*b)\\n #uncomment next line if python 3 : \\n zip_b = list(zip_b)\\n return [[sum(ele_a*ele_b for ele_a, ele_b in zip(row_a, col_b)) \\n for col_b in zip_b] for row_a in a]\\n'"
]
},
"execution_count": 173,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def tamMatriz():\n",
" n=int(input(\"Ingrese las filas de la matriz: \\n\"))\n",
" m=int(input(\"Ingrese las columnas de la matriz: \\n\"))\n",
" return [n,m]\n",
"\n",
"def creaMatriz(nFila, nCol):\n",
" matriz = []\n",
" for i in range(nFila):\n",
" listaFila = []\n",
" for j in range(nCol):\n",
" val=int(input(\"Ingresa el valor del elemento\"+str(i)+\",\"+str(j)+\": \\n\"))\n",
" listaFila.append(val)\n",
" matriz.append(listaFila)\n",
"\n",
" return matriz\n",
"\n",
"def mmult1(m1, m2):\n",
" fila_A = len(m1)\n",
" cols_A = len(m1[0])\n",
" fila_B = len(m2)\n",
" cols_B = len(m2[0])\n",
"\n",
" if cols_A != fila_B:\n",
" print (\"Imposible resolver, la dimensionalidad de las matrices no cuadra.\")\n",
" return\n",
"\n",
" C = [[0 for fila in range(cols_B)] for col in range(fila_A)]\n",
" print (C)\n",
"\n",
" for i in range(fila_A):\n",
" for j in range(cols_B):\n",
" for k in range(cols_A):\n",
" C[i][j] += m1[i][k] * m2[k][j]\n",
" return C\n",
"\n",
"#Me encantaria que me podieran explicar esta ya que es extremadamente eficiente :O\n",
"\n",
"'''def matmult(a,b):\n",
" zip_b = zip(*b)\n",
" #uncomment next line if python 3 : \n",
" zip_b = list(zip_b)\n",
" return [[sum(ele_a*ele_b for ele_a, ele_b in zip(row_a, col_b)) \n",
" for col_b in zip_b] for row_a in a]\n",
"'''\n",
"\n",
"'''b=mat2\n",
"print(b)\n",
"zip_b = zip(*b)\n",
"for col_b in zip_b:\n",
" print(col_b)\n",
"'''\n",
"\n",
"### Muy PRO\n",
"m = np.array([[sum(row_a*col_b) for col_b in b.T] for row_a in a])\n",
"print(m, type(m))\n",
"###"
]
},
{
"cell_type": "code",
"execution_count": 212,
"metadata": {},
"outputs": [],
"source": [
"A = [[1,2,3],\n",
" [4,5,6]]\n",
"B = [[7,8],[9,10],[11,12]]"
"a=np.array(mat1)\n",
"b=np.array(mat2)\n"
]
},
{
"cell_type": "code",
"execution_count": 162,
"execution_count": 118,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ingrese las filas de la matriz: \n",
"2\n",
"Ingrese las columnas de la matriz: \n",
"3\n"
]
}
],
"source": [
"aa=tamMatriz()"
]
},
{
"cell_type": "code",
"execution_count": 133,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[1, 2, 3], [4, 5, 6]]\n",
"[[7, 8], [9, 10], [11, 12]]\n"
"Ingrese las filas de la matriz: \n",
"3\n",
"Ingrese las columnas de la matriz: \n",
"2\n"
]
}
],
"source": [
"print(A)\n",
"print(B)"
"bb=tamMatriz()"
]
},
{
"cell_type": "code",
"execution_count": 119,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ingresa el valor del elemento0,0: \n",
"1\n",
"Ingresa el valor del elemento0,1: \n",
"2\n",
"Ingresa el valor del elemento0,2: \n",
"3\n",
"Ingresa el valor del elemento1,0: \n",
"4\n",
"Ingresa el valor del elemento1,1: \n",
"5\n",
"Ingresa el valor del elemento1,2: \n",
"6\n"
]
}
],
"source": [
"mat1 = creaMatriz(aa[0],aa[1])"
]
},
{
"cell_type": "code",
"execution_count": 134,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ingresa el valor del elemento0,0: \n",
"10\n",
"Ingresa el valor del elemento0,1: \n",
"20\n",
"Ingresa el valor del elemento1,0: \n",
"30\n",
"Ingresa el valor del elemento1,1: \n",
"40\n",
"Ingresa el valor del elemento2,0: \n",
"50\n",
"Ingresa el valor del elemento2,1: \n",
"60\n"
]
}
],
"source": [
"mat2=creaMatriz(bb[0],bb[1])"
]
},
{
"cell_type": "code",
"execution_count": 210,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[0, 0], [0, 0]]\n"
]
},
{
"data": {
"text/plain": [
"[[220, 280], [490, 640]]"
]
},
"execution_count": 210,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mmult1(mat1,mat2)"
]
},
{
"cell_type": "code",
"execution_count": 206,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[220, 280],\n",
" [490, 640]])"
]
},
"execution_count": 206,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Comprobacion con Numpy\n",
"np.matmul(mat1, mat2)"
]
},
{
......@@ -957,9 +1193,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 23,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
......
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