RepozytoriumzprojektemPython/stopy/Ćwiczenia_6.ipynb

840 lines
64 KiB
Plaintext
Raw Normal View History

2024-11-13 08:24:58 +01:00
{
"cells": [
{
"cell_type": "markdown",
"id": "4cc6c96f",
"metadata": {},
"source": [
"# Ćwiczenia 6"
]
},
{
"cell_type": "markdown",
"id": "1276423e",
"metadata": {},
"source": [
"***TEMAT:*** funkcje wielu zmiennych - definicja, wykres, granica, ciągłość, pochdone cząstkowe i gradient"
]
},
{
"cell_type": "markdown",
"id": "a92c3fcc",
"metadata": {},
"source": [
"## Funkcje wielu zmiennych: definicja i wykresy niektórych funkcji"
]
},
{
"cell_type": "markdown",
"id": "c85e4fed-46e6-4310-9128-337d82b8c235",
"metadata": {},
"source": [
"Funkcją $n$-zmiennych ($n \\geq 2$) określoną na zbiorze $A\\subset\\mathbb{R}^n$ o wartościach w $\\mathbb{R}$ nazywamy przyporządkowanie każdemu punktowi ze zbioru $A$ dokładnie jednej liczby rzeczywistej. Funkcję taką oznaczamy przez $f:A\\rightarrow \\mathbb{R}$. Wartość funkcji $f$ w punkcie $(x_1, ... x_n)$ oznaczamy przez $f(x_1, ... x_n)$."
]
},
{
"cell_type": "markdown",
"id": "b0897f5c-381a-47df-8e6a-e20b5b665b05",
"metadata": {},
"source": [
"#### Zadanie 1 \n",
"\n",
"Wyznacz dziedzinę następujących funkcji i naszkicuj ją na płaszczyźnie:\n",
">1. $f(x,y)=\\sqrt{4-(x-4)^2-(y+2)^2}$;\n",
">2. $f(x,y)=\\ln x\\cdot \\ln y +\\frac{1}{\\sqrt{1-x-y}}$."
]
},
{
"cell_type": "markdown",
"id": "303dc23a-6e38-4435-b067-bfe1d99742f5",
"metadata": {},
"source": [
"##### Rozwiązanie:"
]
},
{
"cell_type": "markdown",
"id": "7ae3148c",
"metadata": {},
"source": [
"1. Dziedzinę funkcji $f$ tworzy zbiór tych $(x,y)$ takich, że \n",
"\n",
"$$\n",
"4-(x-4)^2-(y+2)^2\\geq 0\n",
"$$\n",
"\n",
"czyli zbiór rozwiązań nierówności\n",
"\n",
"$$\n",
"(x-4)^2+(y+2)^2\\leq 4.\n",
"$$\n",
"\n",
"Jest to kolo o środku w punkcie $(4,-2)$ i promieniu $2$."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "d9fd7f28",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAcAAAAHKCAYAAACUvpsVAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAocElEQVR4nO3df3RU5Z3H8U8Iw4QAQZMcIIFAAlIDpQgEf4D8CCooUhdxly0WFZGyiEChnFWodEuwQBABPSsVBS3aogvbohVFXFJNQOUgMUSW2jUoEEASiqImQHAYkmf/sMkh5AcJzOTOnef9OmeOzjN37ny/zx3uJ8/MJBNhjDECAMAyzZwuAAAAJxCAAAArEYAAACsRgAAAKxGAAAArEYAAACsRgAAAKxGAAAArEYAAACsRgAAAKxGAAAArEYBAgPh8Pk2cOFFJSUmKiYnRDTfcoB07djhdluswj2gqBCAQIOfOnVNKSoo++OADffvtt5o6dar+6Z/+SWVlZU6X5irMI5pKBN8GAQRPbGyssrOzdc011zhdiqsxjwgGVoBw1GOPPaaePXuqoqLC6VKqef755xUREaHWrVvXuO2FF15Qx44ddfr06Xr38emnn+rMmTPq1q1bsMqsEkrz+O677+qBBx5QamqqWrVqpY4dO2r06NHKy8urtl0ozmOl+o4/wogBHHL06FHTqlUr88c//tHpUqr54osvTNu2bU1iYqJp1apVjdv9fr/p3r27+fWvf13nPk6fPm369+9vFi5cGMxSjTGhN4//8i//YoYNG2aeeeYZk5OTY/74xz+aG264wTRv3ty88847VduF2jxWutjxR/jgJVA4Zs6cOXr55Zd1+PBhNWsWOi9G3HHHHYqIiFBsbKz+9Kc/6dSpUzW2Wb58uX7zm9+oqKhI0dHR1W7z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OyZcs0b948ffzxx+rRo4eDFdYtlOYR9iEA4RhjjAYOHKi0tDStXLnS6XIabP/+/erRo4feffddDRo0yOlyqs3j0qVLtWfPHuXm5urhhx/WokWL9O///u9Ol1irUJtH2IffA4RjIiIitGbNGiUmJobEtxg01OHDh7Vy5cqQOWmfP49vv/22Bg4cqMzMTD366KMhG35S6M0j7MMKEABgJdeuADMzMxUREaFZs2Y5XQoAwIVcGYC5ublavXp1jY99AwDQUK4LwFOnTmn8+PFas2aNrrzySqfLAQC4lOt+EX7atGkaNWqUbrnlFi1cuLDebX0+n3w+X9X1iooKff3114qLi+MP3gKAyxhjdPLkSSUmJgbky59dFYDr16/X7t27a/yx3rpkZmZqwYIFQa4KANCUjhw5EpDvbHRNAB45ckQzZ87U1q1ba/17frX55S9/qdmzZ1ddLykpUefOnbVv3z7FxsYGq9SQ4vf7NWrUKG3evFkej8fpcpqM3+9Xdna2hg0bRt9hzsaeJTv7/vrrr/WDH/xAbdq0Ccj+XBOAeXl5On78eLXvEysvL9f27du1cuVK+Xy+Gl8J4/V65fV6a+wrNjZWcXFxQa85FPj9fkVGRiouLs6afyTS931HR0fTtwVs7Fmyt29JAXsLyzUBePPNN2vv3r3VxiZOnKjU1FTNmTOn3u+LAwDgQq4JwDZt2qhXr17Vxlq1aqW4uLga4wAAXIzrfg0CAIBAcM0KsDY5OTlOlwAAcClWgAAAKxGAAAArEYAAACsRgAAAKxGAAAArEYAAACsRgAAAKxGAAAArEYAAACsRgAAAKxGAAAArEYAAACsRgAAAKxGAAAArEYAAACsRgAAAKxGAAAArEYAAACsRgAAAKxGAAAArEYAAACsRgAAAKxGAAAArEYAAACsRgAAAKxGAAAArEYAAACs
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# Define the grid of x and y values\n",
"x = np.linspace(-2, 10, 400)\n",
"y = np.linspace(-8, 4, 400)\n",
"X, Y = np.meshgrid(x, y)\n",
"\n",
"# Define the function for the inequality (x-4)^2 + (y+2)^2 <= 4\n",
"Z = (X - 4)**2 + (Y + 2)**2 - 4\n",
"\n",
"# Plot the contour for the region where Z <= 0\n",
"plt.contourf(X, Y, Z, levels=[-1000, 0], colors=['lightblue'])\n",
"\n",
"# Additional plot settings\n",
"plt.xlabel('x')\n",
"plt.ylabel('y')\n",
"plt.title(r'$(x-4)^2 - (y+2)^2 \\leq 4$')\n",
"plt.axhline(0, color='black',linewidth=0.5)\n",
"plt.axvline(0, color='black',linewidth=0.5)\n",
"plt.grid(True)\n",
"plt.gca().set_aspect('equal', adjustable='box')\n",
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"id": "c4050694",
"metadata": {},
"source": [
"2. Dziedzinę funkcji $f$ tworzy zbiór tych $(x,y)$ dla których\n",
"\n",
"$$\n",
"x>0, y>0 \\text{ oraz } 1-x-y>0.\n",
"$$"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "3b933612",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAbkAAAHHCAYAAAAifCaZAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAABSyElEQVR4nO3de1xUZf4H8M9czjBcxLsIiopphl20hVq10LLEQE0xb9VqlpYsmze6abSZVtp2IdJNy1uWmbqWWluoYN7FShHbfqmbmxc0JMSS+zC35/eHyyyXARmYOWcun/frxas4PDPn+zjDfDjnPM9zVEIIASIiIi+kVroAIiIiV2HIERGR12LIERGR12LIERGR12LIERGR12LIERGR12LIERGR12LIERGR12LIERGR12LIERGR12LIERGR12LI+bBvv/0WCQkJ6NKlC/z8/BASEoL+/fvjqaeecvi5srKy8NJLL+HKlSvOL1QmpaWlmDVrFsLCwqDX69G3b19s2LBB6bKazNn9KSkpwbPPPov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/PwCgoKAAHTp0aNapS994NYjI7VRdgwsICFC4EnJHVe+L5l6rZcgRkaI89RQluZaz3hcMOSIi8loMOSIi8loMOSIi8loMOSIiB+3btw8jRoxAWFgYVCoVtm7dqnRJbm/p0qWIiIiAXq9HVFQU9u/fL8t+GXIy0Wg0GD16NAYMGOC0mfxEpIyysjL06dM
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# Define the x range for the plot\n",
"x = np.linspace(0, 1, 400)\n",
"\n",
"# Define the boundary lines\n",
"y1 = 0 * x # y = 0 line for y > 0\n",
"y2 = 1 - x # y = 1 - x line for 1 - x - y > 0\n",
"\n",
"# Fill the region where the inequalities hold\n",
"plt.fill_between(x, y1, y2, where=(y2 > y1), color=\"lightblue\", alpha=0.5)\n",
"\n",
"# Plot the boundaries with dashed lines\n",
"plt.plot(x, y2, 'k--', label=r'$1 - x - y = 0$')\n",
"plt.axvline(0, color='k', linestyle='--', label=r'$x = 0$')\n",
"plt.axhline(0, color='k', linestyle='--', label=r'$y = 0$')\n",
"\n",
"# Additional plot settings\n",
"plt.xlim(-0.1, 1.1)\n",
"plt.ylim(-0.1, 1.1)\n",
"plt.xlabel('x')\n",
"plt.ylabel('y')\n",
"plt.title(r'Set: $x > 0$, $y > 0$, $1 - x - y > 0$')\n",
"plt.grid(True)\n",
"plt.legend(loc=\"upper right\")\n",
"plt.gca().set_aspect('equal', adjustable='box')\n",
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"id": "7b9026af-9d58-490c-8707-154352d22ce3",
"metadata": {},
"source": [
"#### Zadanie 2 \n",
"Wykreśl wykres poniższych funkcji:\n",
" >1. $f(x,y)=x^2+y^2$;\n",
" >2. $f(x,y)=\\sqrt{x^2+y^2}$;\n",
" >3. $f(x,y)=\\sqrt{16-x^2-y^2}$ i $g(x,y)=-\\sqrt{16-x^2-y^2} $;\n",
" >4. $f(x,y)=x^2-y^2$."
]
},
{
"cell_type": "markdown",
"id": "fdfcf3f2-447a-42af-ad58-82ebe18b8218",
"metadata": {},
"source": [
"##### Rozwiązanie:"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "1a1d6417-4095-4f3b-a020-cab300fd9de6",
"metadata": {},
"outputs": [],
"source": [
"import IPython.display as display\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "5ccf805e-2bc0-4b70-a62a-a92254ea9c70",
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"800\"\n",
" height=\"600\"\n",
" src=\"https://www.geogebra.org/calculator/ahx8sscp?style=border%3A+1px+solid+black\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f1a946c9af0>"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import IFrame\n",
"IFrame('https://www.geogebra.org/calculator/ahx8sscp', width=800, height=600, style=\"border: 1px solid black\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "08cee401-113a-477e-bb0a-1bfa51afd412",
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"800\"\n",
" height=\"600\"\n",
" src=\"https://geogebra.org/calculator/x4ngbw4r?style=border%3A+1px+solid+black\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f79d050d850>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import IFrame\n",
"IFrame('https://geogebra.org/calculator/x4ngbw4r', width=800, height=600, style=\"border: 1px solid black\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "2f7a5f9f-b234-416f-af00-9f92eb55c53d",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"800\"\n",
" height=\"600\"\n",
" src=\"https://www.geogebra.org/calculator/dywfgwgb?style=border%3A+1px+solid+black\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f79d050d9a0>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import IFrame\n",
"IFrame('https://www.geogebra.org/calculator/dywfgwgb', width=800, height=600, style=\"border: 1px solid black\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "896bc403-9945-4d66-a905-9315debb3abd",
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"800\"\n",
" height=\"600\"\n",
" src=\"https://www.geogebra.org/calculator/rztxuac3?style=border%3A+1px+solid+black\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f79d04ff160>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import IFrame\n",
"IFrame('https://www.geogebra.org/calculator/rztxuac3', width=800, height=600, style=\"border: 1px solid black\")"
]
},
{
"cell_type": "markdown",
"id": "05e2b5c1-e621-4c3e-bea3-15c142af68c4",
"metadata": {},
"source": [
"## Granica i ciągłość"
]
},
{
"cell_type": "markdown",
"id": "13dd02b5",
"metadata": {},
"source": [
"### Granica\n",
"Niech $A\\subset \\mathbb{R}^n$ i niech $x_0\\in A$ będzie punktem skupienia zbioru $A$ (to oznacza, że $x_0$ jest granicą ciągu $(x_n)$ punktów ze zbioru $A\\setminus\\{x_0\\}$). Mówimy, że funkcja $f:A\\to\\mathbb{R}$ ma granicę w punkcie $x_0$ równą $g$ i piszemy\n",
"\n",
"$$\n",
"\\lim_{x\\to x_0 } f(x)=g,\n",
"$$\n",
"\n",
"gdy dla każdego ciągu $(x_n)$ punktów zbioru $A\\setminus\\{x_0\\}$ zachodzi\n",
"\n",
"$$\n",
"x_n \\xrightarrow{n \\to \\infty} x_0\\Rightarrow f(x_n) \\xrightarrow{n \\to \\infty} g.\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "a7630640-71b9-46be-a910-32d41d26d7d6",
"metadata": {},
"source": [
"#### Zadanie 3 \n",
"\n",
"Oblicz następujące granice\n",
">1. $\\displaystyle \\lim_{(x,y)\\to (1,1)}\\frac{x^2y}{x^2+y^2}$;\n",
">2. $\\displaystyle \\lim_{(x,y)\\to (0,0)}\\frac{x^2y}{x^2+y^2}$;\n",
">3. $\\displaystyle \\lim_{(x,y)\\to (0,0)}\\frac{x^2+y^2}{\\sqrt{x^2+y^2}}$;\n",
">4. $\\displaystyle \\lim_{(x,y)\\to (0,0)}\\frac{x^2y^3}{x^4+y^4}$."
]
},
{
"cell_type": "markdown",
"id": "4b48884a-2d2d-4994-925d-2281759c470f",
"metadata": {},
"source": [
"##### Rozwiązanie:\n",
"1. Z własności granic bardzo łatwo dostajemy, że \n",
"\n",
"$$\n",
"\\displaystyle \\lim_{(x,y)\\to (1,1)}\\frac{x^2y}{x^2+y^2}=\\frac{1}{2}.\n",
"$$\n",
"\n",
"2. Dla $(x,y)\\not=0$ mamy \n",
"\n",
"$$\n",
"\\left|\\frac{x^2y}{x^2+y^2}\\right|\\leq |y|\\cdot \\frac{x^2}{x^2+y^2}\\leq |y|.\n",
"$$\n",
"\n",
"Zatem \n",
"\n",
"$$\n",
"\\lim_{(x,y)\\to (0,0)}\\frac{x^2y}{x^2+y^2}=0.\n",
"$$\n",
"3. Dla $(x,y)\\not=(0,0)$ mamy\n",
"\n",
"$$\n",
"\\left|\\frac{x^2+y^2}{\\sqrt{x^2+y^2}}\\right|\\leq |x|\\cdot\\frac{|x|}{\\sqrt{x^2+y^2}}+|y|\\cdot\\frac{|y|}{\\sqrt{x^2+y^2}}\\leq |x|+|y|.\n",
"$$\n",
"\n",
"Zatem\n",
"\n",
"$$\n",
"\\lim_{(x,y)\\to (0,0)}\\frac{x^2+y^2}{\\sqrt{x^2+y^2}}=0.\n",
"$$\n",
"4. Niech dla $(x,y)\\not=(0,0)$ \n",
"\n",
"$$\n",
"f(x,y)=\\frac{x^2y^3}{x^4+y^4},\n",
"$$\n",
"\n",
"niech\n",
"\n",
"$$\n",
"(0,0)\\not=(x_n,y_n)\\xrightarrow{n\\to\\infty}(0,0)\n",
"$$\n",
"\n",
"i niech \n",
"\n",
"$$\n",
"u_n=\\max\\{|x_n|,|y_n|\\}.\n",
"$$\n",
"\n",
"Jest jasne, że \n",
"\n",
"$$\n",
"u_n\\xrightarrow{n\\to\\infty}0.\n",
"$$\n",
"\n",
"Ponadto \n",
"\n",
"$$\n",
"|f(x_n,y_n)|=\\left|\\frac{x_n^2y_n^3}{x_n^4+y_n^4}\\right|\\leq\\frac{u_n^5}{u_n^4}=u_n.\n",
"$$\n",
"\n",
"Zatem \n",
"\n",
"\n",
"$$\n",
"f(x_n,y_n)\\xrightarrow{n\\to\\infty}0.\n",
"$$\n",
"\n",
"Ostatecznie \n",
"\n",
"$$\n",
"\\lim_{(x,y)\\to (0,0)}\\frac{x^2y^3}{x^4+y^4}=0.\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "d10f6a21-3419-4d0e-9bc6-67286fab908f",
"metadata": {},
"source": [
"#### Zadanie 4\n",
"Pokaż, że nastepujace funkcje nie mają granicy w punkcie (0,0).\n",
"\n",
">1. $f(x,y)=1$ jeśli $x=0$ lub $y=0$ oraz $f(x,y)=0$ w przeciwnym wypadku.\n",
">2. $\\displaystyle f(x,y)=\\frac{xy}{x^2+y^2}$ dla $(x,y)\\not=0$."
]
},
{
"cell_type": "markdown",
"id": "fee6a963",
"metadata": {},
"source": [
"##### Rozwiązanie:\n",
"\n",
"1. Ciągi $(0,1/n)_{n\\in\\mathbb{N}}$ oraz $(1/n,1/n)_{n\\in\\mathbb{N}}$ dążą do punktu $(0,0)$. \n",
"Ponadto \n",
"\n",
"\n",
"$$\n",
"f(0,1/n)=1\\xrightarrow{n\\to\\infty}1 \\quad\\text{ i }\\quad f(1/n,1/n)=0\\xrightarrow{n\\to\\infty}0. \n",
"$$\n",
"Zatem funkcja $f$ nie ma granicy w punkcie $(0,0)$.\n",
"\n",
"2. Ciągi $(0,1/n)_{n\\in\\mathbb{N}}$ oraz $(1/n,1/n)_{n\\in\\mathbb{N}}$ dążą do punktu $(0,0)$. \n",
"Ponadto \n",
"\n",
"\n",
"$$\n",
"f(0,1/n)=0\\xrightarrow{n\\to\\infty}0\\quad \\text{ i }\\quad f(1/n,1/n)=1/2\\xrightarrow{n\\to\\infty}1/2. \n",
"$$\n",
"Zatem funkcja $f$ nie ma granicy w punkcie $(0,0)$."
]
},
{
"cell_type": "markdown",
"id": "2076a8a2",
"metadata": {},
"source": [
"### Ciągłość\n",
"\n",
"Niech $A\\subset \\mathbb{R}^n$ i niech $f:A\\to\\mathbb{R}$. Mówimy, że funkcja $f$ jest ciągła w punkcie $x_0\\in A$, gdy \n",
" dla każdego ciągu $(x_n)$ punktów zbioru $A$ zachodzi\n",
"\n",
"$$\n",
"x_n \\xrightarrow{n \\to \\infty} x_0\\Rightarrow f(x_n) \\xrightarrow{n \\to \\infty} f(x_0).\n",
"$$\n",
"\n",
"\n",
"***Uwaga:***\n",
">* Jeśli $x_0$ **nie** jest punktem skupienia zbioru $A$, to funkcja $f$ **jest** ciągła w punkcie $x_0$.\n",
">* Jeśli $x_0$ jest punktem skupienia zbioru $A$, to funkcja $f$ **jest** ciągła w punkcie $x_0$ dokładnie wtedy gdy \n",
"$\\displaystyle \\lim_{x\\to x_0}f(x)=f(x_0)$.\n",
">* Jeśli funkcja $f$ jest ciągła w każdym punkcie zbioru $A$, to mówimy że jest ciągła na $A$.\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "ab4a522c-652e-461d-a880-af51d80b94f8",
"metadata": {},
"source": [
"#### Zadanie 5\n",
"\n",
"Omów ciągłość poniższych funkcji.\n",
"\n",
">1. $f(x,y,z)=x^2y+z$.\n",
">2. $f(x,y)=\\frac{x^4}{x^2+y^2}$, gdy $(x,y)\\not=(0,0)$ oraz $f(0,0)=1$."
]
},
{
"cell_type": "markdown",
"id": "ce59d7b8",
"metadata": {},
"source": [
"##### Rozwiązanie:\n",
"1. Jest jasne, że funkcja $f$ jest funkcją ciągłą na $\\mathbb{R}^3$. Istotnie, niech \n",
"\n",
"$$\n",
"(x_n,y_n,z_n)\\xrightarrow{n\\to\\infty}(x_0,y_0,z_0).\n",
"$$\n",
"\n",
"Wtedy \n",
"\n",
"$$\n",
"x_n\\xrightarrow{n\\to\\infty}x_0,\\quad y_n\\xrightarrow{n\\to\\infty}y_0,\\quad z_n\\xrightarrow{n\\to\\infty}z_0.\n",
"$$\n",
"\n",
"Zatem \n",
"\n",
"$$\n",
"f(x_n,y_n,z_n)=x_n^2y_n+z_n\\xrightarrow{n\\to\\infty}x^2_0y_0+z_0=f(x_0,y_0,z_0).\n",
"$$\n",
"\n",
"2. Argumenty takie jak wyżej i wiedza z wykłady łatwo dają, że funkcja $f$ jest ciągła na zbiorze $\\mathbb{R}^2\\setminus\\{(0,0)\\}$.\n",
"Mamy\n",
"\n",
"$$\n",
"f(0,1/n)=0.\n",
"$$\n",
"\n",
"Zatem $f$ nie jest ciągła w punkcie $(0,0)$."
]
},
{
"cell_type": "markdown",
"id": "933b8b8b-4b65-4cf0-99ac-a07e67c0041e",
"metadata": {},
"source": [
"## Pochodne cząstkowe"
]
},
{
"cell_type": "markdown",
"id": "b8047623-9367-4eca-b8a1-bae341bdcc59",
"metadata": {},
"source": [
"### Definicja i podstawowe rachunki"
]
},
{
"cell_type": "markdown",
"id": "a4098dbc-47a6-475d-aed3-4d9a130c31f2",
"metadata": {},
"source": [
"Pochodną cząstkową I rzędu funkcji $f$ w punkcie $(x_1, ... , x_n)$ względem zmiennej $x_k$ nazywamy granicę ilorazu różnicowego:\n",
"\n",
"$$ \n",
"{\\frac{\\partial f}{\\partial x_k}(x_1, ..., x_n):=\\lim\\limits_{h \\to 0 } \\frac{f(x_1, ... , x_{k-1} , x_k+h, x_{k+1}, ... x_n) - f(x_1, ..., x_n)}{h}.}\n",
"$$\n"
]
},
{
"cell_type": "markdown",
"id": "d446b8ec-7b97-4a08-b7af-d04c59d9a610",
"metadata": {},
"source": [
"#### Zadanie 5 \n",
"\n",
"Oblicz wszystkie pochodne cząstkowe I rzędu dla funkcji \n",
"\n",
"$$\n",
"f(x,y,z)=xy^2+z.\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "bd6fe862",
"metadata": {},
"source": [
"##### Rozwiązanie:\n",
"1.\n",
"\n",
"$$\n",
"\\frac{\\partial f}{\\partial x}(x,y,z)= \\lim_{h\\to 0} \\frac{f((x+h,y,z))-f(x,y,z)}{h}=\n",
"\\lim_{h\\to 0}\\frac{hy^2}{h}=y^2.\n",
"$$\n",
"\n",
"2.\n",
"\n",
"$$\n",
"\\frac{\\partial f}{\\partial y}(x,y,z)= \\lim_{h\\to 0} \\frac{f((x,y+y,z))-f(x,y,z)}{h}=\n",
"\\lim_{h\\to 0}\\frac{x(y+h)^2-xy^2}{h}=\n",
"=\\lim_{h\\to 0}\\frac{2xyh+xh^2}{h}=\\lim_{h\\to 0}(2xy+xh)=2xy.\n",
"$$\n",
"\n",
"3.\n",
"\n",
"$$\n",
"\\frac{\\partial f}{\\partial z}(x,y,z)= \\lim_{h\\to 0} \\frac{f((x,y,z+h))-f(x,y,z)}{h}=\n",
"\\lim_{h\\to 0}\\frac{h}{h}=1.\n",
"$$\n"
]
},
{
"cell_type": "markdown",
"id": "dd16f502",
"metadata": {},
"source": [
"#### Zadanie 6\n",
"\n",
"Obliczymy pochodne cząstkowe funkcji \n",
"\n",
"$$\n",
"f(x,y)=\\begin{cases}\n",
"\\frac{xy}{x^2+y^2}, & (x,y)\\not=(0,0)\\\\\n",
"0, & (x,y)=(0,0).\n",
"\\end{cases}\n",
"$$\n",
"\n",
"w punkcie $(0,0)$."
]
},
{
"cell_type": "markdown",
"id": "3b0b301c",
"metadata": {},
"source": [
"##### Rozwiązanie:"
]
},
{
"cell_type": "markdown",
"id": "4c2c9446",
"metadata": {},
"source": [
"Mamy\n",
"\n",
"$$\n",
"\\frac{\\partial f}{\\partial x}(0,0)=\\lim_{h\\to 0}\\frac{f(h,0)-f(0,0)}{h}\n",
"=\\lim_{h\\to 0}\\frac{0-0}{h}=0\n",
"$$\n",
"\n",
"oraz\n",
"\n",
"$$\n",
"\\frac{\\partial f}{\\partial y}(0,0)=\\lim_{h\\to 0}\\frac{f(0,h)-f(0,0)}{h}\n",
"=\\lim_{h\\to 0}\\frac{0-0}{h}=0.\n",
"$$\n",
"\n",
"***Uwaga:*** zauważmy, że \n",
"\n",
"$$\n",
"f(1/n,1/n)=1/2\\xrightarrow{n\\to\\infty}1/2\\not=0=f(0,0).\n",
"$$\n",
"\n",
"Stąd $f$ nie jest ciągła w punkcie $(0,0)$. Zatem istnienie pochodnych cząstkowych w punkcie $(0,0)$ __nie implikuje__ ciągłości funkcji w tym punkcie"
]
},
{
"cell_type": "markdown",
"id": "44450f43-6d68-44ca-ac06-909841547ba1",
"metadata": {},
"source": [
"#### Zadanie 7\n",
"\n",
"Zbadaj istnienie pochodnych cząstkowych funkcji $f(x,y)=\\sqrt{x^2+y^4}$ w punkcie $(0,0)$."
]
},
{
"cell_type": "markdown",
"id": "e0da843f",
"metadata": {},
"source": [
"##### Rozwiązanie:\n",
"\n",
"1. Mamy\n",
"\n",
"$$\n",
"\\frac{\\partial f}{\\partial x}(0,0)=\\lim_{h\\to 0}\\frac{f(h,0)-f(0,0)}{h}\n",
"=\\lim_{h\\to 0}\\frac{|h|}{h}.\n",
"$$\n",
"\n",
"Ta granica nie istnieje, zatem funkcja $f$ nie ma pochodnej cząstkowej względem pierwszej zmiennej w punkcie $(0,0)$.\n",
"\n",
"2. Na podstawie definicji otrzymujemy, że \n",
"$$\n",
"\\frac{\\partial f}{\\partial y}(0,0)=\\lim_{h\\to 0}\\frac{f(0,h)-f(0,0)}{h}\n",
"=\\lim_{h\\to 0}\\frac{h^2}{h}=0.\n",
"$$\n"
]
},
{
"cell_type": "markdown",
"id": "36fc2bcf-a2dd-47d1-abbb-06bd3782e2bb",
"metadata": {},
"source": [
"#### Zadanie 8 "
]
},
{
"cell_type": "markdown",
"id": "67fd2093",
"metadata": {},
"source": [
"Korzystając z reguł różniczkowania oblicz pochodne cząstkowe poniższych funkcji.\n",
"\n",
"> 1. $f(x,y,z)=x^2+2xyz+yz^3$;\n",
"> 2. $f(x,y)=xe^{x^2+y^2}$;\n",
"> 3. $f(x,y)=\\frac{x^2+y}{x^2+y^2+1}$."
]
},
{
"cell_type": "markdown",
"id": "346feb36-5e77-4e51-9435-df2ea46f3517",
"metadata": {},
"source": [
"Dla $f(x,y,z) = x^2 + 2xyz + yz^3$:\n",
"\n",
"$$\n",
" \\frac{\\partial f}{\\partial x}{(x, y, z)} = 2x + 2yz\n",
"$$\n",
"$$\n",
"\\frac{\\partial f}{\\partial y}{(x, y, z)} = 2xz + z^3\n",
"$$\n",
"$$\n",
"\\frac{\\partial f}{\\partial z} {(x, y, z)} = 2xy + 3yz^2\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "0027c7c4-460f-42fa-91ce-d04330e3152d",
"metadata": {},
"source": [
"Dla $f(x,y) = x e^{x^2 + y^2}$:\n",
"$$\n",
"\\frac{\\partial f}{\\partial x}{(x, y)} = e^{x^2 + y^2} + 2x^2 e^{x^2 + y^2}\n",
"$$\n",
"$$\n",
"\\frac{\\partial f}{\\partial y}{(x, y)} = 2x y e^{x^2 + y^2}\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "81d36af3-1408-4345-8ec1-7f107b5189c1",
"metadata": {},
"source": [
"Dla $ f(x,y) = \\frac{x^2 + y}{x^2 + y^2 + 1} $:\n",
"$$\n",
"\\frac{\\partial f}{\\partial x} {(x, y)} = \\frac{2x(x^2 + y^2 + 1) - (x^2 + y)(2x)}{(x^2 + y^2 + 1)^2} = \\frac{2x(x^2 + y^2 + 1 - y)}{(x^2 + y^2 + 1)^2}\n",
"$$\n",
"$$\n",
"\\frac{\\partial f}{\\partial y} {(x, y)} = \\frac{(x^2 + y^2 + 1) - (x^2 + y)(2y)}{(x^2 + y^2 + 1)^2} = \\frac{x^2 + y^2 + 1 - 2y(x^2 + y)}{(x^2 + y^2 + 1)^2}\n",
"$$"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.2"
},
"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": true
}
},
"nbformat": 4,
"nbformat_minor": 5
}