Symulowanie-wizualne/sw_lab4.ipynb

786 lines
2.6 MiB
Plaintext
Raw Normal View History

2022-11-28 21:08:15 +01:00
{
"cells": [
{
"cell_type": "markdown",
"id": "d1bcc8a7-466b-4610-b58a-9d6fd89d3534",
"metadata": {},
"source": [
"#### Zadanie 1 (4pkt):\n",
"\n",
"Zadanie polega na wizualizacji algorytmu gradientu prostego. Rozważamy dwa typy powierzchni w $\\mathbb{R}^3$: z jednym ekstremum oraz z jedym punktem siodłowym - przykady pokazuje <a href=https://fraktal.faculty.wmi.amu.edu.pl/symulowanie_wizualne/lab4_r1.png>rysunek 1</a>. Dla każdej z nich należy wykonać dwa typy wizualizacji, pokazujących ciąg zbieżny do punktu ekstremalnego: 2D oraz 3D - przykład pokazuje \n",
" pokazuje to <a href=https://fraktal.faculty.wmi.amu.edu.pl/symulowanie_wizualne/lab4_r2.png>rysunek 2</a>. \n",
"Wizualizacje powinny pokazywać działanie algorytmu z różnymi współczynnikami szybkości zbiegania, w tym przypadek kiedy zbieżność nie zostaje osiągnięta.\n",
"Gradient należy zakodować analitycznie.\n"
]
},
{
"cell_type": "markdown",
"id": "5ced1d1c-a5bf-4224-a001-f2007ec8fdee",
"metadata": {},
"source": [
"#### Zadanie 2 (2pkt):\n",
"\n",
"Zadanie jest identyczne jak Zadanie 1, z jednym wyjątkiem: gradient należy zakodować stosując aproksymację przez różnice skończone.\n"
]
},
{
"cell_type": "markdown",
"id": "9ec21f33-322d-4d99-a065-274430b02185",
"metadata": {},
"source": [
"### Zadanie 1 ###"
]
},
{
"cell_type": "code",
"execution_count": 307,
"id": "7d5f3d90-c154-4fad-8850-1ca10f09198c",
"metadata": {
"deletable": false,
"nbgrader": {
"cell_type": "code",
"checksum": "74517e974d221748786da140f21ed16a",
"grade": true,
"grade_id": "cell-4b4826b612a1a9b4",
"locked": false,
"points": 4,
"schema_version": 3,
"solution": true,
"task": false
}
},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
" \n",
"def f(x, y):\n",
" return x ** 2 + y ** 2\n",
"\n",
"def f2(x, y):\n",
" return x ** 2 - y ** 2\n",
"\n",
"x = np.linspace(-4, 4, 100)\n",
"y = np.linspace(-4, 4, 100)\n",
"\n",
"X, Y = np.meshgrid(x, y)\n",
"Z = f(X, Y)\n",
"Z2 = f2(X, Y)"
]
},
{
"cell_type": "code",
"execution_count": 308,
"id": "06492973-e74b-4022-a9af-9116f8677bf3",
"metadata": {},
"outputs": [],
"source": [
"#pochodna jest identyczna względem wartości x oraz y \n",
"def df(x):\n",
" return 2*x\n",
"\n",
"def gradient(xi, yi, steps, lr):\n",
" xline = []\n",
" yline = []\n",
" zline = []\n",
" \n",
" for i in range(0, steps):\n",
" xi = xi - lr * df(xi)\n",
" xline.append(xi)\n",
" \n",
" yi = yi - lr * df(yi)\n",
" yline.append(yi)\n",
" \n",
" res = f(xi, yi)\n",
" zline.append(res)\n",
" \n",
" return xline, yline, zline"
]
},
{
"cell_type": "code",
"execution_count": 309,
"id": "f4de1c41",
"metadata": {},
"outputs": [],
"source": [
"def dfx2(x):\n",
" return 2*x\n",
"\n",
"def dfy2(y):\n",
" return -2*y\n",
"\n",
"def gradient2(xi, yi, steps, lr):\n",
" xline = []\n",
" yline = []\n",
" zline = []\n",
" \n",
" for i in range(0, steps):\n",
" xi = xi - lr * dfx2(xi)\n",
" xline.append(xi)\n",
" \n",
" yi = yi - lr * dfy2(yi)\n",
" yline.append(yi)\n",
" \n",
" res = f(xi, yi)\n",
" zline.append(res)\n",
" \n",
" return xline, yline, zline"
]
},
{
"cell_type": "markdown",
"id": "e00f3e1d-4d3d-42d0-9e51-07f56702573e",
"metadata": {
"tags": []
},
"source": [
"### Learning rate = 0.1 ###"
]
},
{
"cell_type": "code",
"execution_count": 310,
"id": "e8ffc7db-4a38-4e6d-b888-9f7e5184c30c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x7fcf71932250>"
]
},
"execution_count": 310,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAysAAAMWCAYAAADxsxkvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9d5wk+V3fj78qdc6T88zmcGn39vZuZxWQAGFhMFgG87X0EzI2IJBkGzDGGGEMGCEkQAYjLEs2IH0BGb5YBgewsCQUrTvdnW4n55xj51jx90dP9fb09Mx0rO7afT8fj76evanuz6d6qqs+r3qHF6NpmgaCIAiCIAiCIIgmg230BAiCIAiCIAiCIIpBYoUgCIIgCIIgiKaExApBEARBEARBEE0JiRWCIAiCIAiCIJoSEisEQRAEQRAEQTQlJFYIgiAIgiAIgmhKSKwQBEEQBEEQBNGUkFghCIIgCIIgCKIpIbFCEARBEARBEERTQmKFIAiCIAiCIIimhMQKQRAEQRAEQRBNCYkVgiAIgiAIgiCaEhIrBEEQBEEQBEE0JSRWCIIgCIIgCIJoSkisEARBEARBEATRlJBYIQiCIAiCIAiiKSGxQhAEQRAEQRBEU0JihSAIgiAIgiCIpoTECkEQBEEQBEEQTQmJFYIgCIIgCIIgmhISKwRBEARBEARBNCUkVgiCIAiCIAiCaEpIrBAEQRAEQRAE0ZSQWCEIgiAIgiAIoikhsUIQBEEQBEEQRFNCYoUgCIIgCIIgiKaExApBEARBEARBEE0JiRWCIAiCIAiCIJoSEisEQRAEQRAEQTQlJFYIgiAIgiAIgmhKSKwQBEEQBEEQBNGUkFghCIIgCIIgCKIpIbFCEARBEARBEERTQmKFIAiCIAiCIIimhMQKQRAEQRAEQRBNCYkVgiAIgiAIgiCaEhIrBEEQBEEQBEE0JSRWCIIgCIIgCIJoSkisEARBEARBEATRlJBYIQiCIAiCIAiiKSGxQhAEQRAEQRBEU0JihSAIgiAIgiCIpoTECk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Xz+gaRpYljXU98Qs9SBmmOOjQOFxp/87X7zoj0wmA1EUART3eSHxQhAE0TyQWCEIomwKi+j1O9ZGLszNIFbMtug123zLQY+8AFkBUyhe8iMvgiDk2iTXO6WRIAiCOBsSKwRBlMVp3ilGiwcziBWAIitGUMlnfJZ4SafTuW108aJHXki8EARBGAuJFYIgSuI87xSGYaCqqmHzqVasGLHgNOui9nEUWKWKFz3iQuKFIAjCGEisEARxLqV4p5gpsqKqKmKxGJxO57FWuPXgcVz4N4J6ePkUEy+qqubEC8uyJ2peSLwQBEHUFhIrBEGcid5N6TzvFLPUrKRSKYyMjCAajYJlWXi9Xvj9fvj9frjd7pouNGnR+uhwlnjJZDJIp9MkXgiCIOoAiRWCIIqip33ld/s6a9FlhsjK7u4uJiYm0NHRgaeeegrpdBrhcBihUAgrKytgGAY+ny8nXpxOZ9ULTYqs1J9GfMb54kWfg/6dURTl1IL9wtcRBEEQZ0NihSCIE+jeKWelfRXSzGJFVVXMzs5ic3MTN2/eREdHB0RRhMvlgtvtRl9fH1RVRTweRygUwuHhIRYXF8FxXE64+P1+2O32shaaZmkCQFSPLkJYlgVwXLzIsnzMByY/8kLihSAI4mxIrBAEkaPQO6WchVSzFtgnk0mMjIwAAO7duwen01l0nizLwuPxwOPxYGBgAKqqIhqNIhQKYXd3F3Nzc7BYLDnhEggEYLVazx3fTGLFzIvmZpv7aeJFlmVIkgRJknBwcID+/v4TaWMEQRDEQ0isEAQBALmFlCzLAE6muZxHM9as7OzsYGJiAt3d3bh27VpZC0GWZeHz+eDz+TA0NARFURCJRBAMBrGxsYHp6Wk4HI6
"text/plain": [
"<Figure size 1000x1000 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"xline, yline, zline = gradient(-4, 4, 1500, 0.1)\n",
"fig = plt.figure(figsize=[10,10])\n",
"ax = plt.axes(projection='3d')\n",
"ax.set_xlabel('x', fontsize=20)\n",
"ax.set_ylabel('y', fontsize=20)\n",
"ax.set_zlabel('z', fontsize=20)\n",
"ax.contour3D(X, Y, Z, 50, cmap='viridis')\n",
"ax.plot3D(xline, yline, zline, 'blue')\n",
"ax.scatter(xline, yline, zline, color='deeppink', marker='v')"
]
},
{
"cell_type": "code",
"execution_count": 311,
"id": "76788cb4-dc45-488a-9e50-e6e693f74050",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjoAAAG2CAYAAAB20iz+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOyddXhV9R/HXzfW3T0YjO7u7k7pFCRFBRED/ImISiogioR0d6d0d8OAsbHuzhvnnN8fFzGRIdvuHZzX8/DovTu757Pvds55fz+pkCRJQkZGRkZGRkbmNURpbANkZGRkZGRkZAoKWejIyMjIyMjIvLbIQkdGRkZGRkbmtUUWOjIyMjIyMjKvLbLQkZGRkZGRkXltkYWOjIyMjIyMzGuLLHRkZGRkZGRkXltkoSMjIyMjIyPz2iILHRkZGRkZGZnXFlnoyMjIyMjIyLy2FFmh8+2336JQKPjggw+MbYqMjIyMjIyMiVIkhc7ly5dZsmQJlStXNrYpMjIyMjIyMiZMkRM6mZmZ9O/fn6VLl+Lk5GRsc2RkZGRkZGRMGLWxDXhZxo4dS4cOHWjZsiXTp0//12M1Gg0ajebZa1EUSU5OxsXFBYVCUdCmysjIyMjIyOQDkiSRkZGBt7c3SuXL+WiKlNDZuHEj165d4/Lly3k6/ttvv+XLL78sYKtkZGRkZGRkCoOIiAh8fX1f6nuKjNCJiIjg/fff5/Dhw1haWubpez799FMmTJjw7HVaWhr+/v5ERERgb29fUKb+iZSchxx7OBEzu2QAlFmlaF5uJtZq90I5//PQi3qOhP3Krqi9SJYSAF5mnvTw60Yl54pGte1lCE6LZ8m1o5xKCUVv9tRLJ0FVey96BtaiuXdZzJUq4xpZRJ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o0aORJIldu3bRqFEjVq9ejbW1db7bFpy4h/vpc9FJaSgxo4LLOAId+qP4SwrEyZMnCQkJYfLkyXTo0IGlS5e+9LneWKHzsrzKQiUkJNCxY0fGjx9Pnz59AFi4cCH79+9n0cYx3EyaiV7MRKWworLrRIrbdTPqxXMp/jJL7i1DZ21IobTNtuG9au9SxqG00WzKC1HZqcy7uJ8DCQ8Qnoan7Mws6OZXlX4la1PM1rQFWkEiSRJhaalcCg/n17u3uRUfR4Ik/qOoMRMEvM0sqOjhSYMyZajk6UWgs4vsnSnC/CaAghITuBQaQkRuDkFJiTxKTED6h3uNi5UVZZ2cKW3nQLOy5aji6YWdhXHDHsZEL4oci3nAvIv7CFVkPXvfXavm3eqt6VqyOmYmXLigFXVsCtrM8fSTCEqD4GnoWp9efj1xMPu7d0qj0RAVFcXo0aPx9PTkl19+QV0A13+uPpFrCV8Rm30KADfLWtTwmIa12hNRFP9UCn779m369evHjz/+SOPGjV/qPLLQySOvslDXr1+ne/fuzJgxg969ewPwVq8eJGXfxdI5iaqN7GjZpiG1vb7G1syvIMzPEwmaBNaGbeBG6k0AlDkK+gX0oYVfc5NONL6XGsOci3s5nxkFSsNN214Dw8o3pn/5BkWmeiI/0QkCdxPiORZ0n2MPgogQdGTo/177YyYIBFjZ0KpKFSq6e1DR3UPezb9B/ObVuxz2hDMPH3AvMYEUlRLhr7d2ScJZglo+vrSrXIVa3r54/YcKlteBoNRY5pzfzbmsKKSnYS0vK3sGlqhDr4Aa2JiZriBM0aawNXI7ZxLPAWClsqKHTzeaezRFpVD9TVxs3ryZyZMnc/jwYQICAgrEJkmSCE3fxu2kuQhSLmZKe6q7TcHHttUze/R6PSqVirJlyzJ48GA+++yzlzqHLHTyyKssVHJyMq1bt8bS0pLWrVuzcfMaklKjaNXHkZtnMhBznenWcQDTp39dQNb/O1pRx/r7GziVdQYBASVKapvXZGilwViq8laOX9hIksT
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cp = plt.contour(X, Y, Z, colors='black', linestyles='dashed', linewidths=1)\n",
"plt.clabel(cp, inline=1, fontsize=10)\n",
"cp = plt.contour(X, Y, Z)\n",
"cp = plt.plot(xline, yline, color='blue')\n",
"cp = plt.scatter(xline, yline, color='deeppink', marker='.')\n",
"plt.xlabel('x')\n",
"plt.ylabel('y')\n",
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"id": "6f16a2ff-53b2-4df1-918f-e461a24b6de1",
"metadata": {},
"source": [
"### Learning rate = 0.01 ###"
]
},
{
"cell_type": "code",
"execution_count": 312,
"id": "0be9e978-cf9e-4ace-9a4d-359636981c32",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x7fcf719f4b50>"
]
},
"execution_count": 312,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAysAAAMWCAYAAADxsxkvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9d5xk6V3fi39Oqpy7uzqnyWFndyfs7E6PVkJrJCxsggkO0o9kG2QLB7ANxoiLSUIITDLi6sI1WDJYhosF2BgskISQhLWr3dVO55xzrBxP/P3RfWqqq6u7K56qM/N9v1611Tt9qp6nTp865/mcb/gwmqZpIAiCIAiCIAiCaDLYRk+AIAiCIAiCIAiiGCRWCIIgCIIgCIJoSkisEARBEARBEATRlJBYIQiCIAiCIAiiKSGxQhAEQRAEQRBEU0JihSAIgiAIgiCIpoTECkEQBEEQBEEQTQmJFYIgCIIgCIIgmhISKwRBEARBEARBNCUkVgiCIAiCIAiCaEpIrBAEQRAEQRAE0ZSQWCEIgiAIgiAIoikhsUIQBEEQBEEQRFNCYoUgCIIgCIIgiKaExApBEARBEARBEE0Ji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yLJ8zAcmP/JC4oUgCOJsSKwQBJGj0DulnIVUsxbYp1IpDA8PAwAePHgAp9NZdJ4sy8Lj8cDj8aC/vx+qqiIWiyEcDmNnZwezs7OwWCw54RIIBGC1Ws8d30xixcyL5mab+2niRZZlSJIESZKwv7+Pvr6+E2ljBEEQxGNIrBAEAQC5hZQsywBOprmcRzPWrGxvb2N8fBxdXV24du1aWQtBlmXh8/ng8/kwODgIRVEQjUYRCoWwvr6OqakpOBy
"text/plain": [
"<Figure size 1000x1000 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"xline, yline, zline = gradient(-4, 4, 1500, 0.01)\n",
"fig = plt.figure(figsize=[10,10])\n",
"ax = plt.axes(projection='3d')\n",
"ax.set_xlabel('x', fontsize=20)\n",
"ax.set_ylabel('y', fontsize=20)\n",
"ax.set_zlabel('z', fontsize=20)\n",
"ax.contour3D(X, Y, Z, 50, cmap='viridis')\n",
"ax.plot3D(xline, yline, zline, 'blue')\n",
"ax.scatter(xline, yline, zline, color='deeppink', marker='v')"
]
},
{
"cell_type": "code",
"execution_count": 313,
"id": "da9d138f-e1dc-431e-8f8f-a23477510f9d",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjoAAAG2CAYAAAB20iz+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOydZXQUZxuGr9W4u0IguDsU1+Da4lootFCl1OErdSjUKC1FCsWd4u7uLgFCiLsnm6zNzPcjlEILJUCSTWCuczg93czuPPsmM3O/jyokSZKQkZGRkZGRkXkGUVraABkZGRkZGRmZokIWOjIyMjIyMjLPLLLQkZGRkZGRkXlmkYWOjIyMjIyMzDOLLHRkZGRkZGRknllkoSMjIyMjIyPzzCILHRkZGRkZGZlnFlnoyMjIyMjIyDy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mbuL9A34EWcNP/2ThkMBmJjY3nttdfw9vbm999/R10E17/enMLZ5C9IyD0IgId1A+p5fY6t2htRFO8rBb906RIDBw7kl19+oUWLFo91HlnoFJAHLlRcDtzOgCBnTm/V0W+MNeGiE2oEptod4x3r8yg29OScbTK9e/dmypQp9OvXD4CX+vYhNfcK1q6p1G7uQLuQZjT0+Qp7TYDFvmOyIZklkcs5n3EBAGWegoFB/Wkb0KZEJxpfzYhn+onNHMuJzfekAY4GGFm1BYOqNi011ROFiUkQuJKcxN7Qa+y9Hkq0YCLb/O/aH40gEGRjR/tataju6UV1Ty95N/8c8ZdX71RkBIdvXOdqSjLpKiXCP2/tkoSrBA38/OlUsxYNfP3xeYIKlmeB0IwEph/byFFdLNKdsJaPjSNDyjW
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cp = plt.contour(X, Y, Z, colors='black', linestyles='dashed', linewidths=1)\n",
"plt.clabel(cp, inline=1, fontsize=10)\n",
"cp = plt.contour(X, Y, Z)\n",
"cp = plt.plot(xline, yline, color='blue')\n",
"cp = plt.scatter(xline, yline, color='deeppink', marker='.')\n",
"plt.xlabel('x')\n",
"plt.ylabel('y')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "6bba592a",
"metadata": {},
"source": [
"## Druga funkcja"
]
},
{
"cell_type": "markdown",
"id": "1fd1ddd8-9034-498a-9b01-c05f867a2e22",
"metadata": {},
"source": [
"### Learning rate = 0.1"
]
},
{
"cell_type": "code",
"execution_count": 314,
"id": "30276af9-9ed2-4355-a0b0-5566bc911bff",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x7fcfd73b8040>"
]
},
"execution_count": 314,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAysAAAMWCAYAAADxsxkvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG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l3iRJAmrq6sYHBwsEIzFPS8kXgiCIAi9ILFCEIShVDo7ZWNjAzMzM7hw4QKuXLlSl4uWnqhluGixWOD3++H3+zE0NARJknBwcID9/X3s7Oxgbm4ODofjhHiphnzhYrFYlKxLLpdDLpdDKpUi8UIQBEHoCokVgiAMo5KyL1EUMTU1hUgkgrt376Kjo8OIrdaElgG8xWJRRMnw8DByuZwiXra2thAOh+F0OgvES1NTU1VrsMwLE4bF4qW4Yd9qtcJms5W1lyYIgiCIaiGxQhCEIbBsymllXwcHBwiFQnC5XHj8+DGcTqcBO60PvUZZWa1WBAIBBAIBAM9E3sHBAWKxGDY2NjA7O4umpia0trYqAqbc8Sy359PEiyiKyp8z0cIyLyReCIIgiFohsUIQhK4Uz04pV/a1vLyMhYUFXLp0CcPDw1wGu0bu2Wazoa2tDW1tbQCeiZf9/X3EYjGsra1henoabrdbybq0tLRUvUY58SKKIrLZbIF4YZkXVjZGEARBEJVAYoUgCN1gs1PeeOMN3L17t2RDeDqdxsTEBBKJBF588cWagmgzoVdm5SxsNhva29vR3t4OAMhms4p4WVpaQiKRUAwLnj59ikAgALvdXtUaJF4IgiAItSGxQhCE5siyrAgVZskry/IJoRKJRDA+Po7W1laMjo5WHSybDTNng+x2Ozo6OpQeoEwmg6dPn2J2dhZLS0uYmpqC1+styLxUO8vmLPEC4ESzPokXgiAIIh8SKwRBaEq5Jvr8jIMkSVhYWMDKygquXbuG/v5+Uwf61WCWzMpZOBwOdHR0YHZ
"text/plain": [
"<Figure size 1000x1000 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"xline2, yline2, zline2 = gradient2(-2, -1, 15, 0.1)\n",
"fig = plt.figure(figsize=[10,10])\n",
"ax = plt.axes(projection='3d')\n",
"ax.set_xlabel('x', fontsize=20)\n",
"ax.set_ylabel('y', fontsize=20)\n",
"ax.set_zlabel('z', fontsize=20)\n",
"ax.contour3D(X, Y, Z2, 30, cmap='viridis')\n",
"ax.plot3D(xline2, yline2, zline2, 'blue')\n",
"ax.scatter(xline, yline, zline, color='deeppink', marker='v')"
]
},
{
"cell_type": "code",
"execution_count": 315,
"id": "1865802c-5b43-419a-9c4b-39de287438c2",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlAAAAGwCAYAAABmTltaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAADktklEQVR4nOydd3gc5bWH3+1Fq957lyXLkpvcjRvGNsbGNpiSAiEEQgLkBkhIIKTcFEIJySWBAKGEJBCKTTVgMO4Fd1uyZbmo915W29vM3D/WRbLlLmkls+/z7CN7Z2fn7M7ON7/vnPOdI5MkScKPHz9+/Pjx48fPBSP3tQF+/Pjx48ePHz/DDb+A8uPHjx8/fvz4uUj8AsqPHz9+/Pjx4+ci8QsoP378+PHjx4+fi8QvoPz48ePHjx8/fi4Sv4Dy48ePHz9+/Pi5SPwCyo8fP378+PHj5yJR+tqAKwFRFGlsbCQwMBCZTOZrc/z48ePHjx8/F4AkSZjNZuLi4pDLL86n5BdQ/UBjYyOJiYm+NsOPHz9+/PjxcwnU1dWRkJBwUfv4BVQ/EBgYCMDcp/5IpeBGUChOblMIkFcvMTEmmmvf7CKtHWRyOfxxBsxIgOpuSAmGWMNl2eARRHaWVrNmz0H2VTTQ6ZLgNG+YQS6SnxDF3II8JmYlERF0ece8GBpbjBw80sCWHQcpq26j2yrSVwRZKReIidAxKiuRieNHkJUWRWRY3549p9OJUqlEcfz7FgQBmUx20bOIi8Vhd1FaUk9laSPHDtdQX91Kd4cDh1XC4xbOua8+UIU2ACJjQkhKjSYjO5G4hAii40MIjQhCofBH1f0MP/bv38+bb77Jhx9+SFdXF5WVlYSFhSGKInK5nIMHDyKTyRg5ciQACoWCL7/8kieffJLf/e53TJ8+/ZKO63Z7aG8x0dLURV1lKxWlt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QvU0ZoGPlBwdw4roCCuHhUijPDnD3xCygf0+cJaLRAlRFSQ7yip6eoknt/pEejJD5Ot/FphoPGxADoEXMPscH0ShlX5aQz9691hFo5FeqbkzQggmpveR1f7C5ib3k9HW44/YehQyA3Lox5E0YzfWQ6CeHBPhm43G6B6voOSqtaOFbRQllVK+U1bdgdbkztVdSXbqSr+ShxGdNJzV9EYlw45fs/INCg4fE/PkN6SiTBBjXp6encf//9PPLII4P+GS4WSZLo7rTS0mSktclIdUUjNRWNyCQtbc3dVFc04LAK9DUY94VMDlExIYRFBmJzmgiPDCI6Noz4xChi4iMIiwgkJCyA4LAA9AGaYXGD8jNwiKKI1ezA2GnF2GGhvc2EscNMV4cVU5eNrg4rHW0mjO0WSip2Ulz7GTNG3I9aqev1PpIkIUoedpS/RkLoGDLjphEaYSA6LpSImGAiY4KJjPb+jYoNJio2hIBhJva9+UpGyqpa2F14jENH62hqs+L09H0jV8gFosO05I9MYvL4HLLSokiICUUuH/zPLIoSpU1t7Kts4Gff+xbBY2agSByBtaGKqnefBxlEjZ/J/G/fxaQRqRQMgmACaDCZ+PTwITZUlnOwqwun4Dm5TSaKZGh0LB09hkW5eSQGB1/Ue/sFlI+54BPQU1RtqO3lper6QS7rNu1jZbqZI5l6rPoeF5soEldnZWG5hqWVAeS0ypGJDEju1AnMdieFVQ1sO1zB+n2HaHWK3rtuD6KCAkgK0jAjL4urRmWSHh3us4FOFCXqm7soq2qltLKVrdu+orquBbkuAZupma6WYzRVbCdp5HyiksYhOVvZsfrP3H7PYyxffhMZyZGkJoaj0ah8Yn9/IAii9+bWYjoeCjFi7LBSXdlIdUUDZqMDh1VAFC5yFiuTUGlAq1cSEKgmISmG+MQYdAYVeoOaqOgwgkL1BAXrCQrRExi
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cp = plt.contour(X, Y, Z2, colors='black', linestyles='dashed', linewidths=1)\n",
"plt.clabel(cp, inline=1, fontsize=10)\n",
"cp = plt.contour(X, Y, Z2, cmap='viridis')\n",
"cp = plt.plot(xline2, yline2, color='blue')\n",
"cp = plt.scatter(xline, yline, color='deeppink', marker='.')\n",
"plt.xlabel('x')\n",
"plt.ylabel('y')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "298e097b-96bf-4561-996f-029bf90b0896",
"metadata": {},
"source": [
"### Learning rate = 0.01"
]
},
{
"cell_type": "code",
"execution_count": 316,
"id": "0a174218-d7b5-44e0-af25-ea315793f2ee",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x7fcfb4895eb0>"
]
},
"execution_count": 316,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAysAAAMWCAYAAADxsxkvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9d5Qs6Vnmiz4Rkd6b8r5q79p+d/c2vXdXbWQQSIMww2Dmcg8DR8ycmYUwWhcEI7joAOIc6EFiRoMZoRmBkDR3ji6XWUgMzAEh3zIt29qV5b33JjMrK31GxHf/qI7ozKysqszKjEhT72+tvaSuNF9EZJjv+d73eV+OMcZAEARBEARBEARRY/DV3gCCIAiCIAiCIIhCkFghCIIgCIIgCKImIbFCEARBEARBEERNQmKFIAiCIAiCIIiahMQKQRAEQRAEQRA1CYkVgiAIgiAIgiBqEhIrBEEQBEEQBEHUJCRWCIIgCIIgCIKoSUisEARBEARBEARRk5BYIQiCIAiCIAiiJiGxQhAEQRAEQRBETUJihSAIgiAIgiCImoTECkEQBEEQBEEQNQmJFYIgCIIgCIIgahISKwRBEARBEARB1CQkVgiCIAiCIAiCqElIrBAEQRAEQRAEUZOQWCEIgiAIgiAIoiYhsUIQBEEQBEEQRE1CYoU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qF+MkRhlEpiwLGAicVi6jmbSqVyIi+KWd9gMGie0kgQBEGcTe091QmCqGlO652SHenQi4WFBezs7OD27dvo6OjQdexy4DgODocDDocD3d3dYIzh6OgIoVAIBwcHWFxcBM/z8Hq9MBqNkGVZ16jVZUHxvAiCkBN5SSa
"text/plain": [
"<Figure size 1000x1000 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"xline2, yline2, zline2 = gradient2(-4.5, 0, 1500, 0.01)\n",
"fig = plt.figure(figsize=[10,10])\n",
"ax = plt.axes(projection='3d')\n",
"ax.set_xlabel('x', fontsize=20)\n",
"ax.set_ylabel('y', fontsize=20)\n",
"ax.set_zlabel('z', fontsize=20)\n",
"ax.contour3D(X, Y, Z2, 30, cmap='viridis')\n",
"ax.plot3D(xline2, yline2, zline2, 'blue')\n",
"ax.scatter(xline, yline, zline, color='deeppink', marker='v')"
]
},
{
"cell_type": "code",
"execution_count": 317,
"id": "d3c27a35-9162-4b27-bd26-98ecc59a5fb4",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjoAAAG2CAYAAAB20iz+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOyddXQU5xqHn9nduHsgCYHg7u7uJLgVKAVKW+put663vS0VXIq7u7u7BYcQIoS4r87M/WOBlraUtE12Nsk85+RwWPt+2ezO/Ob9XhFkWZZRUVFRUVFRUSmBaJQWoKKioqKioqJSVKhGR0VFRUVFRaXEohodFRUVFRUVlRKLanRUVFRUVFRUSiyq0VFRUVFRUVEpsahGR0VFRUVFRaXEohodFRUVFRUVlRKLanRUVFRUVFRUSiyq0VFRUVFRUVEpsahGR0VFRUVFRaXEUmyNzpdffokgCLz88stKS1FRUVFRUVGxU4ql0Tl+/DjTp0+nTp06SktR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La2Agj39+bzYd2oG65ML4jfkptnZOGaYyzbcJK78Ze4fnIZNeo2Y8GcqdSoGg780fBIkoRGoyE+Pp4LFy7g4uJC27Ztlfw1/oAsy8Rcu8vaxXvZvz36IdMDMsHhbvTo15xOvRvh6//3m22pqPyWEydOMHv2bJYtW0Z6ejopKSn4+fk9+K6cOXMGQRAetPzQarWsWrmG9979Dy3r9SX1lg6D3vTg9Xz83aleP5jIIW2o1aA82mK2tfxbMrLy+XbqevYfj0OSQRCgXjV/3nuxL8GBXjbT8dprr/H999/
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cp = plt.contour(X, Y, Z2, colors='black', linestyles='dashed', linewidths=1)\n",
"plt.clabel(cp, inline=1, fontsize=10)\n",
"cp = plt.contour(X, Y, Z2, cmap='viridis')\n",
"cp = plt.plot(xline2, yline2, color='blue')\n",
"cp = plt.scatter(xline2, yline2, color='deeppink', marker='.')\n",
"plt.xlabel('x')\n",
"plt.ylabel('y')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "b0ac88f0-a730-48da-8a56-b68efd5e2d85",
"metadata": {},
"source": [
"### Zmiana punktu startowego - brak zbieżności ###"
]
},
{
"cell_type": "code",
"execution_count": 318,
"id": "d283d6c3-6c61-4abb-8355-7c3956bf9ce6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x7fcfb1d0f0d0>"
]
},
"execution_count": 318,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAysAAAMWCAYAAADxsxkvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOy9aXAr6XXe/zQAAgRAAuC+X253X2bmLnPnEjeytcsjeWLZipwoTuJyqmKnYjne4lKsSsXyEiWufIirYlv5y7HjOHHiWFIs2Za1eGTJWkca6RLgToL7vgHggh2N7v8H5u1pgACJpTcA51d1y/KQ4ItuNLrP857znMOJoiiCIAiCIAiCIAjCYJj0fgMEQRAEQRAEQRD5ILFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARBEIQhIbFCEARBEARB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ihSCISyl2doq8DEwLihUrh4eHmJiYQFtbG+7fvw+TySR5bSwWC9rb29He3g7grP1yOBxGOBzG0tISYrEYmpubJfHidrthsWh766QyMOW57JwWEi+CIEjixWQynTPsk3ghCIJQFhIrBEFcCOumVMwkeqOJFUEQsLi4iLW1Ndy6dQt9fX1S6VghX01DQwM6OzvR2dkJ4Cwjw8TL/Pw8kskkXC6XJF5cLlfW7A81jpFQh1LO7UXiJZlMIpFIkHghCIJQARIrBEHkhZV9sQxEMUGXkcRKPB6H3+8Hz/N48uQJmpuby1rDZrOhu7sb3d3d0t9l4mV7exs8z0tG/ZaWFjQ3N2vi1yEqo9JrVC5e2N9j35lMJlPQsJ/7OoIgCOJiSKwQBHEO+ewUoHDZVy5yg70WFBIr+/v7mJycRFdXF27duqVo5sNut8Nut6O3txeiKCIWi0niZWNjA4IgwOPxSOKlqamp4uCUysCMDxMhct+W3OfFfp7reSHxQhAEcTEkVgiCkMg
"text/plain": [
"<Figure size 1000x1000 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"xline2, yline2, zline2 = gradient2(-4.5, 1, 1500, 0.01)\n",
"fig = plt.figure(figsize=[10,10])\n",
"ax = plt.axes(projection='3d')\n",
"ax.set_xlabel('x', fontsize=20)\n",
"ax.set_ylabel('y', fontsize=20)\n",
"ax.set_zlabel('z', fontsize=20)\n",
"ax.contour3D(X, Y, Z2, 30, cmap='viridis')\n",
"ax.plot3D(xline2, yline2, zline2, 'blue')\n",
"ax.scatter(xline, yline, zline, color='deeppink', marker='v')"
]
},
{
"cell_type": "code",
"execution_count": 319,
"id": "74869483-6584-4e4c-93e5-e01ba48f7a61",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAi4AAAHACAYAAACF7OOwAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAA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oIMB7BBYBz/HZVkUusKgIMQ3ABAADGILgAcA6acwHjEVwAOAfNuYDxCC4AnIPmXMB4BBcAzsEl/wHjEVwAOAuX/AeMRnAB4Cxc8h8wGsEFgHOwqggwHsEFgHOwqggwHsEFgHOwqggwnu3BZf/+/brjjjtUs2ZNValSRR06dNDatWvtLgtAIOKS/4DxQux88J9//llXXXWVEhIS9OWXX6pOnTrasWOHqlevbmdZAADAT9kaXJ5//nnFxMRoypQpvrGGDRvaVxCAwOZrzu2Uf/tMc+41DZh1AQxh66mizz77TB07dlTfvn1Vp04dXXLJJZo8eXKR+3s8HmVkZBTYAKDYaM4FjGdrcNm5c6cmTpyoZs2aacGCBRo6dKgefPBBvf/++4Xun5SUpKioKN8WExNTwRUDMBrNuYDxXJZlWX+8W/kIDQ1Vx44dtWLFCt/Ygw8+qDVr1mjlypXn7O/xeOTxeHy3MzIyFBMTI7fbrcjIyAqpGYDhpm/SsH/k6tWT7fVYlRSNfasKV88FKlhGRoaioqJK9f5t64xLvXr11KpVwReMiy++WHv37i10/7CwMEVGRhbYAACAc9gaXK666ipt2bKlwNjWrVsVGxtrU0U
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cp = plt.contour(X, Y, Z2, colors='black', linestyles='dashed', linewidths=1)\n",
"plt.clabel(cp, inline=1, fontsize=10)\n",
"cp = plt.contour(X, Y, Z2, cmap='viridis')\n",
"cp = plt.plot(xline2, yline2, color='blue')\n",
"cp = plt.scatter(xline2, yline2, color='deeppink', marker='.')\n",
"plt.xlabel('x')\n",
"plt.ylabel('y')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "cc28229a-2ce9-4830-b0f3-fef3cdf048e2",
"metadata": {},
"source": [
"### Zadanie 2 ###"
]
},
{
"cell_type": "code",
"execution_count": 320,
"id": "04a92a75",
"metadata": {
"deletable": false,
"nbgrader": {
"cell_type": "code",
"checksum": "93f80346581dfbf0111ea2eb79f851ac",
"grade": true,
"grade_id": "cell-81f6af67fad17986",
"locked": false,
"points": 2,
"schema_version": 3,
"solution": true,
"task": false
}
},
"outputs": [],
"source": [
"\n",
"def dfx_differences(x, y, h):\n",
" return (f(x + h, y) - f(x - h, y)) / 2*h\n",
"\n",
"def dfy_differences(x, y, h):\n",
" return (f(x, y + h) - f(x, y - h)) / 2*h\n",
"\n",
"def gradient_differences(xi, yi, steps, lr, h):\n",
" xline = []\n",
" yline = []\n",
" zline = []\n",
" \n",
" for i in range(0, steps):\n",
" xi_new = xi - lr * dfx_differences(xi, yi, h)\n",
" xline.append(xi)\n",
" \n",
" yi_new = yi - lr * dfy_differences(xi, yi, h)\n",
" yline.append(yi)\n",
" \n",
" res = f(xi, yi)\n",
" zline.append(res)\n",
" \n",
" xi = xi_new\n",
" yi = yi_new\n",
" \n",
" return xline, yline, zline\n",
"\n",
"def gradient_differences2(xi, yi, steps, lr, h):\n",
" xline = []\n",
" yline = []\n",
" zline = []\n",
" \n",
" for i in range(0, steps):\n",
" xi_new = xi - lr * dfx_differences(xi, yi, h)\n",
" xline.append(xi)\n",
" \n",
" yi_new = yi - lr * dfy_differences(xi, yi, h)\n",
" yline.append(yi)\n",
" \n",
" res = f2(xi, yi)\n",
" zline.append(res)\n",
" \n",
" xi = xi_new\n",
" yi = yi_new\n",
" \n",
" return xline, yline, zline"
]
},
{
"cell_type": "code",
"execution_count": 325,
"id": "d3b2f0d0-68fb-4024-b92a-a7c2b91183be",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x7fcfe58b2760>"
]
},
"execution_count": 325,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAysAAAMWCAYAAADxsxkvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9d5wk913nj7+qOucwOc/s7O5skla7Wq20s7LkDCae8WHCAQbugB8GAwfH+QE+DsOdiUc6zvj75QBjY3zwBdsHxmAwQpZtLFmyPD15Zyfn3Dl3hd8fs1Xq7unp6VBdXTX7furRjx7tdPfnUzXV9Xm/Pu/EiKIogiAIgiAIgiAIQmOwzZ4AQRAEQRAEQRBEKUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEARBEARBEAShSUisEATxUCKKYrOnQBAEQRDEKRibPQGC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/ng8/ng9PpBMMw4ACYSrw3XcMcibPBSZ4XQRCQyWSQTqfBsuyxhH3yvBAEQdQHiRWCIEoihX2V86bkowfPyu7uLqamptDR0YFHH30U6XQa4XAYoVAIy8vLYBjmSLh84U249MxzR+PgNa8KV6VXBSDPiho04xznixdpDtJ3huf5ExP2i99HEARBlIfECkEQx5B6p0hhUpXsDmtZrAiCgLm5OWxubuLq1avo6OhANpuF0+mEy+VCX1+fHBoWCoVwcHBwzLuSBqouzayHimWEMkgihGWPoqvzxQvHcQV9YPI9LyReCIIgykNihSAImeLeKdUYUlpNsE8mkwgEAgCAO3fuwOFwlJwny7Jwu91wu90YGBhAcuFRuM//mZxs/7k/7oflxRflkDGfzweLpVzdsCP0JFb0bDRrbe4niReO4+T8r4ODA/T39x8
"text/plain": [
"<Figure size 1000x1000 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"xline_diff, yline_diff, zline_diff = gradient_differences(-4, 4, 1000, 0.1, 0.001)\n",
"fig = plt.figure(figsize=[10,10])\n",
"ax = plt.axes(projection='3d')\n",
"ax.set_xlabel('x', fontsize=20)\n",
"ax.set_ylabel('y', fontsize=20)\n",
"ax.set_zlabel('z', fontsize=20)\n",
"ax.contour3D(X, Y, Z, 30, cmap='viridis')\n",
"ax.plot3D(xline_diff, yline_diff, zline_diff, 'blue')\n",
"ax.scatter(xline_diff, yline_diff, zline_diff, color='deeppink', marker='v')"
]
},
{
"cell_type": "code",
"execution_count": 322,
"id": "5247eda5-50c3-440d-b71b-9474666790a2",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjoAAAG2CAYAAAB20iz+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOyddXQUVx+Gn5W4uwdLcHd3dynuxaFUKBUK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qOhRknLuhEPRtCN3I04ziC0mh4GrrXp1fAGzhZ/H11SqvVEhMTw5gxY/D29uaXX35BXQDXv8aQxJXEL4jLOQGAh3UtanhNw1btjSiKf0oFv3nzJv369ePHH3+kcePGL3Qe2ejkkZcZqKtXr9K9e3emT59O7969AejZqwfJObexdk2maiMHWrZpSG2fr7C3CCgI+XkiUZvI6sh1XEu7DoAyV0G/En1oEdDcrAON76TFMuv8bs5mxYDSeNN21MKw8o3pX75BkcmeyE/0gsDtxASOhIZw5G4o0YKeTMPfc38sBIESNna0qlKFip5eVPT0kmfzrxG/repdjIzg1L273ElKJFWlRPjrrV2ScJWglp8/7SpXoZavPz7/IYPlVSA0LY5ZZ3dyJjsG6cm2lo+NIwNL1qFXiRrYWZivIUzVpbL50VZOJZ0BwEZlQw+/bjT3aopKofqbudi4cSOTJ0/m4MGDlChRokA0SZJEeMYWbibPRpA0WCgdqe4xBT/7Vk/1GAwGVCoVZcuWZfDgwXzyyScvdA7Z6OSRlxmolJQUWrdujbW1Na1bt2b9xlUkp8XQqo8z109lImpc6dZxAF9++VUBqX82OlHP2pB1nMg
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cp = plt.contour(X, Y, Z, colors='black', linestyles='dashed', linewidths=1)\n",
"plt.clabel(cp, inline=1, fontsize=10)\n",
"cp = plt.contour(X, Y, Z, cmap='viridis')\n",
"cp = plt.plot(xline_diff, yline_diff, color='blue')\n",
"cp = plt.scatter(xline_diff, yline_diff, color='deeppink', marker='.')\n",
"plt.xlabel('x')\n",
"plt.ylabel('y')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 323,
"id": "e31d5217-114e-4ee3-b0f2-8372f0db3308",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x7fcfe57d33d0>"
]
},
"execution_count": 323,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "i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iAqQhAEcByHjY0NbG1t4c4776zLVCmgOCHA8zympqawsbGBs2fPor29HYIgyGVqAKDVatHc3Izm5mYAQDwel8XL/Pw8wuEwbDabLF4cDge02sKnTwqK60eqhwtw89gg8UIQBKFuSKwQBFEWqf0DoiiCZdm6+p4U0w8SDAbh8XjAsiyGhoZgNpuL+tt6vR6tra1obW0FAMRiMfh8Pvh8PkxPTyMWi8Fut8PpdMriJbU8KRXKrNSHzONO+neqeJH+i8ViiMfjALL7vJB4IQiCUA4kVgiCKJnMJnrpjnU9A/NCYmVtbQ0TExM4cuQI+vv7K/LqMBgMaG9vR3t7OwAgEonI4mViYgIcx8Fut8uZF7vdXvNSuFqgtv2WgpR5AZICJlO8pGZedDqdPCZZjZ8jQRDErQSJFYIgSiKXd0q9J1/lWo/jOExOTmJ7exsXLlxAS0tL1dc2mUwwmUzo7OyEKIpp4mV1dRWCIMDhcIDjOJjN5rpmnG5Hyjnu8omXaDQqP0YSL1LmhcQLQRBEfSGxQhBEURTyTmEYBoIg1G0/2cRKIBDA8PAw9Ho9rl27lncccTUNKs1mM8xmM7q6uuRhAz6fDysrKwgEAtjd3ZVLxlwuFywWi6ID3tuxdK1Y8SJlXEi8EARB1AcSKwRBFKQY75RGZlZEUcTKygqmp6dx7NgxHD9+vKiyr1pkPBiGgdVqhdVqRSQSAQC0t7fD5/Nhb28P8/Pz0Gg0aWOSTSYTBbwVUovPMZt4EQRBFi8syx7qeSHxQhAEUV1IrBAEkRdpmlIh75RG9awkEgm
"text/plain": [
"<Figure size 1000x1000 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"xline_diff2, yline_diff2, zline_diff2 = gradient_differences2(-4, -4, 1500, 0.1, 0.1)\n",
"fig = plt.figure(figsize=[10,10])\n",
"ax = plt.axes(projection='3d')\n",
"ax.set_xlabel('x', fontsize=20)\n",
"ax.set_ylabel('y', fontsize=20)\n",
"ax.set_zlabel('z', fontsize=20)\n",
"ax.contour3D(X, Y, Z2, 30, cmap='viridis')\n",
"ax.plot3D(xline_diff2, yline_diff2, zline_diff2, 'blue')\n",
"ax.scatter(xline_diff2, yline_diff2, zline_diff2, color='deeppink', marker='v')"
]
},
{
"cell_type": "code",
"execution_count": 324,
"id": "28887dab-8d71-4cb2-a7dc-6aaf00cb7cac",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjoAAAG2CAYAAAB20iz+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOydZXQU59+Gr7W4GyQkJAFCkODu7g7FoUBpS1tKS53+6+5vqUFbaHF3d3cIEAiEAIGECHHXlZl5PyzQ0hYIkOxsYK5zOD2dlbl3sjtzz/MzlSRJEgoKCgoKCgoKjyBquQUoKCgoKCgoKJQXitFRUFBQUFBQeGRRjI6CgoKCgoLCI4tidBQUFBQUFBQeWRSjo6CgoKCgoPDIohgdBQUFBQUFhUcWxegoKCgoKCgoPLIoRkdBQUFBQUHhkUUxOgoKCgoKCgqPLIrRUVBQUFBQUHhkqbBG54svvkClUjF16lS5pSgoKCgoKChYKRXS6Jw4cYLff/+d+vXryy1FQUFBQUFBwYqpcEanoKCA0aNHM2vWLNzd3eWWo6CgoKCgoGDFaOUWcL9MnjyZPn360LVrVz799NO7Plev16PX62/9vyiKZGVl4enpiUqlKm+pCgoKCgoKCmWAJEnk5+fj5+eHWn1/azQVyugsXbqUU6dOceLEiVI9/4svvuCjjz4qZ1UKCgoKCgoKliAhIQF/f//7ek2FMToJCQm8/PLLbN++HTs7u1K95u233+bVV1+99f+5ublUrVqVgI/eRaPT8XKzlkxo1sKiqzsZeQV8vW4/+y/EAuCilfhy3AAaVw+wmIY7IUkSOw9EsXhdOEmpuQDYakXGDW3NwB5N0Go1Miu8P9JTcti1PoK92yJJu55za7vWTqJN19oMGN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axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cp = plt.contour(X, Y, Z2, colors='black', linestyles='dashed', linewidths=1)\n",
"plt.clabel(cp, inline=1, fontsize=10)\n",
"cp = plt.contour(X, Y, Z2, cmap='viridis')\n",
"cp = plt.plot(xline_diff2, yline_diff2, color='blue')\n",
"cp = plt.scatter(xline_diff2, yline_diff2, color='deeppink', marker='.')\n",
"plt.xlabel('x')\n",
"plt.ylabel('y')\n",
"plt.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.9.13 ('base')",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
"autoclose": false,
"autocomplete": true,
"bibliofile": "biblio.bib",
"cite_by": "apalike",
"current_citInitial": 1,
"eqLabelWithNumbers": true,
"eqNumInitial": 1,
"hotkeys": {
"equation": "Ctrl-E",
"itemize": "Ctrl-I"
},
"labels_anchors": false,
"latex_user_defs": false,
"report_style_numbering": false,
"user_envs_cfg": false
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"vscode": {
"interpreter": {
"hash": "83181d593ff87630d4a0d7997796f399a1d96b6a7eabd5b16ad531f517f6300b"
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}