Math 582: computational number theory
Homework 3 -- due by Wednesday at 9am (that's when I'll grade it)
Problem 1: Make several mathematical objects over a finite fields of your choosing and do at least one thing with them:
a univariate polynomial
a matrix
a vector space
a multivariate polynomial
an elliptic curve
an algebraic curve of genus bigger than 1
There are 1 irreducible monic polynomials of degree 2 over GF(2)
check: (2^2 - 2)/2 = 1
There are 3 irreducible monic polynomials of degree 2 over GF(3)
check: (3^2 - 3)/2 = 3
There are 10 irreducible monic polynomials of degree 2 over GF(5)
check: (5^2 - 5)/2 = 10
There are 21 irreducible monic polynomials of degree 2 over GF(7)
check: (7^2 - 7)/2 = 21
There are 55 irreducible monic polynomials of degree 2 over GF(11)
check: (11^2 - 11)/2 = 55
There are 78 irreducible monic polynomials of degree 2 over GF(13)
check: (13^2 - 13)/2 = 78
There are 136 irreducible monic polynomials of degree 2 over GF(17)
check: (17^2 - 17)/2 = 136
There are 171 irreducible monic polynomials of degree 2 over GF(19)
check: (19^2 - 19)/2 = 171
Finite Field of size 5
Univariate Polynomial Ring in t over Finite Field of size 5
[t^2 + 2, t^2 + 3, t^2 + t + 1, t^2 + t + 2, t^2 + 2*t + 3, t^2 + 2*t + 4, t^2 + 3*t + 3, t^2 + 3*t + 4, t^2 + 4*t + 1, t^2 + 4*t + 2]
t^2 + 4*t + 2
t + 3
t^2 + 4*t + 2
t^3 + 3*t + 3
t^4 + 4*t^2 + 4*t + 2
t^5 + 4*t + 3
[0 1 2 3]
[1 2 3 4]
[2 3 4 0]
[3 4 0 1]
Eigenvalues of A: [2, 0, 0, 0]
minpoly of A: x^3 + 3*x^2
charpoly of A: x^4 + 3*x^3
rational canonical form of A:
[0|0 0 0]
[-+-----]
[0|0 0 0]
[0|1 0 0]
[0|0 1 2]
If that looks weird, given charpoly(A), remember that 2 = -3.
echelon form of A:
[1 0 4 3]
[0 1 2 3]
[0 0 0 0]
[0 0 0 0]
Vector space of degree 4 and dimension 2 over Finite Field of size 5
Basis matrix:
[1 0 2 2]
[0 1 3 1]
25
25
6
[Vector space of degree 4 and dimension 1 over Finite Field of size 5
Basis matrix:
[1 0 2 2], Vector space of degree 4 and dimension 1 over Finite Field of size 5
Basis matrix:
[1 1 0 3], Vector space of degree 4 and dimension 1 over Finite Field of size 5
Basis matrix:
[1 2 3 4], Vector space of degree 4 and dimension 1 over Finite Field of size 5
Basis matrix:
[1 3 1 0], Vector space of degree 4 and dimension 1 over Finite Field of size 5
Basis matrix:
[1 4 4 1], Vector space of degree 4 and dimension 1 over Finite Field of size 5
Basis matrix:
[0 1 3 1]]
Multivariate Polynomial Ring in u, v, w over Finite Field of size 5
2*u*w - v*w + 2*u - 2*v - 2*w - 1
A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 6 vertices
(A vertex at (0, 0, 0), A vertex at (0, 0, 1), A vertex at (0, 1, 0), A vertex at (0, 1, 1), A vertex at (1, 0, 0), A vertex at (1, 0, 1))
3D rendering not yet implemented
Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field
11
Elliptic Curve defined by y^2 + y = x^3 + 4*x^2 over Finite Field of size 5
True
Error in lines 1-1
Traceback (most recent call last):
File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py", line 229, in genus
return self._genus
File "sage/structure/parent.pyx", line 855, in sage.structure.parent.Parent.__getattr__ (/projects/sage/sage-6.10/src/build/cythonized/sage/structure/parent.c:8043)
attr = getattr_from_other_class(self, self._category.parent_class, name)
File "sage/structure/misc.pyx", line 253, in sage.structure.misc.getattr_from_other_class (/projects/sage/sage-6.10/src/build/cythonized/sage/structure/misc.c:1667)
raise dummy_attribute_error
AttributeError: 'EllipticCurve_finite_field_with_category' object has no attribute '_genus'
1
Hyperelliptic Curve over Rational Field defined by y^2 = x^7 - x - 1
3
Hyperelliptic Curve over Finite Field of size 5 defined by y^2 = x^7 + 4*x + 4
3
8
Problem 2: Benchmark basic arithmetic in for a prime with the following bit sizes: 4, 8, 16, 32, 64, 128, 512.
12391263801719934075147269200624486096905356036881620514867217025022218689728554366094219689708789308158456283076492888957026199314148895275516920490597803
155
4-bit prime: 17
Finite Field of size 17
benchmark for 2 + 2:
625 loops, best of 3: 57.6 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 62.2 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 56.1 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 61 ns per loop
8-bit prime: 257
Finite Field of size 257
benchmark for 2 + 2:
625 loops, best of 3: 57.6 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 62.6 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 56.1 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 63.7 ns per loop
16-bit prime: 65537
Finite Field of size 65537
benchmark for 2 + 2:
625 loops, best of 3: 114 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 123 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 114 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 123 ns per loop
32-bit prime: 4294967311
Finite Field of size 4294967311
benchmark for 2 + 2:
625 loops, best of 3: 229 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 294 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 229 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 304 ns per loop
64-bit prime: 18446744073709551629
Finite Field of size 18446744073709551629
benchmark for 2 + 2:
625 loops, best of 3: 225 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 233 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 274 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 322 ns per loop
128-bit prime: 340282366920938463463374607431768211507
Finite Field of size 340282366920938463463374607431768211507
benchmark for 2 + 2:
625 loops, best of 3: 230 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 267 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 304 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 386 ns per loop
256-bit prime: 115792089237316195423570985008687907853269984665640564039457584007913129640233
Finite Field of size 115792089237316195423570985008687907853269984665640564039457584007913129640233
benchmark for 2 + 2:
625 loops, best of 3: 227 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 291 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 384 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 462 ns per loop
512-bit prime: 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084171
Finite Field of size 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084171
benchmark for 2 + 2:
625 loops, best of 3: 230 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 293 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 343 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 615 ns per loop
Problem 3: Benchmark basic arithmetic in for a prime with the following bit sizes: 4, 8, 16, 32, 64, 128, 512.
4-bit prime: 17
Finite Field in a of size 17^2
benchmark for 2 + 2:
625 loops, best of 3: 59.1 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 57.6 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 57.6 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 57.6 ns per loop
8-bit prime: 257
Finite Field in a of size 257^2
benchmark for 2 + 2:
625 loops, best of 3: 320 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 386 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 318 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 386 ns per loop
16-bit prime: 65537
Finite Field in a of size 65537^2
benchmark for 2 + 2:
625 loops, best of 3: 322 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 390 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 319 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 384 ns per loop
32-bit prime: 4294967311
Finite Field in a of size 4294967311^2
benchmark for 2 + 2:
625 loops, best of 3: 310 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 402 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 298 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 402 ns per loop
64-bit prime: 18446744073709551629
Finite Field in a of size 18446744073709551629^2
benchmark for 2 + 2:
625 loops, best of 3: 434 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 529 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 470 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 598 ns per loop
128-bit prime: 340282366920938463463374607431768211507
Finite Field in a of size 340282366920938463463374607431768211507^2
benchmark for 2 + 2:
625 loops, best of 3: 430 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 525 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 447 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 694 ns per loop
256-bit prime: 115792089237316195423570985008687907853269984665640564039457584007913129640233
Finite Field in a of size 115792089237316195423570985008687907853269984665640564039457584007913129640233^2
benchmark for 2 + 2:
625 loops, best of 3: 443 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 534 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 463 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 762 ns per loop
512-bit prime: 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084171
Finite Field in a of size 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084171^2
benchmark for 2 + 2:
625 loops, best of 3: 446 ns per loop
benchmark for 2 * 2:
625 loops, best of 3: 537 ns per loop
benchmark for ell + ell:
625 loops, best of 3: 456 ns per loop
benchmark for ell * ell:
625 loops, best of 3: 887 ns per loop