Created
June 27, 2021 18:39
-
-
Save jbrenorv/1482a72757c2f9a6b158e2ae64512871 to your computer and use it in GitHub Desktop.
interpolacao_polinomial.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "interpolacao_polinomial.ipynb", | |
"provenance": [], | |
"collapsed_sections": [], | |
"toc_visible": true, | |
"authorship_tag": "ABX9TyMtsxHIMZmQD8l78GCQVmUu", | |
"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/jbrenorv/1482a72757c2f9a6b158e2ae64512871/interpolacao_polinomial.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "JHnOYqEUaFHq" | |
}, | |
"source": [ | |
"import numpy as np\n", | |
"import matplotlib.pyplot as plt" | |
], | |
"execution_count": 156, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "K57R13g2aZ3j" | |
}, | |
"source": [ | |
"def coefs(x, y, k):\n", | |
" \"\"\"\n", | |
" Parameters:\n", | |
" x: as abscissas\n", | |
" y: as ordenadas\n", | |
" k: quantidade de pontos\n", | |
" \"\"\"\n", | |
"\n", | |
" nablas = [y]\n", | |
" output = [y[0]]\n", | |
" c_nb = np.zeros(k)\n", | |
"\n", | |
" for ordem in range(1, k):\n", | |
" for i in range(k - ordem):\n", | |
" # Nabla anterior, para calcular o atual\n", | |
" p_nb = nablas[ordem -1]\n", | |
"\n", | |
" # Nabla atual\n", | |
" c_nb[i] = (p_nb[i+1] - p_nb[i]) / (x[i + ordem] - x[i])\n", | |
" \n", | |
" output.append( round(c_nb[0], 3) )\n", | |
" nablas.append( c_nb )\n", | |
" \n", | |
" return output\n" | |
], | |
"execution_count": 157, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "AwcgguP7UVSm" | |
}, | |
"source": [ | |
"def polinomio_interpolador(x, m):\n", | |
" \"\"\"\n", | |
" Parameters:\n", | |
" x: as abscissas\n", | |
" m: os coeficientes\n", | |
" \"\"\"\n", | |
"\n", | |
" output = f'{m[0]}'\n", | |
"\n", | |
" for j in range(1, len(x)):\n", | |
" if m[j] == 0:\n", | |
" continue\n", | |
"\n", | |
" parcela = f'{abs(m[j])}'\n", | |
" \n", | |
" for i in range(j):\n", | |
" parcela = parcela + f'(x - {x[i]})'\n", | |
" \n", | |
" output = output + f' {\"+\" if m[j] > 0 else \"-\"} {parcela}'\n", | |
" \n", | |
" return output" | |
], | |
"execution_count": 158, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "m64tGrGrey16" | |
}, | |
"source": [ | |
"def predict(x, m, _x):\n", | |
" \"\"\"\n", | |
" Parameters:\n", | |
" x: as abscissas\n", | |
" m: os coeficientes\n", | |
" _x: para calcular P(_x)\n", | |
" \"\"\"\n", | |
"\n", | |
" output = m[0]\n", | |
"\n", | |
" for j in range(1, len(x)):\n", | |
" if m[j] == 0:\n", | |
" continue\n", | |
"\n", | |
" parcela = m[j]\n", | |
" \n", | |
" for i in range(j):\n", | |
" parcela = parcela * (_x - x[i])\n", | |
" \n", | |
" output = output + parcela\n", | |
" \n", | |
" return output" | |
], | |
"execution_count": 159, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "H1AhC4xarxIX" | |
}, | |
"source": [ | |
"x = [0, 15, 30, 45]\n", | |
"y = [184, 96, 119, 196]\n", | |
"k = 4\n", | |
"\n", | |
"m = coefs(x, y, k)" | |
], | |
"execution_count": 160, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 0 | |
}, | |
"id": "3tOGO64NW4n7", | |
"outputId": "c9ae01f0-6a64-47ce-8010-baeb3cfbae11" | |
}, | |
"source": [ | |
"print(polinomio_interpolador(x, m))" | |
], | |
"execution_count": 161, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"184 - 5.867(x - 0) + 0.247(x - 0)(x - 15) - 0.003(x - 0)(x - 15)(x - 30)\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "WUH4SUgGlpEF" | |
}, | |
"source": [ | |
"Guardar em x_axis, todos os números da forma k*0.1, com k natural, entre 0 e 45.1. Ou seja, a sequência (0, 0.1, 0.2, ..., 45, 45.1)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "eAURKBnYcc4L" | |
}, | |
"source": [ | |
"i = 0.1\n", | |
"a = x[0]\n", | |
"b = x[-1] + i\n", | |
"x_axis = np.arange(a, b, i)" | |
], | |
"execution_count": 162, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "lgt8YYKzmvFK" | |
}, | |
"source": [ | |
"E depois obter a imagem desses números no polinômio interpolador e armazenar em y_axis. E nesse processo, encontrar uma aproximação para o ponto de mínimo." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "oiqYQq3Elk0B" | |
}, | |
"source": [ | |
"y_axis = []\n", | |
"x_min = 0.\n", | |
"y_min = 100000. # um numero bem grande\n", | |
"\n", | |
"# Para cada z em x_axis...\n", | |
"for z in x_axis:\n", | |
"\n", | |
" # seja t = P(z)\n", | |
" t = predict(x, m, z)\n", | |
"\n", | |
" # adiciona t em y_axis\n", | |
" y_axis.append(t)\n", | |
"\n", | |
" # Testando se t é menor que o mínimo atual\n", | |
" if (t < y_min):\n", | |
"\n", | |
" # se for, atualiza o mínimo\n", | |
" y_min = t\n", | |
" x_min = z\n" | |
], | |
"execution_count": 163, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 265 | |
}, | |
"id": "5fR-30J_dTOj", | |
"outputId": "96d9c7db-b03b-4a07-952d-11b6eca36afa" | |
}, | |
"source": [ | |
"plt.plot(x_axis, y_axis)\n", | |
"plt.show()" | |
], | |
"execution_count": 164, | |
"outputs": [ | |
{ | |
"output_type": "display_data", | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deVzVVf7H8ddhX2QRWQUUxR1UVHLJbLPSstS0xZbJMctmqqmmpnV+7TnV1EzLVFNW5pJZVma2WKlZ5i6oICIqCggogiLIvt3z+4PbRGayyOV77/d+no+Hjy7fe+G++6bvvp57vucorTVCCCHMxcXoAEIIIdqflLsQQpiQlLsQQpiQlLsQQpiQlLsQQpiQm9EBAIKDg3VMTIzRMYQQwqEkJycf1VqHnOo5uyj3mJgYkpKSjI4hhBAORSmV83vPybCMEEKYkJS7EEKYkJS7EEKYkJS7EEKYkJS7EEKYkJS7EEKYkJS7EEKYkJS7EEIY5OVVe0nNK7HJz7aLm5iEEMLZ/LCnkJdX7cNi0QyKCmz3ny9X7kII0cEqaur5+2dpxIb4cseFvWzyHnLlLoQQHezF7/ZwqLSKj28bhaebq03eQ67chRCiA20/eJx5G7L5w8juJMYE2ex9pNyFEKKD1NZbeOjTnYT7e3H/uL42fS8ZlhFCiA7y5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8BurfW/mzzlrOcjRCkVaH3sDVxM4+cQa4CrrC9zivOhtX5Yax2ltY6hsSe+11rfgMnPhUPfoWr9P/HLgCswV2s92+BIHUoptRg4n8alS48AjwPLgCVANxqXUb5Ga33yh66mo5Q6B/gJ2Mkv46qP0Dju7oznYxCNHxK60ngRt0Rr/ZRSqieNkw+CgO3AjVrrGuOSdiyl1PnA37TWl5v9XDh0uQshhDg1Rx6WEUII8Tuk3IUQwoSk3IUQwoSk3IUQwoSk3IUQwoSk3IUQwoSk3IUQwoT+H1pRY3jGbDmxAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"tags": [], | |
"needs_background": "light" | |
} | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "WzmDDE_Po4CL" | |
}, | |
"source": [ | |
"Mostrar o ponto crítico encontrado" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 0 | |
}, | |
"id": "vaAiZO4bipMR", | |
"outputId": "ee8d65df-7a95-41a6-9219-90d0d964f6a9" | |
}, | |
"source": [ | |
"print(f'min= ({x_min}, {y_min})')" | |
], | |
"execution_count": 165, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"min= (18.2, 93.667576)\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 0 | |
}, | |
"id": "nDO9LHcsTO27", | |
"outputId": "ef0c87d3-7e07-4007-8c50-17c0985d6fc7" | |
}, | |
"source": [ | |
"predict(x, m, 18.2)" | |
], | |
"execution_count": 166, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"93.667576" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
}, | |
"execution_count": 166 | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment