chore: svgs to mathml

This commit is contained in:
Himadri Bhattacharjee
2025-02-25 14:57:20 +05:30
parent 668b8bc65e
commit a286b71142
13 changed files with 38 additions and 48 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 9.5 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 9.1 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.2 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -1,2 +0,0 @@
<svg style="vertical-align: -1.018ex" xmlns="http://www.w3.org/2000/svg" width="8.84ex" height="3.167ex" role="img" focusable="false" viewBox="0 -950 3907.2 1400">
<g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math"><g data-mml-node="mi"><path data-c="1D45B" d="M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z"></path></g><g data-mml-node="mo" transform="translate(877.8,0)"><path data-c="3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path></g><g data-mml-node="mo" transform="translate(1933.6,0)"><path data-c="220F" d="M220 812Q220 813 218 819T214 829T208 840T199 853T185 866T166 878T140 887T107 893T66 896H56V950H1221V896H1211Q1080 896 1058 812V-311Q1076 -396 1211 -396H1221V-450H725V-396H735Q864 -396 888 -314Q889 -312 889 -311V896H388V292L389 -311Q405 -396 542 -396H552V-450H56V-396H66Q195 -396 219 -314Q220 -312 220 -311V812Z"></path></g><g data-mml-node="mi" transform="translate(3378.2,0)"><path data-c="1D44E" d="M33 157Q33 258 109 349T280 441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449 381 412 234T374 68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487Q506 153 506 144Q506 138 501 117T481 63T449 13Q436 0 417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26 254 59T298 110Q300 114 325 217T351 328Z"></path></g></g></g></svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -1,2 +0,0 @@
<svg style="vertical-align: -1.909ex" xmlns="http://www.w3.org/2000/svg" width="8.675ex" height="4.438ex" role="img" focusable="false" viewBox="0 -1118 3834.5 1961.8">
<g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math"><g data-mml-node="msub"><g data-mml-node="mi"><path data-c="1D45A" d="M21 287Q22 293 24 303T36 341T56 388T88 425T132 442T175 435T205 417T221 395T229 376L231 369Q231 367 232 367L243 378Q303 442 384 442Q401 442 415 440T441 433T460 423T475 411T485 398T493 385T497 373T500 364T502 357L510 367Q573 442 659 442Q713 442 746 415T780 336Q780 285 742 178T704 50Q705 36 709 31T724 26Q752 26 776 56T815 138Q818 149 821 151T837 153Q857 153 857 145Q857 144 853 130Q845 101 831 73T785 17T716 -10Q669 -10 648 17T627 73Q627 92 663 193T700 345Q700 404 656 404H651Q565 404 506 303L499 291L466 157Q433 26 428 16Q415 -11 385 -11Q372 -11 364 -4T353 8T350 18Q350 29 384 161L420 307Q423 322 423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 181Q151 335 151 342Q154 357 154 369Q154 405 129 405Q107 405 92 377T69 316T57 280Q55 278 41 278H27Q21 284 21 287Z"></path></g><g data-mml-node="TeXAtom" transform="translate(911,-150) scale(0.707)" data-mjx-texclass="ORD"><g data-mml-node="mi"><path data-c="1D456" d="M184 600Q184 624 203 642T247 661Q265 661 277 649T290 619Q290 596 270 577T226 557Q211 557 198 567T184 600ZM21 287Q21 295 30 318T54 369T98 420T158 442Q197 442 223 419T250 357Q250 340 236 301T196 196T154 83Q149 61 149 51Q149 26 166 26Q175 26 185 29T208 43T235 78T260 137Q263 149 265 151T282 153Q302 153 302 143Q302 135 293 112T268 61T223 11T161 -11Q129 -11 102 10T74 74Q74 91 79 106T122 220Q160 321 166 341T173 380Q173 404 156 404H154Q124 404 99 371T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287Z"></path></g></g></g><g data-mml-node="mo" transform="translate(1482.7,0)"><path data-c="3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path></g><g data-mml-node="mfrac" transform="translate(2538.5,0)"><g data-mml-node="mi" transform="translate(348,676)"><path data-c="1D45B" d="M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z"></path></g><g data-mml-node="msub" transform="translate(220,-686)"><g data-mml-node="mi"><path data-c="1D44E" d="M33 157Q33 258 109 349T280 441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449 381 412 234T374 68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487Q506 153 506 144Q506 138 501 117T481 63T449 13Q436 0 417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26 254 59T298 110Q300 114 325 217T351 328Z"></path></g><g data-mml-node="TeXAtom" transform="translate(562,-150) scale(0.707)" data-mjx-texclass="ORD"><g data-mml-node="mi"><path data-c="1D456" d="M184 600Q184 624 203 642T247 661Q265 661 277 649T290 619Q290 596 270 577T226 557Q211 557 198 567T184 600ZM21 287Q21 295 30 318T54 369T98 420T158 442Q197 442 223 419T250 357Q250 340 236 301T196 196T154 83Q149 61 149 51Q149 26 166 26Q175 26 185 29T208 43T235 78T260 137Q263 149 265 151T282 153Q302 153 302 143Q302 135 293 112T268 61T223 11T161 -11Q129 -11 102 10T74 74Q74 91 79 106T122 220Q160 321 166 341T173 380Q173 404 156 404H154Q124 404 99 371T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287Z"></path></g></g></g><rect width="1056" height="60" x="120" y="220"></rect></g></g></g></svg>

Before

Width:  |  Height:  |  Size: 4.1 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.2 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.9 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.1 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 13 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 9.6 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.2 KiB

View File

@@ -340,20 +340,22 @@ How do we make sure that the results are equal if there is so much of pseudo-ran
Our best option is to somehow have the `mod` variable as 1 since anything times 1 is itself.
The return value in such a case is bound to its initial value of 1 for any non-zero proof value.
For this to happen, `leet % proof` must be equal to 1. Noting that 0x1337 (4919) is the only value passed as leet,
For this to happen, `leet % proof` must be equal to 1. Let's call the proof \(p\).
With 0x1337 being the only value passed as `leet`,
we have the constraint
{{< math "volcano-expression-8.svg" >}}
$$0x1337 \equiv 1 \pmod{p}$$
The congruence can be rewritten as:
Let's convert the hexadecimal number to decimal.
{{< math "volcano-expression-9.svg" >}}
$$4919 \equiv 1 \pmod{p}$$
{{< math "volcano-expression-10.svg" >}}
$$\implies 4919 - 1 \equiv 0 \pmod{p}$$
$$\implies 4918 \equiv 0 \pmod{p}$$
{{< math "volcano-expression-11.svg" >}}
Earlier, we noted that the proof value cannot be 1 and it cannot be even.
It is of the form \( 2n + 1, n \in \mathbb{N} \)
Earlier, we noted that the proof value cannot be 1 and it cannot be even.
Thus, we need an odd proof value that divides 4918 without leaving any remainder.
The number 2 divides 4918 to give 2459, a prime number.
@@ -415,38 +417,50 @@ for bear in 1.. {
Since most of the conditions are modulo congruence checks, we can use the Chinese Remainder Theorem
to solve for the smallest number that leaves the respective remainders and begin from there.
Let `a` be the array of all the moduli 2, 3, 5, 7 and 109.
Let \(a\) be a vector of all the moduli and \(r\) represent the array of the respective remainders.
{{< math "volcano-expression-12.svg" >}}
$$
a = \begin{bmatrix}
2 & 3 & 5 & 7 & 109
\end{bmatrix}
$$
Let `r` represent the array of the respective remainders.
$$
r = \begin{bmatrix}
0 & 2 & 1 & 3 & 55
\end{bmatrix}
$$
{{< math "volcano-expression-13.svg" >}}
We begin by calculating \(n\), the product of all the moduli.
We begin by calculating `n` as the product of all the moduli.
$$
n = \prod{a}
$$
{{< math "volcano-expression-14.svg" >}}
We construct \(m\) containing the modulus of each equation by diving \(n\) by each element of \(a\).
We construct `m` containing the modulus of each equation by diving `n` by each element of `a`.
{{< math "volcano-expression-15.svg" >}}
$$
m_{i} = \frac{n}{a_{i}}
$$
We then calculate the multiplicative modular inverse of the aforementioned moduli with respect to the original moduli.
{{< math "volcano-expression-16.svg" >}}
$$
M_{i} \equiv \frac{1}{m_{i}} \pmod{a_i}
$$
> The modular inverse of a number `x` modulo `m` is the number `x_inv` such that its product with `x` mod `m` is 1.
> The modular inverse of a number \(x\) modulo \(m\) is the number \(x_{inv}\) such that
>
> {{< math "volcano-expression-17.svg" >}}
> $$ x \cdot x_{inv} \equiv 1 \pmod{m} $$
We now multiply the calculated moduli and their inverses to find out the constants that leave the remainder 1.
Let's name this array of constants as `c`.
Let's name this array of constants as \(c\).
{{< math "volcano-expression-18.svg" >}}
$$ c_{i} = m_{i} \cdot M_{i} $$
We multiply the remainder with each constant and add them up. The final unique solution is this number modulo `n`.
We multiply the remainder with each constant and add them up. The final unique solution \(s\) is this number modulo \(n\).
{{< math "volcano-expression-19.svg" >}}
$$ s = (\sum_{i}{c_{i} \cdot r_{i}}) \pmod{n} $$
The code implementation looks like the following:
@@ -470,7 +484,7 @@ let s: i32 = inverses
let solution = s % n;
```
Here, I'm using the [modinverse](https://docs.rs/modinverse/latest/modinverse/) crate so that I don't have to implement it manually. If you are following along,
For convenience, I'm using the [modinverse](https://docs.rs/modinverse/latest/modinverse/) crate. If you are following along,
run the following to add it to your Rust project:
```sh