4 Letter Walks in Diamond Lattice
Based on Context Independent L–Systems
25 Feb 2004

Erik Jensen
University of California, Santa Cruz

Veikko Keränen
Rovaniemi Polytechnic, School of Technology
http://south.rotol.ramk.fi
http://south.rotol.ramk.fi/IMS_IAS_Events.html
veikko.keranen@ramk.fi


2003 Vectorgram concept by Erik Jensen
2004 Tetrahedron concept by Veikko Keränen
The support of   pLAB   at Rovaniemi Polytechnic is gratefully acknowledged.

You may interactively rotate and zoom the following LiveGraphics3D representations.
Just use CTRL, SHIFT, and MOUSE.  Try to see loops (in case of equally many a, b, c, d  letters),
symmetrices, semipalindromes, three letter projections, or even 2D walks.
The rest of the page is Mathematica code and still graphics. Enjoy!

LiveGraphics3D representations follow:

     tetrahedron     zeroSum
     
     g85aPath     g85aStart34     reducedg85aPath     g85to2ofa
     
     g98aPath     g98to2ofa

     abacWalkWithForbiddenPoints

     abacabaWalkWithForbiddenPoints

From here you may download the full Mathematica notebook as a zip file:

4LetterWalksInDiamondLattice.zip (zip: 1010 kB, nb: 7212 kB)

L-system basics

2D  Walks

3D  Walks

Starting algorithms for 3D walks

verticesOfTetrahedronDisplacementsForabcd =  {{0, 0, 1}, {0, (2 2^(1/2))/3, -1/3}, {-2/3^(1/2), -2^(1/2)/3, -1/3}, {2/3^(1/2), -2^(1/2)/3, -1/3}} ;

{aD, bD, cD, dD} = (verticesOfTetrahedronDisplacementsForabcd[[#1]] &)/@{1, 2, 3, 4}

{{0, 0, 1}, {0, (2 2^(1/2))/3, -1/3}, {-2/3^(1/2), -2^(1/2)/3, -1/3}, {2/3^(1/2), -2^(1/2)/3, -1/3}}

  Old graphics

  New graphics (see code below)

[Graphics:HTMLFiles/4LetterWalksInDiamondLattice_104.gif]

  Code

  Matrices for coordinate rotations about a coordinate axis
  (here the coordinate system is being rotated)

  Combined rotations of a point about any axis
  (component rotations are about a coordinate axis)

  Designing of the heads for arrows

  Arrows, our3DdisplacementForm, our3DShow, and newShow

  Code for RealTime3D (newRTShow)

  Code for reduced RealTime3D (reducedRTShow)

  Code for producing LiveGraphics3D Java 1.1 applet  


  3D Walks from a-2-free strings over four letters

  visualShuffleAndCodingToFourLetters

cyclicPermutation = {"a""b", "b""c", & ... ; g85c = StringReplace[g85b, cyclicPermutation] ; g85d = StringReplace[g85c, cyclicPermutation] ;

ga = "abcacdcbcdcadbdcbdbabcbdcacbabdbabcabdadcdadbdcbdbabdbcbacbcdbabdcdbdcacdbcbacbcdca ... ion] ; gd = StringReplace[gc, cyclicPermutation] ; {g98a = ga, g98b = gd, g98c = gc, g98d = gb} ;

productions85 = {"a"g85a, "b"g85b, "c"g8 ... 8[x_] := StringReplace[x, productions98] g98iter[n_] := Characters[Nest[g98, "a", n]] ;

g85["a"]

abcacdcbcdcadcdbdabacabadbabcbdbcbacbcdcacbabdabacadcbcdcacdbcbacbcdcacdcbdcdadbdcbca

<<Default3D`  (* Turns ordinary graphics on *)

RowBox[{zeroSum, =, RowBox[{newShow, [, RowBox[{"abcd", ,, .005, ,, RowBox[{{, RowBox[{RowBox[{-, 1.9}], ,, -2, ,,  , 1}], }}]}], ]}]}]

[Graphics:HTMLFiles/4LetterWalksInDiamondLattice_194.gif]

⁃Graphics3D⁃

SetDirectory["C:\_IMS2004\JavaApplet"] ; (* Change this *)

WriteLiveForm["zeroSum.m", zeroSum]

<<RealTime3D` (* Use mouse and CTRL to rotate and zoom *)

RowBox[{newRTShow, [, RowBox[{"abcd", ,, .005, ,, RowBox[{{, RowBox[{RowBox[{-, 1.9}], ,, -2, ,,  , 1}], }}]}], ]}]

-Graphics3D-

⁃Graphics3D⁃

<<Default3D`  (* Turns ordinary graphics on *)

g85aPath = newShow[g85["a"], .005, {-1, -2, 0}]

[Graphics:HTMLFiles/4LetterWalksInDiamondLattice_204.gif]

⁃Graphics3D⁃

WriteLiveForm["g85aPath.m", g85aPath]

<<RealTime3D` (* Use mouse and CTRL to rotate and zoom *)

newRTShow[g85["a"], .005, {-1, -2, 0}]

-Graphics3D-

⁃Graphics3D⁃

g85 (a) = abc acdcbcdcadcdbdabacabadbabcbd  bcbacbc dcacbabd abac adcb cdc acdb cbacbcdcacdcbdcd adbdcbca

<<Default3D`  (* Turns ordinary graphics on *)

RowBox[{newShow, [, RowBox[{"abc"<>"acdcbcdcadcdbdabacabadbabcbd"<>"bcb", ,, .005, ,, RowBox[{{, RowBox[{RowBox[{-, 2.7}], ,, -3, ,, 1.7}], }}]}], ]}]

[Graphics:HTMLFiles/4LetterWalksInDiamondLattice_214.gif]

⁃Graphics3D⁃

<<RealTime3D` (* Use mouse and CTRL to rotate and zoom *)

RowBox[{g85aStart34, =, RowBox[{newRTShow, [, RowBox[{"abc"<>"acdcbcdcadc ... gt;"bcb", ,, .005, ,, RowBox[{{, RowBox[{RowBox[{-, 2.7}], ,, -3, ,, 1.7}], }}]}], ]}]}]

[Graphics:HTMLFiles/4LetterWalksInDiamondLattice_218.gif]

⁃Graphics3D⁃

WriteLiveForm["g85aStart34.m", g85aStart34]

g98a = "abc acdcbcdca db dcbdbabcbdc acbabdbabca bda <br />dcdadbdcbdbabdbcbacbcdbabdc d bdcacdbcbacbcdcacdcbdcdadbd cbca"

<<Default3D`  (* Turns ordinary graphics on *)

RowBox[{newShow, [, RowBox[{"dcdadbdcbdbabdbcbacbcdbabdcdbdcacdbcbacbcdcacdcbdcdadbd", ,, 0.005, ,, 3dD}], ]}]

[Graphics:HTMLFiles/4LetterWalksInDiamondLattice_224.gif]

⁃Graphics3D⁃

<<RealTime3D` (* Use mouse and CTRL to rotate and zoom *)

RowBox[{newRTShow, [, RowBox[{"dcdadbdcbdbabdbcbacbcdbabdcdbdcacdbcbacbcdcacdcbdcdadbd", ,, 0.005, ,, {2, 0, 0}}], ]}]

-Graphics3D-

⁃Graphics3D⁃

<<Default3D`  (* Turns ordinary graphics on *)

The cycles in the 3D graphics below come from the grey areas
(in which letters  a, b, c, d  occur equally often) of  

g85(a) = abc acdcbcdcadcdbdabacabadbabcbd
bcbacbc dcacbabd abac adcb cdc acdb
cbacbcdcacdcbdcd
adbdcbca

g85(a) = abc acdcbcdcadcdbdabacabadbabcbd
bcbacbcdcacba bdabacadcbcd c acdb
cbacbcdcacdcbdcd
adbdcbca

<<RealTime3D` (* Use mouse and CTRL to rotate and zoom *)

RowBox[{RowBox[{newRTShow, [, RowBox[{g85["a"], ,, 0.005, ,, {0, 0, 1}}], ]}], ;}] R ... 371;, RowBox[{newShow, [, RowBox[{g85["d"], ,, 0.005, ,, {0, 0, 1}}], ]}], ;}],  , *)}]

-Graphics3D-

RowBox[{RowBox[{RowBox[{RowBox[{newRTShow, [, RowBox[{g98["a"], ,, 0.005, ,, {0, 0,  ... RowBox[{newShow, [, RowBox[{g98["d"], ,, 0.005, ,, {0, 0, 1}}], ]}], ;}],  , *)}]}],  }]

-Graphics3D-

<<Default3D`  (* Turns ordinary graphics on *)

RowBox[{RowBox[{RowBox[{RowBox[{g98aPath, =, RowBox[{newShow, [, RowBox[{g98["a"], , ... RowBox[{newShow, [, RowBox[{g98["d"], ,, 0.005, ,, {0, 0, 1}}], ]}], ;}],  , *)}]}],  }]

[Graphics:HTMLFiles/4LetterWalksInDiamondLattice_238.gif]

WriteLiveForm["g98aPath.m", g98aPath]

<<RealTime3D` (* Use mouse and CTRL to rotate and zoom *)

reducedg85aPath = reducedRTShow[g85["a"]]//N

-Graphics3D-

⁃Graphics3D⁃

SetDirectory["C:\_IMS2004\JavaApplet"] ; (* Change this *)

reducedg85aPath>>"reducedg85aPath.m"

RowBox[{g85to2ofa, =, RowBox[{RowBox[{reducedRTShow, [, RowBox[{g85iter[2], ,, RowBox[{ViewPoi ... {RowBox[{-, 0.223}], ,,  , RowBox[{-, 3.376}], ,,  , RowBox[{-, 0.026}]}], }}]}]}], ]}], //, N}]}]

-Graphics3D-

⁃Graphics3D⁃

g85to2ofa>>"g85to2ofa.m"

Please edit the last lines of "g85to2ofa.m":  Change PlotLabel ->,  to  PlotLabel ->"",    .
Sorry, I had no time to check why this went wrong in the first place.

RowBox[{g98to2ofa, =, RowBox[{RowBox[{reducedRTShow, [, RowBox[{g98iter[2], ,, RowBox[{ViewPoi ... {RowBox[{-, 0.223}], ,,  , RowBox[{-, 3.376}], ,,  , RowBox[{-, 0.026}]}], }}]}]}], ]}], //, N}]}]

-Graphics3D-

⁃Graphics3D⁃

g98to2ofa>>"g98to2ofa.m"

Once again: Change PlotLabel ->,  to  PlotLabel ->"",    .

<<Default3D`  (* Turns ordinary graphics on *)

Computing the final 2D point reached by extremely long walks for g85 and g98

DNA sequences

Acknowledgements


Created by Mathematica  (February 18, 2004)