Changes
This commit is contained in:
parent
51a10d0cff
commit
767665bd3b
213
.ipynb_checkpoints/Wrzodak_Koszarek_Zadania-checkpoint.ipynb
Normal file
213
.ipynb_checkpoints/Wrzodak_Koszarek_Zadania-checkpoint.ipynb
Normal file
@ -0,0 +1,213 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Zadanie 4.6"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'matrix' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[1], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m A\u001b[38;5;241m=\u001b[39m\u001b[43mmatrix\u001b[49m(QQ,\u001b[38;5;241m5\u001b[39m,\u001b[38;5;241m3\u001b[39m,[\u001b[38;5;241m2\u001b[39m, \u001b[38;5;241m4\u001b[39m, \u001b[38;5;241m6\u001b[39m, \u001b[38;5;241m8\u001b[39m, \u001b[38;5;241m10\u001b[39m, \u001b[38;5;241m12\u001b[39m, \u001b[38;5;241m14\u001b[39m, \u001b[38;5;241m16\u001b[39m, \u001b[38;5;241m18\u001b[39m, \u001b[38;5;241m20\u001b[39m, \u001b[38;5;241m22\u001b[39m, \u001b[38;5;241m24\u001b[39m, \u001b[38;5;241m26\u001b[39m, \u001b[38;5;241m28\u001b[39m, \u001b[38;5;241m31\u001b[39m])\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mA =\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(A, \u001b[38;5;124m'\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n",
|
||||
"\u001b[1;31mNameError\u001b[0m: name 'matrix' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"A=matrix(QQ,5,3,[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 31])\n",
|
||||
"print('A =')\n",
|
||||
"print(A, '\\n')\n",
|
||||
"\n",
|
||||
"print('b =')\n",
|
||||
"b=vector(QQ,[-1,0,1,0,1])\n",
|
||||
"print(b, '\\n')\n",
|
||||
"\n",
|
||||
"print('A^T * A =')\n",
|
||||
"print(A.transpose()*A, '\\n')\n",
|
||||
"print('Macierz A^T*A jest kwadratowa, więc rozwiązanie istnieje\\n')\n",
|
||||
"\n",
|
||||
"u=(A.transpose()*A)^(-1)*A.transpose()*b\n",
|
||||
"print('u = (A^T * A)^-1 * A^T * b =')\n",
|
||||
"print(u, '\\n')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"print('b - A * u = ')\n",
|
||||
"print(b - A * u, '\\n')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h3> Zadanie 6 </h3>\n",
|
||||
"\n",
|
||||
"Rozwiąż układ równań $Ax=b$ metodą przybliżoną, gdzie\n",
|
||||
"\n",
|
||||
"$$A=\\left(\\begin{array}{rrr}\n",
|
||||
"2 & 4 & 6 \\\\\n",
|
||||
"8 & 10 & 12 \\\\\n",
|
||||
"14 & 16 & 18 \\\\\n",
|
||||
"20 & 22 & 24 \\\\\n",
|
||||
"26 & 28 & 31\n",
|
||||
"\\end{array}\\right)$$\n",
|
||||
"\n",
|
||||
"oraz $b=(-1,0,1,0,1)$."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Zadanie 4.7\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h3> Zadanie 7</h3>\n",
|
||||
"\n",
|
||||
"Przybliż funkcją $f(t)=a+be^{t}$ zbiór punktów $(1,1)$, $(2,3)$, $(4,5)$ metodą z zadania 6.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"zbior punktów = [(1, 1), (2, 3), (4, 5)]\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'matrix' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[2], line 3\u001b[0m\n\u001b[0;32m 1\u001b[0m zbior\u001b[38;5;241m=\u001b[39m[(\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m1\u001b[39m),(\u001b[38;5;241m2\u001b[39m,\u001b[38;5;241m3\u001b[39m),(\u001b[38;5;241m4\u001b[39m,\u001b[38;5;241m5\u001b[39m)]\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mzbior punktów = \u001b[39m\u001b[38;5;124m'\u001b[39m, zbior)\n\u001b[1;32m----> 3\u001b[0m m\u001b[38;5;241m=\u001b[39m\u001b[43mmatrix\u001b[49m(\u001b[38;5;241m3\u001b[39m,\u001b[38;5;241m2\u001b[39m,[\u001b[38;5;241m1\u001b[39m,exp(\u001b[38;5;241m1.0\u001b[39m),\u001b[38;5;241m1\u001b[39m,exp(\u001b[38;5;241m2.0\u001b[39m),\u001b[38;5;241m1\u001b[39m,exp(\u001b[38;5;241m4.0\u001b[39m)])\n\u001b[0;32m 5\u001b[0m a,b,t\u001b[38;5;241m=\u001b[39mvar(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ma,b,t\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 7\u001b[0m m\u001b[38;5;241m*\u001b[39mvector([a,b])\u001b[38;5;241m-\u001b[39mvector([\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m3\u001b[39m,\u001b[38;5;241m5\u001b[39m])\n",
|
||||
"\u001b[1;31mNameError\u001b[0m: name 'matrix' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"zbior=[(1,1),(2,3),(4,5)]\n",
|
||||
"print('zbior punktów = ', zbior)\n",
|
||||
"m=matrix(3,2,[1,exp(1.0),1,exp(2.0),1,exp(4.0)])\n",
|
||||
"\n",
|
||||
"a,b,t=var('a,b,t')\n",
|
||||
"\n",
|
||||
"m*vector([a,b])-vector([1,3,5])\n",
|
||||
"\n",
|
||||
"print('\\n (m^T * m)^-1 * m^T * vector =')\n",
|
||||
"z = (m.transpose()*m)^(-1)*m.transpose()*vector([1,3,5])\n",
|
||||
"print(z)\n",
|
||||
"\n",
|
||||
"plot(z[0] +z[1]*exp(t),(t,0,4))+sum([point(x) for x in zbior])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Zadanie 4.9"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h3> Zadanie 9 </h3>\n",
|
||||
"\n",
|
||||
"Znajdź bazę ortonormalnych wektorów własnych dla macierzy\n",
|
||||
"\n",
|
||||
"$$\\left(\\begin{array}{rrr}\n",
|
||||
"1 & 1 & 0 \\\\\n",
|
||||
"1 & 2 & 2 \\\\\n",
|
||||
"0 & 2 & 3\n",
|
||||
"\\end{array}\\right)$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'matrix' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[3], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m m\u001b[38;5;241m=\u001b[39m\u001b[43mmatrix\u001b[49m(\u001b[38;5;241m3\u001b[39m,\u001b[38;5;241m3\u001b[39m,[\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m0\u001b[39m,\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m2\u001b[39m,\u001b[38;5;241m2\u001b[39m,\u001b[38;5;241m0\u001b[39m,\u001b[38;5;241m2\u001b[39m,\u001b[38;5;241m3\u001b[39m])\n\u001b[0;32m 3\u001b[0m \u001b[38;5;66;03m#wartosci wlasne\u001b[39;00m\n\u001b[0;32m 4\u001b[0m eigenvalues \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mm\u001b[38;5;241m.\u001b[39meigvals(matrix)\n",
|
||||
"\u001b[1;31mNameError\u001b[0m: name 'matrix' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"m=matrix(3,3,[1,1,0,1,2,2,0,2,3])\n",
|
||||
"\n",
|
||||
"#wartosci wlasne\n",
|
||||
"eigenvalues = np.m.eigvals(matrix)\n",
|
||||
"\n",
|
||||
"eigen=m.right_eigenvectors()\n",
|
||||
"e1=eigen[0][1][0]\n",
|
||||
"e2=eigen[1][1][0]\n",
|
||||
"print(e1.dot_product(e2))\n",
|
||||
"e3=eigen[2][1][0]\n",
|
||||
"print(e3.dot_product(e1))\n",
|
||||
"print(e2.dot_product(e3))\n",
|
||||
"\n",
|
||||
"#znormalizuj wektor wlasny\n",
|
||||
"\n",
|
||||
"#czy wektory wlasne sa ortogonalne?\n",
|
||||
"\n",
|
||||
"#postac ortonormalna i normalizacja"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.10.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
@ -7,11 +7,6 @@
|
||||
"Zadanie 4.6"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
@ -19,13 +14,13 @@
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'QQ' is not defined",
|
||||
"evalue": "name 'matrix' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[1], line 5\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39msympy\u001b[39;00m \u001b[39mimport\u001b[39;00m symbols, Matrix\n\u001b[0;32m 3\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mnumpy\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mlinalg\u001b[39;00m \u001b[39mimport\u001b[39;00m eig\n\u001b[1;32m----> 5\u001b[0m A\u001b[39m=\u001b[39mnp\u001b[39m.\u001b[39mmatrix(QQ,\u001b[39m5\u001b[39m,\u001b[39m3\u001b[39m,[\u001b[39m2\u001b[39m, \u001b[39m4\u001b[39m, \u001b[39m6\u001b[39m, \u001b[39m8\u001b[39m, \u001b[39m10\u001b[39m, \u001b[39m12\u001b[39m, \u001b[39m14\u001b[39m, \u001b[39m16\u001b[39m, \u001b[39m18\u001b[39m, \u001b[39m20\u001b[39m, \u001b[39m22\u001b[39m, \u001b[39m24\u001b[39m, \u001b[39m26\u001b[39m, \u001b[39m28\u001b[39m, \u001b[39m31\u001b[39m])\n\u001b[0;32m 6\u001b[0m \u001b[39mprint\u001b[39m(A\u001b[39m.\u001b[39mtranspose()\u001b[39m*\u001b[39mA)\n\u001b[0;32m 7\u001b[0m \u001b[39mprint\u001b[39m((A\u001b[39m.\u001b[39mtranspose()\u001b[39m*\u001b[39mA)\u001b[39m^\u001b[39m(\u001b[39m-\u001b[39m\u001b[39m1\u001b[39m))\n",
|
||||
"\u001b[1;31mNameError\u001b[0m: name 'QQ' is not defined"
|
||||
"Cell \u001b[1;32mIn[1], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m A\u001b[38;5;241m=\u001b[39m\u001b[43mmatrix\u001b[49m(QQ,\u001b[38;5;241m5\u001b[39m,\u001b[38;5;241m3\u001b[39m,[\u001b[38;5;241m2\u001b[39m, \u001b[38;5;241m4\u001b[39m, \u001b[38;5;241m6\u001b[39m, \u001b[38;5;241m8\u001b[39m, \u001b[38;5;241m10\u001b[39m, \u001b[38;5;241m12\u001b[39m, \u001b[38;5;241m14\u001b[39m, \u001b[38;5;241m16\u001b[39m, \u001b[38;5;241m18\u001b[39m, \u001b[38;5;241m20\u001b[39m, \u001b[38;5;241m22\u001b[39m, \u001b[38;5;241m24\u001b[39m, \u001b[38;5;241m26\u001b[39m, \u001b[38;5;241m28\u001b[39m, \u001b[38;5;241m31\u001b[39m])\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mA =\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(A, \u001b[38;5;124m'\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n",
|
||||
"\u001b[1;31mNameError\u001b[0m: name 'matrix' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -51,6 +46,25 @@
|
||||
"print(b - A * u, '\\n')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h3> Zadanie 6 </h3>\n",
|
||||
"\n",
|
||||
"Rozwiąż układ równań $Ax=b$ metodą przybliżoną, gdzie\n",
|
||||
"\n",
|
||||
"$$A=\\left(\\begin{array}{rrr}\n",
|
||||
"2 & 4 & 6 \\\\\n",
|
||||
"8 & 10 & 12 \\\\\n",
|
||||
"14 & 16 & 18 \\\\\n",
|
||||
"20 & 22 & 24 \\\\\n",
|
||||
"26 & 28 & 31\n",
|
||||
"\\end{array}\\right)$$\n",
|
||||
"\n",
|
||||
"oraz $b=(-1,0,1,0,1)$."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
@ -59,10 +73,38 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"<h3> Zadanie 7</h3>\n",
|
||||
"\n",
|
||||
"Przybliż funkcją $f(t)=a+be^{t}$ zbiór punktów $(1,1)$, $(2,3)$, $(4,5)$ metodą z zadania 6.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"zbior punktów = [(1, 1), (2, 3), (4, 5)]\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'matrix' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[2], line 3\u001b[0m\n\u001b[0;32m 1\u001b[0m zbior\u001b[38;5;241m=\u001b[39m[(\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m1\u001b[39m),(\u001b[38;5;241m2\u001b[39m,\u001b[38;5;241m3\u001b[39m),(\u001b[38;5;241m4\u001b[39m,\u001b[38;5;241m5\u001b[39m)]\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mzbior punktów = \u001b[39m\u001b[38;5;124m'\u001b[39m, zbior)\n\u001b[1;32m----> 3\u001b[0m m\u001b[38;5;241m=\u001b[39m\u001b[43mmatrix\u001b[49m(\u001b[38;5;241m3\u001b[39m,\u001b[38;5;241m2\u001b[39m,[\u001b[38;5;241m1\u001b[39m,exp(\u001b[38;5;241m1.0\u001b[39m),\u001b[38;5;241m1\u001b[39m,exp(\u001b[38;5;241m2.0\u001b[39m),\u001b[38;5;241m1\u001b[39m,exp(\u001b[38;5;241m4.0\u001b[39m)])\n\u001b[0;32m 5\u001b[0m a,b,t\u001b[38;5;241m=\u001b[39mvar(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ma,b,t\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 7\u001b[0m m\u001b[38;5;241m*\u001b[39mvector([a,b])\u001b[38;5;241m-\u001b[39mvector([\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m3\u001b[39m,\u001b[38;5;241m5\u001b[39m])\n",
|
||||
"\u001b[1;31mNameError\u001b[0m: name 'matrix' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"zbior=[(1,1),(2,3),(4,5)]\n",
|
||||
"print('zbior punktów = ', zbior)\n",
|
||||
@ -87,13 +129,41 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"<h3> Zadanie 9 </h3>\n",
|
||||
"\n",
|
||||
"Znajdź bazę ortonormalnych wektorów własnych dla macierzy\n",
|
||||
"\n",
|
||||
"$$\\left(\\begin{array}{rrr}\n",
|
||||
"1 & 1 & 0 \\\\\n",
|
||||
"1 & 2 & 2 \\\\\n",
|
||||
"0 & 2 & 3\n",
|
||||
"\\end{array}\\right)$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'matrix' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[3], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m m\u001b[38;5;241m=\u001b[39m\u001b[43mmatrix\u001b[49m(\u001b[38;5;241m3\u001b[39m,\u001b[38;5;241m3\u001b[39m,[\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m0\u001b[39m,\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m2\u001b[39m,\u001b[38;5;241m2\u001b[39m,\u001b[38;5;241m0\u001b[39m,\u001b[38;5;241m2\u001b[39m,\u001b[38;5;241m3\u001b[39m])\n\u001b[0;32m 3\u001b[0m \u001b[38;5;66;03m#wartosci wlasne\u001b[39;00m\n\u001b[0;32m 4\u001b[0m eigenvalues \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mm\u001b[38;5;241m.\u001b[39meigvals(matrix)\n",
|
||||
"\u001b[1;31mNameError\u001b[0m: name 'matrix' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"m=matrix(3,3,[1,1,0,1,2,2,0,2,3])\n",
|
||||
"\n",
|
||||
"#wartosci wlasne\n",
|
||||
"eigenvalues = np.m.eigvals(matrix)\n",
|
||||
"\n",
|
||||
"eigen=m.right_eigenvectors()\n",
|
||||
@ -102,8 +172,21 @@
|
||||
"print(e1.dot_product(e2))\n",
|
||||
"e3=eigen[2][1][0]\n",
|
||||
"print(e3.dot_product(e1))\n",
|
||||
"print(e2.dot_product(e3))"
|
||||
"print(e2.dot_product(e3))\n",
|
||||
"\n",
|
||||
"#znormalizuj wektor wlasny\n",
|
||||
"\n",
|
||||
"#czy wektory wlasne sa ortogonalne?\n",
|
||||
"\n",
|
||||
"#postac ortonormalna i normalizacja"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
@ -122,7 +205,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.11"
|
||||
"version": "3.10.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
Loading…
Reference in New Issue
Block a user