Differences between revisions 55 and 65 (spanning 10 versions)
Revision 55 as of 2014-12-23 02:05:59
Size: 45948
Editor: akhi
Comment:
Revision 65 as of 2019-11-14 20:52:33
Size: 48344
Editor: chapoton
Comment: no xrange
Deletions are marked like this. Additions are marked like this.
Line 115: Line 115:
        else: print 'NaN'         else: print('NaN')
Line 140: Line 140:
    if start < 1 or end <=start: print "invalid start or end value"
    if n > end: print "WARNING: n is larger than the end value"
    if start < 1 or end <=start: print("invalid start or end value")
    if n > end: print("WARNING: n is larger than the end value")
Line 172: Line 172:
    #print x_cord, y_cord
Line 183: Line 182:
        #print x, "=x y=", y, " num =", num
Line 209: Line 207:
        print '(to go from x,y coords to an n, reset by setting n=0)'         print('(to go from x,y coords to an n, reset by setting n=0)')
Line 211: Line 209:
        #print 'if n =', n, 'then (x,y) =', (x_cord, y_cord)

    print
'(x,y) =', (x_cord, y_cord), '<=> n =', find_n(x_cord, y_cord, start)
    print ' '
    print
"SW/NE line"
    if -y_cord<x_cord: print '4*t^2 + 2*t +', -x_cord+y_cord+start
    else: print '4*t^2 + 2*t +', +x_cord-y_cord+start

    print
"NW/SE line"
    if x_cord<y_cord: print '4*t^2 +', -x_cord-y_cord+start
    else: print '4*t^2 + 4*t +', +x_cord+y_cord+start

    print(
'(x,y) =', (x_cord, y_cord), '<=> n =', find_n(x_cord, y_cord, start))
    print(' ')
    print(
"SW/NE line")
    if -y_cord<x_cord: print('4*t^2 + 2*t +', -x_cord+y_cord+start)
    else: print('4*t^2 + 2*t +', +x_cord-y_cord+start)

    print(
"NW/SE line")
    if x_cord<y_cord: print('4*t^2 +', -x_cord-y_cord+start)
    else: print('4*t^2 + 4*t +', +x_cord+y_cord+start)
Line 239: Line 236:
    if start < 1 or end <=start: print "invalid start or end value"
    if n > end: print "WARNING: n is greater than end value"
    if start < 1 or end <=start: print("invalid start or end value")
    if n > end: print("WARNING: n is greater than end value")
Line 262: Line 259:
        print 'n =', factor(n)         print('n = {}'.format(factor(n)))
Line 284: Line 281:
            print 'Pink Curve: n^2 +', c
            print 'Green Curve: n^2 + n +', c2
            print('Pink Curve: n^2 +', c)
            print('Green Curve: n^2 + n +', c2)
Line 312: Line 309:
    print M; print '\n'*3
    print "Computing basis...\n\n"
    print(M)
    print('\n' * 3)
    print(
"Computing basis...\n\n")
Line 315: Line 313:
         print "Space has dimension 0"          print("Space has dimension 0")
Line 317: Line 315:
        prec = max(prec, M.dimension()+1)         prec = max(prec, M.dimension() + 1)
Line 320: Line 318:
    print "\n\n\nDone computing basis."     print("\n\n\nDone computing basis.")
Line 333: Line 331:
    print A.cuspidal_subgroup()     print(A.cuspidal_subgroup())
Line 754: Line 752:
    print "p = %s"%p
    show(E.change_ring(GF(p)).plot(),xmin=0,ymin=0)
    print("p = %s" % p)
    show(E.change_ring(GF(p)).plot(), xmin=0, ymin=0)
Line 817: Line 815:
    c = list(continued_fraction(RealField(prec)(number))); print c     c = list(continued_fraction(RealField(prec)(number))); print(c)
Line 846: Line 844:
L = [[-0.5, 2.0^(x/100.0) - 1 + sqrt(3.0)/2] for x in xrange(1000, -1, -1)]
R = [[0.5, 2.0^(x/100.0) - 1 + sqrt(3.0)/2] for x in xrange(1000)]
xes = [x/1000.0 for x in xrange(-500,501,1)]
L = [[-0.5, 2.0^(x/100.0) - 1 + sqrt(3.0)/2] for x in range(1000, -1, -1)]
R = [[0.5, 2.0^(x/100.0) - 1 + sqrt(3.0)/2] for x in range(1000)]
xes = [x/1000.0 for x in range(-500,501,1)]
Line 872: Line 870:
= Multiple Zeta Values = = Multiple Zeta Values  =
Line 874: Line 872:
== Computing Multiple Zeta values == == Computing Multiple Zeta values  ==
Line 879: Line 877:
def _( weight=(5,(2..20))): def _( weight=(5,(2..100))):
Line 932: Line 930:
  print zeta(a)   u=zeta(a)
  RIF=RealIntervalField(int(3.321928*D))
  u=u/1
  print(u)
Line 939: Line 940:
def _( Depth=(5,(2..20))): def _( Depth=(5,(2..100))):
Line 998: Line 999:

  print zeta(a)
  u=zeta(a)
  RIF=RealIntervalField(int(3.321928*D))
  u=u/1
  print(u)
Line 1002: Line 1005:
== Program to Compute Integer Relation between Multiple Zeta Values ==
{{{#!sagecell
from mpmath import *
print("Enter the number of composition")
@interact
def _( n=(5,(2..100))):
 a=[]
 for i in range(n):
        a.append([i+2,1])
 print("In each box Enter composition as an array")
 @interact
 def _(v=('Compositions', input_box( default=a, to_value=lambda x: vector(flatten(x)))), accuracy=(100..100000)):
  D=accuracy
  R=RealField(10)
  a=v
  def comptobin(a):
        word=[]
        for i in range(len(a)):
                word=word+[0]*(a[i]-1)+[1]
        return(word)
  DD=int(D)+int(R(log(3.321928*D))/R(log(10)))+4
  RIF=RealIntervalField(DD)
  mp.dps=DD
  def Li(word):
        n=int(DD*log(10)/log(2))+1
        B=[]
        L=[]
        S=[]
        count=-1
        k=len(word)
        for i in range(k):
                B.append(mpf('0'))
                L.append(mpf('0'))
                if(word[i]==1 and i<k-1):
                        S.append(mpf('0'))
                        count=count+1
        T=mpf('1')
        for m in range(n):
                T=T/2
                B[k-1]=mpf('1')/(m+1)
                j=count
                for i in range(k-2,-1,-1):
                        if(word[i]==0):
                                B[i]=B[i+1]/(m+1)
                        elif(word[i]==1):
                                B[i]=S[j]/(m+1)
                                S[j]=S[j]+B[i+1]
                                j=j-1
                        L[i]=T*B[i]+L[i]
                L[k-1]=T*B[k-1]+L[k-1]
        return(L)
  def dual(a):
        b=list()
        b=a
        b=b[::-1]
        for i in range(len(b)):
                b[i]=1-b[i]
        return(b)
  def zeta(a):
        b=dual(a)
        l1=Li(a)+[1]
        l2=Li(b)+[1]
        Z=mpf('0')
        for i in range(len(l1)):
                Z=Z+l1[i]*l2[len(a)-i]
        return(Z)
  zet=[]
  for i in range(n):
        zet.append((zeta(comptobin(a[i]))))
  mp.dps=D
  for i in range(n):
        zet[i]=zet[i]/1
        print("zeta(", a[i], ")=", zet[i])
  u=pslq(zet,tol=10**-D,maxcoeff=100,maxsteps=10000)
  print("the Intger Relation between the above zeta values given by the vector")
  print(u)
}}}
{{attachment:akhi10.png}}
Line 1006: Line 1086:
def _( weight=(7,(2..30))): def _( weight=(7,(2..100))):
Line 1023: Line 1103:
  print "Composition is ",bintocomp(a)   print("Composition is {}".format(bintocomp(a)))
Line 1030: Line 1110:
def _( Depth=(7,(1..30))): def _( Depth=(7,(1..100))):
Line 1044: Line 1124:
  print "Word is  ",comptobin(a)   print("Word is {}".format(comptobin(a)))
Line 1051: Line 1131:
def _( weight=(7,(2..30))): def _( weight=(7,(2..100))):
Line 1066: Line 1146:
  print "Dual word is ",dual(a)   print("Dual word is {}"?format(dual(a)))
Line 1075: Line 1155:
def _( w1=(2,(2..20)), w2=(2,(2..20))): def _( w1=(2,(2..100)), w2=(2,(2..100))):
Line 1153: Line 1233:
    print c[1][i],"*",c[0][i] ,"+ ",
  print c[1][len(c[0])-1],"*",c[0][len(c[0])-1]
    print(c[1][i],"*",c[0][i] ,"+ ")
  print(c[1][len(c[0])-1],"*",c[0][len(c[0])-1])
Line 1162: Line 1242:
def _( w=(2,(2..20))): def _( w=(2,(2..100))):
Line 1302: Line 1382:
  c=Regshuf0(a)   c = Regshuf0(a)
Line 1305: Line 1385:
      print c[1][i],"*",c[0][i] ,"+ ",       print(c[1][i],"*",c[0][i] ,"+ ")
Line 1307: Line 1387:
    print c[1][len(c[0])-1],"*",c[0][len(c[0])-1]     print(c[1][len(c[0])-1],"*",c[0][len(c[0])-1])
Line 1455: Line 1535:
  c=Regshuf1(a)   c = Regshuf1(a)
Line 1458: Line 1538:
      print c[1][i],"*",c[0][i] ,"+ ",       print(c[1][i],"*",c[0][i] ,"+ ")
Line 1460: Line 1540:
    print c[1][len(c[0])-1],"*",c[0][len(c[0])-1]     print(c[1][len(c[0])-1],"*",c[0][len(c[0])-1])

Integer Factorization

Divisibility Poset

by William Stein

divposet.png

Factor Trees

by William Stein

factortree.png

More complicated demonstration using Mathematica: http://demonstrations.wolfram.com/FactorTrees/

Factoring an Integer

by Timothy Clemans

Sage implementation of the Mathematica demonstration of the same name. http://demonstrations.wolfram.com/FactoringAnInteger/

Prime Numbers

Illustrating the prime number theorem

by William Stein

primes.png

Prime Spiral - Square FIXME

by David Runde

SquareSpiral.PNG

Prime Spiral - Polar

by David Runde

PolarSpiral.PNG

Modular Forms

Computing modular forms

by William Stein

modformbasis.png

Computing the cuspidal subgroup

by William Stein

cuspgroup.png

A Charpoly and Hecke Operator Graph

by William Stein

heckegraph.png

Modular Arithmetic

Quadratic Residue Table FIXME

by Emily Kirkman

quadres.png

quadresbig.png

Cubic Residue Table FIXME

by Emily Kirkman

cubres.png

Cyclotomic Fields

Gauss and Jacobi Sums in Complex Plane

by Emily Kirkman

jacobising.png

Exhaustive Jacobi Plotter

by Emily Kirkman

jacobiexh.png

Elliptic Curves

Adding points on an elliptic curve

by David Møller Hansen

PointAddEllipticCurve.png

Plotting an elliptic curve over a finite field

ellffplot.png

Cryptography

The Diffie-Hellman Key Exchange Protocol

by Timothy Clemans and William Stein

dh.png

Other

Continued Fraction Plotter

by William Stein

contfracplot.png

Computing Generalized Bernoulli Numbers

by William Stein (Sage-2.10.3)

bernoulli.png

Fundamental Domains of SL_2(ZZ)

by Robert Miller

fund_domain.png

Multiple Zeta Values

by Akhilesh P.

Computing Multiple Zeta values

Word Input

akhi1.png

Composition Input

akhi5.png

Program to Compute Integer Relation between Multiple Zeta Values

akhi10.png

Word to composition

akhi2.png

Composition to Word

akhi3.png

Dual of a Word

akhi4.png

Shuffle product of two Words

akhi6.png

Shuffle Regularization at 0

akhi7.png

Shuffle Regularization at 1

akhi8.png

interact/number_theory (last edited 2020-06-14 09:10:48 by chapoton)