Skip to content

Instantly share code, notes, and snippets.

@DianSano
Created March 8, 2022 08:37
Show Gist options
  • Select an option

  • Save DianSano/ce7b2fff447145ae75fb3fef6b795b1b to your computer and use it in GitHub Desktop.

Select an option

Save DianSano/ce7b2fff447145ae75fb3fef6b795b1b to your computer and use it in GitHub Desktop.
SPL_numpy.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "SPL_numpy.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyPBAM69Z5xLi6QS7nz1oiXP",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/DianSano/ce7b2fff447145ae75fb3fef6b795b1b/spl_numpy.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "E0f_uEEErEmI",
"outputId": "cb3d8d8d-b2be-4447-8a89-dc86d0200199"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Solution by NumPy:\n",
"[1. 2. 1.]\n"
]
}
],
"source": [
"from numpy import array, linalg\n",
"\n",
"a = array([[1, 1, 1],\n",
" [1, -1, -1],\n",
" [2, 8, 1]], float)\n",
"#the b matrix constant terms of the equations \n",
"b = array([4, -2, 19], float)\n",
"\n",
"print(\"Solution by NumPy:\")\n",
"\n",
"\n",
"print(linalg.solve(a, b))\n"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment