CoCalc -- Collaborative Calculation in the Cloud
Sharedwww / old_sage_examples / example.pyOpen in CoCalc
# This file was *autogenerated* from the file example.sage.
from sage.all_cmdline import *
#!/usr/bin/env sage
##################################################################
#
# example.sage -- an example SAGE script.
#
# Example SAGE script.  You can use this example script in many
# different ways.
#
#  (*) sage example.sg
#  (*) ./example.sg  (assuming the SAGE directory is in your path)
#  (*) From within sage type
#                  load 'example.sg'
#  (*) From within sage type
#                  attach 'example.sg'
#      With attach, when you enter a blank line in SAGE, if
#      example.sg has changed it is reloaded.
#
# As a tutorial and test of your install, you might want to
# try all these now.
#
##################################################################
print "This is a simple SAGE example script."

print Integer(5)**Integer(10)


print '2/3 = ', Integer(2)/Integer(3)

print 'int(2)/int(3) = ', int(Integer(2))/int(Integer(3))

print factor(Integer(2005))

def foo(n):
    return n**Integer(2)

print [foo(i) for i in range(Integer(10))]

E = EllipticCurve('37a')

print E.gens()


def cond(E):
    """
    Return the conductor of an elliptic curve.

    EXAMPLES:
        sage: cond(EllipticCurve('37a'))
        37
        sage: cond(EllipticCurve([1, -1, 1, -29372, -1932937]))
        3006
    """
    return E.conductor()

print cond(E)

print "This should be true:"
print int(gp('ellglobalred(ellinit([1, -1, 1, -29372, -1932937],0))[1]')) == Integer(3006)

time factor(Integer(2)**Integer(127)-Integer(1))