Ejercicios Pandas

parent 67f02298
......@@ -1211,18 +1211,16 @@
" A = np.array(A, dtype=np.float64)\n",
" n = len(A)\n",
" Inver = np.eye(n, dtype=np.float64)\n",
" #Factorizacion L por eliminación de Gauss\n",
" #Método L por eliminación de Gauss, p es el pivote\n",
" for p in range(n-1):\n",
" if A[p,p] == 0: #Verifica que el pivote no sea cero\n",
" print ()\n",
" sys.exit('La matriz es singular, por lo tanto NO INVERTIBLE')\n",
" A[p,:], Inver[p,:] = A[p,:] / A[p,p], Inver[p,:] / A[p,p]\n",
" for k in range(p+1,n):\n",
" A[k,:], Inver[k,:] = A[p,:] * A[k,p] - A[k,:], Inver[p,:] * A[k,p] - Inver[k,:]\n",
" #factorizacion U por eliminación de Gauss\n",
" #Método U por eliminación de Gauss\n",
" for p in reversed(range(1,n)):\n",
" if A[p,p] == 0: #Verifica que el pivote no sea cero\n",
" print ()\n",
" sys.exit('La matriz es singular, por lo tanto NO INVERTIBLE')\n",
" A[p,:], Inver[p,:] = A[p,:] / A[p,p], Inver[p,:] / A[p,p]\n",
" for k in reversed(range(p)):\n",
......
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