32114
Comment:
|
35452
|
Deletions are marked like this. | Additions are marked like this. |
Line 874: | Line 874: |
== Word to composition == {{{#!sagecell @interact def _( weight=(7,(2..30))): n=weight a=[0 for i in range(n-1)] a.append(1) @interact def _(v=('word', input_grid(1, n, default=[a], to_value=lambda x: vector(flatten(x))))): a=[v[i] for i in range(len(v))] def bintocomp(a): b=[] count=1 for j in range(len(a)): if(a[j]==0): count=count+1 else: b.append(count) count=1 return(b) print "Composition is ",bintocomp(a) }}} {{attachment:akhi2.png}} == Composition to Word == {{{#!sagecell @interact def _( Depth=(7,(1..30))): n=Depth a=[] a.append(2) a=a+[1 for i in range(1,n)] @interact def _(v=('composition', input_grid(1, n, default=[a], to_value=lambda x: vector(flatten(x))))): a=[v[i] for i in range(len(v))] def comptobin(a): word=[] for i in range(len(a)): word=word+[0]*(a[i]-1)+[1] return(word) print "Word is ",comptobin(a) }}} {{attachment:akhi3.png}} == Dual of a Word == {{{#!sagecell @interact def _( weight=(7,(2..30))): n=weight a=[0 for i in range(n-1)] a.append(1) @interact def _(v=('word', input_grid(1, n, default=[a], to_value=lambda x: vector(flatten(x))))): a=[v[i] for i in range(len(v))] def dual(a): b=list() b=a b=b[::-1] for i in range(len(b)): b[i]=1-b[i] return(b) print "Dual word is ",dual(a) }}} {{attachment:akhi2.png}} |
|
Line 875: | Line 944: |
=== Word Input === | |
Line 878: | Line 948: |
def _( weight=(7,(3..10))): | def _( weight=(5,(2..20))): |
Line 933: | Line 1003: |
{{attachment:akhi1.png}} === Composition Input === {{{#!sagecell R=RealField(10) @interact def _( Depth=(5,(2..20))): n=Depth a=[2] a=a+[1 for i in range(n-1)] @interact def _(v=('Composition', input_grid(1, n, default=[a], to_value=lambda x: vector(flatten(x)))), accuracy=(100..100000)): D=accuracy a=[v[i] for i in range(len(v))] def comptobin(a): word=[] for i in range(len(a)): word=word+[0]*(a[i]-1)+[1] return(word) a=comptobin(a) DD=int(3.321928*D)+int(R(log(3.321928*D))/R(log(10)))+4 RIF=RealIntervalField(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(RIF('0')) L.append(RIF('0')) if(word[i]==1 and i<k-1): S.append(RIF('0')) count=count+1 T=RIF('1') for m in range(n): T=T/2 B[k-1]=RIF('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=RIF('0') for i in range(len(l1)): Z=Z+l1[i]*l2[len(a)-i] return(Z) print zeta(a) }}} {{attachment:akhi5.png}} |
Contents
Integer Factorization
Divisibility Poset
by William Stein
Factor Trees
by William Stein
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
Prime Spiral - Square FIXME
by David Runde
Prime Spiral - Polar
by David Runde
Modular Forms
Computing modular forms
by William Stein
Computing the cuspidal subgroup
by William Stein
A Charpoly and Hecke Operator Graph
by William Stein
Modular Arithmetic
Quadratic Residue Table FIXME
by Emily Kirkman
Cubic Residue Table FIXME
by Emily Kirkman
Cyclotomic Fields
Gauss and Jacobi Sums in Complex Plane
by Emily Kirkman
Exhaustive Jacobi Plotter
by Emily Kirkman
Elliptic Curves
Adding points on an elliptic curve
by David Møller Hansen
Plotting an elliptic curve over a finite field
Cryptography
The Diffie-Hellman Key Exchange Protocol
by Timothy Clemans and William Stein
Other
Continued Fraction Plotter
by William Stein
Computing Generalized Bernoulli Numbers
by William Stein (Sage-2.10.3)
Fundamental Domains of SL_2(ZZ)
by Robert Miller
Multiple Zeta Values
by Akhilesh P.
Word to composition
Composition to Word
Dual of a Word
Computing Multiple Zeta values
Word Input
Composition Input