Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hatwagner F. Miklós committed Nov 7, 2023
1 parent 1d7afd0 commit e62b9be
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions Prg_alapjai,_6_előadás.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
"id": "zxWemmTeqoAv",
"outputId": "e996a2be-37b5-4bea-ffff-1c95e9295b3a"
},
"execution_count": 1,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
Expand Down Expand Up @@ -388,7 +388,7 @@
"id": "LwzHW3ecrBdK",
"outputId": "691b6b85-495f-4714-b040-f8e892a027d1"
},
"execution_count": 6,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
Expand Down Expand Up @@ -440,7 +440,7 @@
"id": "sI-KKIuytmje",
"outputId": "d85646fe-12e2-4e4e-c806-cf0cfa8a876c"
},
"execution_count": 5,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
Expand Down Expand Up @@ -1096,7 +1096,7 @@
"id": "RmvV8VWV5wvC",
"outputId": "4e7cc662-d1d0-4479-d3c8-d49af6e60ed1"
},
"execution_count": 10,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
Expand Down Expand Up @@ -1133,7 +1133,7 @@
"id": "-XOTMM-46Fme",
"outputId": "dd862664-8dd8-4c30-cb60-8731878e0267"
},
"execution_count": 12,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
Expand Down Expand Up @@ -1172,7 +1172,7 @@
"id": "q9WQVMJ76StK",
"outputId": "40db7bec-1344-433e-a29f-9a3df03da8fb"
},
"execution_count": 13,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
Expand Down Expand Up @@ -1212,7 +1212,7 @@
},
"outputId": "abe9b640-4029-46b1-86b8-0e7c6b60642b"
},
"execution_count": 7,
"execution_count": null,
"outputs": [
{
"output_type": "error",
Expand Down Expand Up @@ -1256,7 +1256,7 @@
},
"outputId": "7cc2a0d3-1ddc-4c60-e4b0-250528561b99"
},
"execution_count": 14,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
Expand Down Expand Up @@ -1451,7 +1451,7 @@
"id": "D19XS3D68U3i",
"outputId": "79e49b5a-ac29-4179-aa6d-8a937406c37b"
},
"execution_count": 19,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
Expand Down Expand Up @@ -1909,7 +1909,7 @@
"\n",
"# https://docs.python.org/3/library/typing.html#callable\n",
"def integralKozelites(f: Callable[[float], float], a: float, b: float) -> float:\n",
" EPS = 1e-6\n",
" EPS = 1e-9\n",
" if a > b:\n",
" a, b = b, a\n",
" y0 = f(a)\n",
Expand All @@ -1928,22 +1928,22 @@
" break\n",
" return terulet\n",
"\n",
"print(f\"{integralKozelites(f, 0, 1):.6f}\")"
"print(f\"{integralKozelites(f, 0, 1):.9f}\")"
],
"metadata": {
"id": "pG2vMEoY-rU2",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "c9e6ac4f-1155-497f-b0df-21cd352acf38"
"outputId": "40001147-7c49-43cc-8532-9db7ddc9c995"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"0.333333\n"
"0.333333333\n"
]
}
]
Expand Down Expand Up @@ -1988,15 +1988,15 @@
"\n",
"def my_cos(x: float) -> float:\n",
" szamlalo = 1\n",
" k = 0\n",
" kitevo = 0\n",
" nevezo = 1\n",
" elojel = 1\n",
" tag = 1\n",
" osszeg = tag\n",
" while(abs(tag) > EPSZILON):\n",
" szamlalo *= x*x\n",
" k += 2\n",
" nevezo *= (k-1)*k\n",
" kitevo += 2\n",
" nevezo *= (kitevo-1)*kitevo\n",
" elojel *= -1\n",
" tag = elojel * szamlalo / nevezo\n",
" osszeg += tag\n",
Expand All @@ -2010,7 +2010,7 @@
"def Erinto(Fx: Callable[[float], float], dFx: Callable[[float], float], x0: float) -> float:\n",
" x1 = x0 - Fx(x0)/dFx(x0)\n",
" while abs(x1-x0) > EPSZILON:\n",
" x0, x1 = x1, x1 - Fx(x0)/dFx(x0)\n",
" x0, x1 = x1, x1 - Fx(x1)/dFx(x1)\n",
" return x1\n",
"\n",
"print(f'\\N{Greek Small Letter Pi} \\N{Almost Equal To} {Erinto(Fx, dFx, 4.)} vs. {math.pi}')"
Expand All @@ -2020,15 +2020,15 @@
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "c6660736-afff-4f9e-a66b-d52b034713e9"
"outputId": "1080c473-b84e-471a-9af9-7bf347000c67"
},
"execution_count": null,
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"π ≈ 3.1415891134038008 vs. 3.141592653589793\n"
"π ≈ 3.1415934169317814 vs. 3.141592653589793\n"
]
}
]
Expand Down

0 comments on commit e62b9be

Please sign in to comment.