<jupyter_start><jupyter_text>Let's load SageMath's hooks<jupyter_code>%load_ext sage
1+1
type(20.0/3)<jupyter_output><empty_output><jupyter_text>Algebraic Structures<jupyter_code>ZZ, QQ, RR, CC
Zmod(30)
GF(31)<jupyter_output><empty_output><jupyter_text>Most algebraic structures are organised as parent/elements<jupyter_code>GF(17).list()
a = 2
a.parent()
ZZ is a.parent()
a.is_unit()<jupyter_output><empty_output><jupyter_text>Conversions<jupyter_code>b = QQ(a)
b == a
b.parent()
b.is_unit()<jupyter_output><empty_output><jupyter_text>Working with notebooks<jupyter_code>a, b = 2, 3
c = a + b
c<jupyter_output><empty_output><jupyter_text>Exploring objectsCompletion<jupyter_code>ZZ.<tab><jupyter_output><empty_output><jupyter_text>Documentation<jupyter_code>ZZ.CartesianProduct?
ZZ.cardinality??<jupyter_output><empty_output><jupyter_text>Polynomial rings<jupyter_code>a = x^2 - 1
b = (x-1)*(x+1)
b
a == b
bool(a == b)<jupyter_output><empty_output><jupyter_text>x is just a variable name<jupyter_code>x = 2
x^2 - 1<jupyter_output><empty_output><jupyter_text>Forget about x!We don't need symbolic calculus, we need polynomialsWe can reset symbolic variables with `x = SR.var('x')`<jupyter_code>QQ['x']
R.<x> = QQ[]
R
a = x^2 -1
a
a.parent()
b = (x-1)*(x+1)
b
a == b<jupyter_output><empty_output><jupyter_text>Finite fields<jupyter_code>p = next_prime(2^20)
R.<x> = GF(p)[]
R
P = R.irreducible_element(20)
P
K.<z> = GF(p^20, modulus=P)
K
z^20<jupyter_output><empty_output><jupyter_text>If we don't care about the modulus<jupyter_code>L.<z> = GF(p^2)
L
L.modulus()
z.multiplicative_order()
z^3
e = L.primitive_element()
e.multiplicative_order()
e
e.minpoly()<jupyter_output><empty_output><jupyter_text>Elliptic Curves<jupyter_code>E = EllipticCurve([1,2])
E
E.j_invariant()
E.torsion_order()
E.torsion_points()
G = E.torsion_subgroup()
G
G.gens()<jupyter_output><empty_output><jupyter_text>Elliptic curves over finite fields<jupyter_code>E = EllipticCurve(GF(p), [0, 1, 0, 2, 3])
E
E.cardinality().factor()
P = E.random_point()
Q = E.lift_x(123)
P, Q
P+Q
Q.order().factor()
R = 9*23*241*Q
R<jupyter_output><empty_output><jupyter_text>Isogenies<jupyter_code>phi = E.isogeny([R])
phi
S = phi(P)
S
S.parent()
phi(R)
phi.rational_maps()
phi.kernel_polynomial()
phi.kernel_polynomial()(R[0])<jupyter_output><empty_output><jupyter_text>Pairings<jupyter_code>L.<z> = GF(p^2)
EE = E.change_ring(L)
EE
EE.cardinality().factor()
T = EE.lift_x(912851*z + 87136)
T.order()
w = T.weil_pairing(EE(R), 3)
w
w.multiplicative_order()
T.weil_pairing(2*T, 3)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16400467471756916, 'fraction_numerical': 0.026879626022594468, 'mean_word_length': 8.582089552238806, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '16', 'dir': 'jupyter-structured-clean-dedup', 'id': '488963', 'license': 'Unlicense', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1164, 'n_words': 177, 'path': 'SummerSchool/SageTutorial/WelcomeNotebook.ipynb', 'repo_name': 'FredericJacobs/ECC2015-Notes', 'size': '2567'}