Sharedwww / old_sage_examples / example.pyOpen in CoCalc
Author: William A. Stein
1
# This file was *autogenerated* from the file example.sage.
2
from sage.all_cmdline import *
3
#!/usr/bin/env sage
4
##################################################################
5
#
6
# example.sage -- an example SAGE script.
7
#
8
# Example SAGE script. You can use this example script in many
9
# different ways.
10
#
11
# (*) sage example.sg
12
# (*) ./example.sg (assuming the SAGE directory is in your path)
13
# (*) From within sage type
14
# load 'example.sg'
15
# (*) From within sage type
16
# attach 'example.sg'
17
# With attach, when you enter a blank line in SAGE, if
18
# example.sg has changed it is reloaded.
19
#
20
# As a tutorial and test of your install, you might want to
21
# try all these now.
22
#
23
##################################################################
24
print "This is a simple SAGE example script."
25
26
print Integer(5)**Integer(10)
27
28
29
print '2/3 = ', Integer(2)/Integer(3)
30
31
print 'int(2)/int(3) = ', int(Integer(2))/int(Integer(3))
32
33
print factor(Integer(2005))
34
35
def foo(n):
36
return n**Integer(2)
37
38
print [foo(i) for i in range(Integer(10))]
39
40
E = EllipticCurve('37a')
41
42
print E.gens()
43
44
45
def cond(E):
46
"""
47
Return the conductor of an elliptic curve.
48
49
EXAMPLES:
50
sage: cond(EllipticCurve('37a'))
51
37
52
sage: cond(EllipticCurve([1, -1, 1, -29372, -1932937]))
53
3006
54
"""
55
return E.conductor()
56
57
print cond(E)
58
59
print "This should be true:"
60
print int(gp('ellglobalred(ellinit([1, -1, 1, -29372, -1932937],0))[1]')) == Integer(3006)
61
62
time factor(Integer(2)**Integer(127)-Integer(1))
63
64