summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Guschin <guschin.drew@gmail.com>2024-03-04 10:53:39 +0400
committerAndrew Guschin <guschin.drew@gmail.com>2024-03-04 10:53:39 +0400
commit1fd0d369b8c1725165bfdadceaf8883140c0a481 (patch)
tree0ee2b054c7061cd7c7fed36f708e5e9ad96856fb
parent1e100a68997d49a9493e6456c03f6c0b726465c8 (diff)
-rw-r--r--t4mk.ipynb317
1 files changed, 96 insertions, 221 deletions
diff --git a/t4mk.ipynb b/t4mk.ipynb
index 371df03..578cad8 100644
--- a/t4mk.ipynb
+++ b/t4mk.ipynb
@@ -11,13 +11,13 @@
},
{
"cell_type": "code",
- "execution_count": 42,
+ "execution_count": 188,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
- "$\\displaystyle \\Large\\frac{157}{225}$"
+ "$\\displaystyle \\Large\\frac{125}{279}$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -29,7 +29,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle 0 + \\Large\\frac{1}{\\Large\\frac{225}{157}}$"
+ "$\\displaystyle 0 + \\Large\\frac{1}{\\Large\\frac{279}{125}}$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -41,7 +41,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle 0 + \\Large\\frac{1}{1 + \\Large\\frac{1}{\\Large\\frac{157}{68}}}$"
+ "$\\displaystyle 0 + \\Large\\frac{1}{2 + \\Large\\frac{1}{\\Large\\frac{125}{29}}}$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -53,7 +53,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle 0 + \\Large\\frac{1}{1 + \\Large\\frac{1}{2 + \\Large\\frac{1}{\\Large\\frac{68}{21}}}}$"
+ "$\\displaystyle 0 + \\Large\\frac{1}{2 + \\Large\\frac{1}{4 + \\Large\\frac{1}{\\Large\\frac{29}{9}}}}$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -65,7 +65,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle 0 + \\Large\\frac{1}{1 + \\Large\\frac{1}{2 + \\Large\\frac{1}{3 + \\Large\\frac{1}{\\Large\\frac{21}{5}}}}}$"
+ "$\\displaystyle 0 + \\Large\\frac{1}{2 + \\Large\\frac{1}{4 + \\Large\\frac{1}{3 + \\Large\\frac{1}{\\Large\\frac{9}{2}}}}}$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -77,7 +77,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle 0 + \\Large\\frac{1}{1 + \\Large\\frac{1}{2 + \\Large\\frac{1}{3 + \\Large\\frac{1}{4 + \\Large\\frac{1}{5}}}}}$"
+ "$\\displaystyle 0 + \\Large\\frac{1}{2 + \\Large\\frac{1}{4 + \\Large\\frac{1}{3 + \\Large\\frac{1}{4 + \\Large\\frac{1}{2}}}}}$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -91,9 +91,9 @@
"text/latex": [
"$\\displaystyle \\begin{array}{ccccccccc}\n",
"i & -1 & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\\\\n",
- "q_i & & & 0 & 1 & 2 & 3 & 4 & 5 \\\\\n",
- "P_i & 0 & 1 & 0 & 1 & 2 & 7 & 30 & 157 \\\\\n",
- "Q_i & 1 & 0 & 1 & 1 & 3 & 10 & 43 & 225 \\\\\n",
+ "q_i & & & 0 & 2 & 4 & 3 & 4 & 2 \\\\\n",
+ "P_i & 0 & 1 & 0 & 1 & 4 & 13 & 56 & 125 \\\\\n",
+ "Q_i & 1 & 0 & 1 & 2 & 9 & 29 & 125 & 279 \\\\\n",
"\\end{array}$"
],
"text/plain": [
@@ -105,7 +105,7 @@
}
],
"source": [
- "frac = (157, 225)\n",
+ "frac = (125, 279)\n",
"\n",
"from IPython.display import display, Math\n",
"\n",
@@ -221,7 +221,7 @@
},
{
"cell_type": "code",
- "execution_count": 187,
+ "execution_count": 189,
"metadata": {},
"outputs": [
{
@@ -314,7 +314,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle \\left(\\frac{1016}{2945}\\right) = $"
+ "$\\displaystyle \\left(\\frac{1080}{2945}\\right) = $"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -326,7 +326,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle = (1) \\cdot \\left(\\frac{1016}{2945}\\right) = (1) \\cdot \\left(\\frac{2^3}{2945}\\right) \\cdot \\left(\\frac{127}{2945}\\right) = \\text{[по св. 6]} = (1) \\cdot \\left(\\frac{127}{2945}\\right) =\\text{[по св. 7 Гаусса]} = (1) \\cdot \\left(\\frac{2945}{127}\\right) \\cdot (-1)^{\\frac{2945 - 1}{2} \\cdot \\frac{127 - 1}{2}} =(1) \\cdot \\left(\\frac{2945}{127}\\right) = \\text{[по св. 1]} = (1) \\cdot \\left(\\frac{24}{127}\\right) = $"
+ "$\\displaystyle = (1) \\cdot \\left(\\frac{1080}{2945}\\right) = (1) \\cdot \\left(\\frac{2^3}{2945}\\right) \\cdot \\left(\\frac{135}{2945}\\right) = \\text{[по св. 6]} = (1) \\cdot \\left(\\frac{135}{2945}\\right) =\\text{[по св. 7 Гаусса]} = (1) \\cdot \\left(\\frac{2945}{135}\\right) \\cdot (-1)^{\\frac{2945 - 1}{2} \\cdot \\frac{135 - 1}{2}} =(1) \\cdot \\left(\\frac{2945}{135}\\right) = \\text{[по св. 1]} = (1) \\cdot \\left(\\frac{110}{135}\\right) = $"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -338,7 +338,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle = (1) \\cdot \\left(\\frac{24}{127}\\right) = (1) \\cdot \\left(\\frac{2^3}{127}\\right) \\cdot \\left(\\frac{3}{127}\\right) = \\text{[по св. 6]} = (1) \\cdot \\left(\\frac{3}{127}\\right) =\\text{[по св. 7 Гаусса]} = (1) \\cdot \\left(\\frac{127}{3}\\right) \\cdot (-1)^{\\frac{127 - 1}{2} \\cdot \\frac{3 - 1}{2}} =(-1) \\cdot \\left(\\frac{127}{3}\\right) = \\text{[по св. 1]} = (-1) \\cdot \\left(\\frac{1}{3}\\right) = $"
+ "$\\displaystyle = (1) \\cdot \\left(\\frac{110}{135}\\right) = (1) \\cdot \\left(\\frac{2^1}{135}\\right) \\cdot \\left(\\frac{55}{135}\\right) = \\text{[по св. 6]} = (1) \\cdot \\left(\\frac{55}{135}\\right) =\\text{[по св. 7 Гаусса]} = (1) \\cdot \\left(\\frac{135}{55}\\right) \\cdot (-1)^{\\frac{135 - 1}{2} \\cdot \\frac{55 - 1}{2}} =(-1) \\cdot \\left(\\frac{135}{55}\\right) = \\text{[по св. 1]} = (-1) \\cdot \\left(\\frac{25}{55}\\right) = $"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -350,7 +350,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle = (-1) \\cdot \\left(\\frac{1}{3}\\right) = \\text{[по св. 7 Гаусса]} = (-1) \\cdot \\left(\\frac{3}{1}\\right) \\cdot (-1)^{\\frac{3 - 1}{2} \\cdot \\frac{1 - 1}{2}} =(-1) \\cdot \\left(\\frac{3}{1}\\right) = \\text{[по св. 1]} = (-1) \\cdot \\left(\\frac{0}{1}\\right) = $"
+ "$\\displaystyle = (-1) \\cdot \\left(\\frac{25}{55}\\right) = \\text{[по св. 7 Гаусса]} = (-1) \\cdot \\left(\\frac{55}{25}\\right) \\cdot (-1)^{\\frac{55 - 1}{2} \\cdot \\frac{25 - 1}{2}} =(-1) \\cdot \\left(\\frac{55}{25}\\right) = \\text{[по св. 1]} = (-1) \\cdot \\left(\\frac{5}{25}\\right) = $"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -362,7 +362,19 @@
{
"data": {
"text/latex": [
- "$\\displaystyle = -1$"
+ "$\\displaystyle = (-1) \\cdot \\left(\\frac{5}{25}\\right) = \\text{[по св. 7 Гаусса]} = (-1) \\cdot \\left(\\frac{25}{5}\\right) \\cdot (-1)^{\\frac{25 - 1}{2} \\cdot \\frac{5 - 1}{2}} =(-1) \\cdot \\left(\\frac{25}{5}\\right) = \\text{[по св. 1]} = (-1) \\cdot \\left(\\frac{0}{5}\\right) = $"
+ ],
+ "text/plain": [
+ "<IPython.core.display.Math object>"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/latex": [
+ "$\\displaystyle = 0$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -373,7 +385,7 @@
}
],
"source": [
- "a, n = 1016, 2945\n",
+ "a, n = 1080, 2945\n",
"\n",
"def jacobi(a, n):\n",
" ans = 1\n",
@@ -443,13 +455,13 @@
},
{
"cell_type": "code",
- "execution_count": 85,
+ "execution_count": 197,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
- "$\\displaystyle M = 4 \\cdot 9 = 36$"
+ "$\\displaystyle M = 9 \\cdot 2 = 18$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -461,7 +473,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle M_{1} = 9; 9 x \\equiv 3 \\pmod{4}; z_{1} = 3$"
+ "$\\displaystyle M_{1} = 2; 2 x \\equiv 8 \\pmod{9}; z_{1} = 4$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -473,7 +485,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle M_{2} = 4; 4 x \\equiv 6 \\pmod{9}; z_{2} = 6$"
+ "$\\displaystyle M_{2} = 9; 9 x \\equiv 1 \\pmod{2}; z_{2} = 1$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -485,7 +497,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle x = M_{1} \\cdot z_{1} + M_{2} \\cdot z_{2} = 9 \\cdot 3 + 4 \\cdot 6 = 15 \\pmod{36}$"
+ "$\\displaystyle x = M_{1} \\cdot z_{1} + M_{2} \\cdot z_{2} = 2 \\cdot 4 + 9 \\cdot 1 = 17 \\pmod{18}$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -496,7 +508,7 @@
}
],
"source": [
- "ai, mi = [1, 3, 2], [3, 5, 4]\n",
+ "ai, mi = [8, 1], [9, 2]\n",
"\n",
"def gcd_extended(x1, x2):\n",
" if x1 == 0:\n",
@@ -552,7 +564,7 @@
},
{
"cell_type": "code",
- "execution_count": 63,
+ "execution_count": 191,
"metadata": {},
"outputs": [
{
@@ -570,7 +582,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle a^1 \\pmod{37} = 3^1 \\pmod{37} = 3$"
+ "$\\displaystyle a^1 \\pmod{37} = 4^1 \\pmod{37} = 4$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -582,7 +594,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle a^2 \\pmod{37} = 3^2 \\pmod{37} = 9$"
+ "$\\displaystyle a^2 \\pmod{37} = 4^2 \\pmod{37} = 16$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -594,7 +606,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle a^3 \\pmod{37} = 3^3 \\pmod{37} = 27$"
+ "$\\displaystyle a^3 \\pmod{37} = 4^3 \\pmod{37} = 27$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -606,7 +618,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle a^4 \\pmod{37} = 3^4 \\pmod{37} = 7$"
+ "$\\displaystyle a^4 \\pmod{37} = 4^4 \\pmod{37} = 34$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -618,7 +630,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle a^5 \\pmod{37} = 3^5 \\pmod{37} = 21$"
+ "$\\displaystyle a^5 \\pmod{37} = 4^5 \\pmod{37} = 25$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -630,7 +642,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle a^6 \\pmod{37} = 3^6 \\pmod{37} = 26$"
+ "$\\displaystyle a^6 \\pmod{37} = 4^6 \\pmod{37} = 26$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -654,7 +666,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle (1, 3), (4, 7), (2, 9), (5, 21), (6, 26), (3, 27)$"
+ "$\\displaystyle (1, 4), (2, 16), (5, 25), (6, 26), (3, 27), (4, 34)$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -666,7 +678,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle a^{-r} = 3^{-7} = (3^7)^{-1} = 4^{-1} = 28 \\pmod{p}$"
+ "$\\displaystyle a^{-r} = 4^{-7} = (4^7)^{-1} = 30^{-1} = 21 \\pmod{p}$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -690,7 +702,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle a_1^{1} \\cdot 1 \\pmod{37} = 28$"
+ "$\\displaystyle a_1^{1} \\cdot 1 \\pmod{37} = 21$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -702,7 +714,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle a_1^{2} \\cdot 1 \\pmod{37} = 7$"
+ "$\\displaystyle a_1^{2} \\cdot 1 \\pmod{37} = 34$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -714,7 +726,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle \\text{Значение } a^{-r} \\cdot b \\text{ совпало с вторым значением пары } (4, 7)$"
+ "$\\displaystyle \\text{Значение } a^{-r} \\cdot b \\text{ совпало со вторым значением пары } (4, 34)$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -737,7 +749,7 @@
}
],
"source": [
- "a, p = 3, 37\n",
+ "a, p = 4, 37\n",
"\n",
"from math import sqrt\n",
"\n",
@@ -815,7 +827,7 @@
},
{
"cell_type": "code",
- "execution_count": 157,
+ "execution_count": 195,
"metadata": {},
"outputs": [
{
@@ -833,14 +845,10 @@
"x & x^2 & x^3 + 1 \\cdot x + 1 & y \\\\\n",
"0 & 0 & 1 & \\\\\n",
"1 & 1 & 3 & \\\\\n",
- "2 & 4 & 0 & \\\\\n",
- "3 & -2 & -2 & \\\\\n",
- "4 & 5 & 3 & \\\\\n",
- "5 & 3 & -1 & \\\\\n",
- "-5 & 3 & 3 & \\\\\n",
- "-4 & 5 & -1 & \\\\\n",
- "-3 & -2 & 4 & \\\\\n",
- "-2 & 4 & 2 & \\\\\n",
+ "2 & -3 & -3 & \\\\\n",
+ "3 & 2 & 3 & \\\\\n",
+ "-3 & 2 & -1 & \\\\\n",
+ "-2 & -3 & -2 & \\\\\n",
"-1 & 1 & -1 & \\\\\n",
"\\end{array}$"
],
@@ -855,21 +863,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "Порядок: 14\n",
+ "Порядок: 5\n",
"Точки:\n",
"(0, 1)\n",
"(0, -1)\n",
- "(1, 5)\n",
- "(1, -5)\n",
- "(2, 0)\n",
- "(3, 3)\n",
- "(3, -3)\n",
- "(4, 5)\n",
- "(4, -5)\n",
- "(-3, 2)\n",
- "(-3, -2)\n",
- "(-5, 5)\n",
- "(-5, -5)\n",
+ "(2, 2)\n",
+ "(2, -2)\n",
"None\n",
"Проверяем точку (0, -1)\n"
]
@@ -889,151 +888,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle \\lambda = \\frac{3 \\cdot x_1^2 + a}{2 \\cdot y_1} = \\frac{3 \\cdot 0^2 + 1}{2 \\cdot 10} = \\frac{3 \\cdot 0 + 1}{20} = \\frac{1}{20}$"
- ],
- "text/plain": [
- "<IPython.core.display.Math object>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/latex": [
- "$\\displaystyle \\lambda = 1 \\cdot 20^{-1} = 1 \\cdot 5 = 5 \\pmod{11} = 5$"
- ],
- "text/plain": [
- "<IPython.core.display.Math object>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/latex": [
- "$\\displaystyle x_3 = \\lambda^2 - x_1 - x_2 = 5^2 - 0 - 0 = 25 - 0 - 0 = 25 \\pmod{11} = 3 = 3$"
- ],
- "text/plain": [
- "<IPython.core.display.Math object>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/latex": [
- "$\\displaystyle y_3 = \\lambda \\cdot (x_1 - x_3) - y_1 = 5 \\cdot (0 - 3) - 10 = 5 \\cdot -3 - 10 = -15 - 10 = -25 \\pmod{11} = 8 = -3$"
- ],
- "text/plain": [
- "<IPython.core.display.Math object>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/latex": [
- "$\\displaystyle 2P = P + P = (0, -1) + (0, -1) = (3, -3)$"
- ],
- "text/plain": [
- "<IPython.core.display.Math object>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/latex": [
- "$\\displaystyle $"
- ],
- "text/plain": [
- "<IPython.core.display.Math object>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/latex": [
- "$\\displaystyle \\lambda = \\frac{y_2 - y_1}{x_2 - x_1} = \\frac{10 - 8}{0 - 3} = \\frac{2}{-3}$"
- ],
- "text/plain": [
- "<IPython.core.display.Math object>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/latex": [
- "$\\displaystyle \\lambda = 2 \\cdot -3^{-1} = 2 \\cdot 7 = 14 \\pmod{11} = 3$"
- ],
- "text/plain": [
- "<IPython.core.display.Math object>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/latex": [
- "$\\displaystyle x_3 = \\lambda^2 - x_1 - x_2 = 3^2 - 3 - 0 = 9 - 3 - 0 = 6 \\pmod{11} = 6 = -5$"
- ],
- "text/plain": [
- "<IPython.core.display.Math object>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/latex": [
- "$\\displaystyle y_3 = \\lambda \\cdot (x_1 - x_3) - y_1 = 3 \\cdot (3 - 6) - 8 = 3 \\cdot -3 - 8 = -9 - 8 = -17 \\pmod{11} = 5 = 5$"
- ],
- "text/plain": [
- "<IPython.core.display.Math object>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/latex": [
- "$\\displaystyle 3P = 2P + P = (3, -3) + (0, -1) = (-5, 5)$"
- ],
- "text/plain": [
- "<IPython.core.display.Math object>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/latex": [
- "$\\displaystyle $"
- ],
- "text/plain": [
- "<IPython.core.display.Math object>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/latex": [
- "$\\displaystyle \\lambda = \\frac{y_2 - y_1}{x_2 - x_1} = \\frac{10 - 5}{0 - 6} = \\frac{5}{-6}$"
+ "$\\displaystyle \\lambda = \\frac{3 \\cdot x_1^2 + a}{2 \\cdot y_1} = \\frac{3 \\cdot 0^2 + 1}{2 \\cdot 6} = \\frac{3 \\cdot 0 + 1}{12} = \\frac{1}{12}$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1045,7 +900,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle \\lambda = 5 \\cdot -6^{-1} = 5 \\cdot 9 = 45 \\pmod{11} = 1$"
+ "$\\displaystyle \\lambda = 1 \\cdot 12^{-1} = 1 \\cdot 3 = 3 \\pmod{7} = 3$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1057,7 +912,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle x_3 = \\lambda^2 - x_1 - x_2 = 1^2 - 6 - 0 = 1 - 6 - 0 = -5 \\pmod{11} = 6 = -5$"
+ "$\\displaystyle x_3 = \\lambda^2 - x_1 - x_2 = 3^2 - 0 - 0 = 9 - 0 - 0 = 9 \\pmod{7} = 2 = 2$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1069,7 +924,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle y_3 = \\lambda \\cdot (x_1 - x_3) - y_1 = 1 \\cdot (6 - 6) - 5 = 1 \\cdot 0 - 5 = 0 - 5 = -5 \\pmod{11} = 6 = -5$"
+ "$\\displaystyle y_3 = \\lambda \\cdot (x_1 - x_3) - y_1 = 3 \\cdot (0 - 2) - 6 = 3 \\cdot -2 - 6 = -6 - 6 = -12 \\pmod{7} = 2 = 2$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1081,7 +936,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle 4P = 3P + P = (-5, 5) + (0, -1) = (-5, -5)$"
+ "$\\displaystyle 2P = P + P = (0, -1) + (0, -1) = (2, 2)$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1105,7 +960,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle \\lambda = \\frac{y_2 - y_1}{x_2 - x_1} = \\frac{10 - 6}{0 - 6} = \\frac{4}{-6}$"
+ "$\\displaystyle \\lambda = \\frac{y_2 - y_1}{x_2 - x_1} = \\frac{6 - 2}{0 - 2} = \\frac{4}{-2}$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1117,7 +972,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle \\lambda = 4 \\cdot -6^{-1} = 4 \\cdot 9 = 36 \\pmod{11} = 3$"
+ "$\\displaystyle \\lambda = 4 \\cdot -2^{-1} = 4 \\cdot 3 = 12 \\pmod{7} = 5$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1129,7 +984,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle x_3 = \\lambda^2 - x_1 - x_2 = 3^2 - 6 - 0 = 9 - 6 - 0 = 3 \\pmod{11} = 3 = 3$"
+ "$\\displaystyle x_3 = \\lambda^2 - x_1 - x_2 = 5^2 - 2 - 0 = 25 - 2 - 0 = 23 \\pmod{7} = 2 = 2$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1141,7 +996,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle y_3 = \\lambda \\cdot (x_1 - x_3) - y_1 = 3 \\cdot (6 - 3) - 6 = 3 \\cdot 3 - 6 = 9 - 6 = 3 \\pmod{11} = 3 = 3$"
+ "$\\displaystyle y_3 = \\lambda \\cdot (x_1 - x_3) - y_1 = 5 \\cdot (2 - 2) - 2 = 5 \\cdot 0 - 2 = 0 - 2 = -2 \\pmod{7} = 5 = -2$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1153,7 +1008,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle 5P = 4P + P = (-5, -5) + (0, -1) = (3, 3)$"
+ "$\\displaystyle 3P = 2P + P = (2, 2) + (0, -1) = (2, -2)$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1177,7 +1032,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle \\lambda = \\frac{y_2 - y_1}{x_2 - x_1} = \\frac{10 - 3}{0 - 3} = \\frac{7}{-3}$"
+ "$\\displaystyle \\lambda = \\frac{y_2 - y_1}{x_2 - x_1} = \\frac{6 - 5}{0 - 2} = \\frac{1}{-2}$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1189,7 +1044,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle \\lambda = 7 \\cdot -3^{-1} = 7 \\cdot 7 = 49 \\pmod{11} = 5$"
+ "$\\displaystyle \\lambda = 1 \\cdot -2^{-1} = 1 \\cdot 3 = 3 \\pmod{7} = 3$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1201,7 +1056,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle x_3 = \\lambda^2 - x_1 - x_2 = 5^2 - 3 - 0 = 25 - 3 - 0 = 22 \\pmod{11} = 0 = 0$"
+ "$\\displaystyle x_3 = \\lambda^2 - x_1 - x_2 = 3^2 - 2 - 0 = 9 - 2 - 0 = 7 \\pmod{7} = 0 = 0$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1213,7 +1068,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle y_3 = \\lambda \\cdot (x_1 - x_3) - y_1 = 5 \\cdot (3 - 0) - 3 = 5 \\cdot 3 - 3 = 15 - 3 = 12 \\pmod{11} = 1 = 1$"
+ "$\\displaystyle y_3 = \\lambda \\cdot (x_1 - x_3) - y_1 = 3 \\cdot (2 - 0) - 5 = 3 \\cdot 2 - 5 = 6 - 5 = 1 \\pmod{7} = 1 = 1$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1225,7 +1080,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle 6P = 5P + P = (3, 3) + (0, -1) = (0, 1)$"
+ "$\\displaystyle 4P = 3P + P = (2, -2) + (0, -1) = (0, 1)$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1261,7 +1116,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle 7P = 6P + P = (0, 1) + (0, -1) = \\mathcal{O}$"
+ "$\\displaystyle 5P = 4P + P = (0, 1) + (0, -1) = \\mathcal{O}$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1273,7 +1128,7 @@
{
"data": {
"text/latex": [
- "$\\displaystyle \\text{Порядок точки } (0, -1) \\text{ равен } 7$"
+ "$\\displaystyle \\text{Порядок точки } (0, -1) \\text{ равен } 5$"
],
"text/plain": [
"<IPython.core.display.Math object>"
@@ -1284,7 +1139,7 @@
}
],
"source": [
- "a, b, field, pt_idx = 1, 1, 11, 1\n",
+ "a, b, field, pt_idx = 1, 1, 7, 1\n",
"\n",
"from math import gcd\n",
"\n",
@@ -1379,7 +1234,7 @@
"\n",
"\n",
"def mm(x):\n",
- " if x <= 5:\n",
+ " if x <= field // 2:\n",
" return x\n",
" else:\n",
" return x - field\n",
@@ -1466,6 +1321,26 @@
"pt1 = mm(pt[0]), mm(pt[1])\n",
"display(Math(fr\"\\text{{Порядок точки }} {pt1} \\text{{ равен }} {k}\"))\n"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 196,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "6"
+ ]
+ },
+ "execution_count": 196,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "inverse(16, 19)"
+ ]
}
],
"metadata": {