very experimental example breaking

This commit is contained in:
lda committed 2025-02-02 01:59:39 +07:00
1 parent 26a74b4f94
commit 22f3d9c762
2 files changed
+24 -15

No files matched your search

+16 -15
View File
@@ -36,7 +36,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
@@ -53,7 +53,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
@@ -70,7 +70,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 15,
"metadata": {},
"outputs": [
{
@@ -82,7 +82,7 @@
"x**3 - x - 2"
]
},
"execution_count": 3,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
@@ -112,7 +112,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 16,
"metadata": {},
"outputs": [
{
@@ -124,7 +124,7 @@
"(1 + sqrt(3))/2"
]
},
"execution_count": 4,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
@@ -157,7 +157,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 17,
"metadata": {},
"outputs": [
{
@@ -192,7 +192,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
@@ -208,7 +208,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 19,
"metadata": {},
"outputs": [
{
@@ -217,7 +217,7 @@
"np.float64(1.5213797068045676)"
]
},
"execution_count": 7,
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
@@ -258,7 +258,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
@@ -286,9 +286,9 @@
" return (low, 0)\n",
" elif ldaprx(0, fh):\n",
" return (high, 0)\n",
"\n",
" while (steps := steps + 1) and (max_loop := max_loop - 1) + 1:\n",
" else:\n",
" mid = (low + high) / 2\n",
" while (steps := steps + 1) and (max_loop := max_loop - 1) + 1 > 0:\n",
" match f(mid):\n",
" case x if ldaprx(0, x):\n",
" return (mid, steps)\n",
@@ -296,12 +296,13 @@
" low = mid\n",
" case x if x > 0:\n",
" high = mid\n",
" mid = (low + high) / 2\n",
" return (mid, steps)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 21,
"metadata": {},
"outputs": [
{
@@ -310,7 +311,7 @@
"(1.5213797068045676, 52)"
]
},
"execution_count": 9,
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}