Differences between revisions 47 and 48
 ⇤ ← Revision 47 as of 2014-12-20 19:59:47 → Size: 35452 Editor: akhi Comment: ← Revision 48 as of 2014-12-20 21:07:25 → ⇥ Size: 38307 Editor: akhi Comment: Deletions are marked like this. Additions are marked like this. Line 1071: Line 1071: == Shuffle product of two Words =={{{#!sagecell@interactdef _( w1=(2,(2..20)), w2=(2,(2..20))): a= b=[0 for i in range(w2-1)] a=a+[1 for i in range(1,w1)] b=b+ import itertools #this program gives the list of all binary words of weight n and depth k @interact def _(v1=('word1', input_grid(1, w1, default=[a], to_value=lambda x: vector(flatten(x)))), v2=('word2', input_grid(1, w2, default=[b], to_value=lambda x: vector(flatten(x))))):  def kbits(n, k):    result = []    for bits in itertools.combinations(range(n), k):        s = ['0'] * n        for bit in bits:            s[bit] = '1'        result.append(''.join(s))    return result  def sort(a,l,m):        b=[]        n=len(a)        for i in range(n):                b.append(a[i])        for j in range(l-1,-1,-1):                k=0                for t in range(m+1):                        for i in range(n):                                 if(a[i][j]== t):                                        b[k]=a[i]                                        k=k+1                for i in range(n):                        a[i]=b[i]        return(a)  def count(a):        n=len(a)        b=[]        b.append(a)        m=[]        m.append(1)        c=0        for i in range(1,n):                if(a[i]==a[i-1]):                        m[c]=m[c]+1                else:                        b.append(a[i])                        m.append(1)                        c=c+1        return(b,m)  def shuffle(a,b):        r=len(a)        s=len(b)        # Generating an array of strings containing all combinations of weight r+s and depth s        M=kbits(r+s,s)        n=len(M)        a1= []        for i in range(n):                a1.append(list(M[i]))        # The zeroes are replaced by the entries of a and the ones by the entries of b        a2= []        for i in range(n):                a2.append([])                count0=0                count1=0                for j in range(s+r):                        if(a1[i][j]=='0'):                                a2[i].append(a[count0])                                count0=count0+1                        if(a1[i][j]=='1'):                                a2[i].append(b[count1])                                count1=count1+1        # Reordering in lexicographic order the entries of a2: this is done by first reordering them according to the last digit, then the next to last digit, etc        a3=sort(a2,r+s,max(a+b+))        # Getting the same list without repetitions and with multiplicities         a4=count(a3)        return(a4)  c=shuffle(a,b)  for i in range(len(c)-1):    print c[i],"*",c[i] ,"+ ",  print c[len(c)-1],"*",c[len(c)-1]}}}

# 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

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 ## Shuffle product of two Words

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