In [1]:
1+1
Out[1]:
In [2]:
20/3
Out[2]:
In [3]:
20.0/3
Out[3]:
In [6]:
type (20.0 / 3)
Out[6]:
In [7]:
%load_ext sage
In [8]:
1+1
Out[8]:
In [9]:
type(20.0/3)
Out[9]:
In [10]:
ZZ, QQ, RR, CC
Out[10]:
In [11]:
Zmod(30)
Out[11]:
In [12]:
GF(31)
Out[12]:
In [13]:
GF(17).list()
Out[13]:
In [14]:
a = 2
In [15]:
a.parent()
Out[15]:
In [16]:
ZZ is a.parent()
Out[16]:
In [17]:
a.is_unit()
Out[17]:
In [18]:
b = QQ(a)
In [19]:
b == a
Out[19]:
In [20]:
b.parent()
Out[20]:
In [21]:
b.is_unit()
Out[21]:
In [22]:
a, b = 2, 3
In [23]:
c = a + b
In [24]:
c
Out[24]:
In [ ]:
ZZ.<tab>
Documentation
In [ ]:
ZZ.CartesianProduct?
In [ ]:
ZZ.cardinality??
In [33]:
a = x^2 - 1
In [34]:
b = (x-1)*(x+1)
b
Out[34]:
In [35]:
a == b
Out[35]:
In [36]:
bool(a == b)
Out[36]:
In [37]:
x = 2
In [38]:
x^2 - 1
Out[38]:
In [39]:
QQ['x']
Out[39]:
In [40]:
R.<x> = QQ[]
R
Out[40]:
In [41]:
a = x^2 -1
a
Out[41]:
In [42]:
a.parent()
Out[42]:
In [43]:
b = (x-1)*(x+1)
b
Out[43]:
In [44]:
a == b
Out[44]:
In [46]:
p = next_prime(2^20)
R.<x> = GF(p)[]
R
Out[46]:
In [48]:
P = R.irreducible_element(20)
P
Out[48]:
In [49]:
K.<z> = GF(p^20, modulus=P)
K
Out[49]:
In [50]:
z^20
Out[50]:
In [51]:
L.<z> = GF(p^2)
L
Out[51]:
In [52]:
L.modulus()
Out[52]:
In [53]:
z.multiplicative_order()
Out[53]:
In [54]:
z^3
Out[54]:
In [56]:
e = L.primitive_element()
e.multiplicative_order()
Out[56]:
In [57]:
e
Out[57]:
In [58]:
e.minpoly()
Out[58]:
In [59]:
E = EllipticCurve([1,2])
E
Out[59]:
In [60]:
E.j_invariant()
Out[60]:
In [61]:
E.torsion_order()
Out[61]:
In [62]:
E.torsion_points()
Out[62]:
In [64]:
G = E.torsion_subgroup()
G
Out[64]:
In [65]:
G.gens()
Out[65]:
In [67]:
E = EllipticCurve(GF(p), [0, 1, 0, 2, 3])
E
Out[67]:
In [68]:
E.cardinality().factor()
Out[68]:
In [70]:
P = E.random_point()
Q = E.lift_x(123)
P, Q
Out[70]:
In [71]:
P+Q
Out[71]:
In [72]:
Q.order().factor()
Out[72]:
In [75]:
R = 9*23*241*Q
R
Out[75]:
In [77]:
phi = E.isogeny([R])
phi
Out[77]:
In [78]:
S = phi(P)
S
Out[78]:
In [79]:
S.parent()
Out[79]:
In [80]:
phi(R)
Out[80]:
In [81]:
phi.rational_maps()
Out[81]:
In [82]:
phi.kernel_polynomial()
Out[82]:
In [83]:
phi.kernel_polynomial()(R[0])
Out[83]:
In [89]:
L.<z> = GF(p^2)
EE = E.change_ring(L)
EE
Out[89]:
In [90]:
EE.cardinality().factor()
Out[90]:
In [92]:
T = EE.lift_x(912851*z + 87136)
T.order()
Out[92]:
In [93]:
w = T.weil_pairing(EE(R), 3)
w
Out[93]:
In [94]:
w.multiplicative_order()
Out[94]:
In [95]:
T.weil_pairing(2*T, 3)
Out[95]:
In [ ]: