Programming Help. PLEASE (2)
- To: mathgroup at smc.vnet.net
- Subject: [mg22986] Programming Help. PLEASE (2)
- From: gemilord at blue.seas.upenn.edu (Geoffrey B Milord)
- Date: Sun, 9 Apr 2000 01:45:51 -0400 (EDT)
- Organization: University of Pennsylvania
- Sender: owner-wri-mathgroup at wolfram.com
Why does the following routine Milord[1,3] work but not Milord[2,3]? I am not familiar with Mathematica but I stepped through it. The problem seems to be with the assignment of t1 in the last line of the for loop. When you post mail me as well. Thanks. (*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info at wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 2988, 82]*) (*NotebookOutlinePosition[ 3664, 106]*) (* CellTagsIndexPosition[ 3620, 102]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[ \(\(\(\[IndentingNewLine]\)\(F = \ BitOr[BitAnd[#1, #2], BitAnd[BitNot[#1], #3]] &\)\)\)], "Input"], Cell[BoxData[ \(BitOr[BitAnd[#1, #2], BitAnd[BitNot[#1], #3]] &\)], "Output"] }, Open ]], Cell[BoxData[ \(\[IndentingNewLine]\)], "Input"], Cell[BoxData[ \(\(\(\[IndentingNewLine]\)\(\(Milord[numSteps_, start_]\)\(:=\)\(Module[{t0, t1}, \ \[IndentingNewLine]t0\ = {}; \t\[IndentingNewLine]t0\ = Append[t0, Table[Random[Integer], {128}]]; \[IndentingNewLine]t1\ = t0[\([1]\)]; \[IndentingNewLine]t1\ = \ RotateRight[t1, Mod[\(-start\), 4]*32]; \[IndentingNewLine]For\ [ i = 0, i < numSteps, \(i++\), \[IndentingNewLine]\ t1\ = Join[ Table[F[t1[\([j + 32]\)], t1[\([j + 64]\)], t1[\([j + 96]\)]], {j, 32}], Table[t1[\([j]\)], {j, 33, 128}]]; \[IndentingNewLine]t0 = \ Append[t0, \ RotateRight[ t1, \(-Mod[i - start, 4]\)*32]]; \[IndentingNewLine]t1\ = R\ otateRight[t1, 32]]; \[IndentingNewLine]\t Return[t0]]\)\(\[IndentingNewLine]\)\(\[IndentingNewLine]\)\(\ \[IndentingNewLine]\)\)\)\)], "Input"] }, FrontEndVersion->"4.0 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 695}}, WindowToolbars->{}, WindowSize->{495, 599}, WindowMargins->{{174, Automatic}, {Automatic, 17}} ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1739, 51, 124, 2, 50, "Input"], Cell[1866, 55, 81, 1, 29, "Output"] }, Open ]], Cell[1962, 59, 52, 1, 50, "Input"], Cell[2017, 62, 967, 18, 350, "Input"] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)