This commit is contained in:
s487174 2023-06-16 06:15:55 +02:00
parent f7e35d41c5
commit 285c64a655

View File

@ -30,7 +30,7 @@
},
{
"cell_type": "code",
"execution_count": 126,
"execution_count": 148,
"metadata": {},
"outputs": [
{
@ -130,7 +130,7 @@
},
{
"cell_type": "code",
"execution_count": 127,
"execution_count": 149,
"metadata": {},
"outputs": [
{
@ -170,19 +170,18 @@
},
{
"cell_type": "code",
"execution_count": 128,
"execution_count": 152,
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "'module' object is not callable",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[128], line 9\u001b[0m\n\u001b[0;32m 5\u001b[0m m1\u001b[39m=\u001b[39mnp\u001b[39m.\u001b[39marray([[\u001b[39m1\u001b[39m,np\u001b[39m.\u001b[39mexp(\u001b[39m1.0\u001b[39m)],[\u001b[39m1\u001b[39m,np\u001b[39m.\u001b[39mexp(\u001b[39m2.0\u001b[39m)],[\u001b[39m1\u001b[39m,np\u001b[39m.\u001b[39mexp(\u001b[39m4.0\u001b[39m)]])\n\u001b[0;32m 7\u001b[0m \u001b[39m#a,b,t=var('a,b,t')\u001b[39;00m\n\u001b[1;32m----> 9\u001b[0m m1\u001b[39m*\u001b[39mvector([a,b])\u001b[39m-\u001b[39mvector([\u001b[39m1\u001b[39m,\u001b[39m3\u001b[39m,\u001b[39m5\u001b[39m])\n\u001b[0;32m 11\u001b[0m M1\u001b[39m=\u001b[39mm1\u001b[39m.\u001b[39mtranspose()\u001b[39m*\u001b[39mm1\n\u001b[0;32m 12\u001b[0m M1\u001b[39m.\u001b[39mdet()\n",
"\u001b[1;31mTypeError\u001b[0m: 'module' object is not callable"
]
"data": {
"text/plain": [
"'\"\\nm1*vector([a,b])-vector([1,3,5])\\n\\nM1=m1.transpose()*m1\\nM1.det()\\n\\nM1^(-1)*m1.transpose()*vector([1,3,5])\\n\\n##########################################################\\n\\ndef func(t, a, b):\\n return a + b * np.exp(t)\\n\\nx = np.linalg.inv(m.transpose() @ m) @ m.transpose() @ b\\n\\nzbior=[(1,1),(2,3),(4,5)]\\nprint(\\'zbior punktów = \\', zbior)\\nm=matrix(3,2,[1,exp(1.0),1,exp(2.0),1,exp(4.0)])\\n\\na,b,t=var(\\'a,b,t\\')\\n\\nm*vector([a,b])-vector([1,3,5])\\n\\nprint(\\'\\n (m^T * m)^-1 * m^T * vector =\\')\\nz = (m.transpose()*m)^(-1)*m.transpose()*vector([1,3,5])\\nprint(z)\\n\\nplot(z[0] +z[1]*exp(t),(t,0,4))+sum([point(x) for x in zbior])\\n\\n'"
]
},
"execution_count": 152,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
@ -193,7 +192,7 @@
"m1=np.array([[1,np.exp(1.0)],[1,np.exp(2.0)],[1,np.exp(4.0)]])\n",
"\n",
"#a,b,t=var('a,b,t')\n",
"\n",
"\"\"\"\"\n",
"m1*vector([a,b])-vector([1,3,5])\n",
"\n",
"M1=m1.transpose()*m1\n",
@ -220,7 +219,9 @@
"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])"
"plot(z[0] +z[1]*exp(t),(t,0,4))+sum([point(x) for x in zbior])\n",
"\n",
"\"\"\""
]
},
{
@ -334,7 +335,7 @@
},
{
"cell_type": "code",
"execution_count": 146,
"execution_count": null,
"metadata": {},
"outputs": [
{