(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2"; MacintoshStandardFontEncoding; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times"; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times"; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times"; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times"; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times"; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times"; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 12, "Courier"; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R65535, L-5, 12, "Courier"; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier"; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier"; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = leftheader, inactive, L2, 12, "Times"; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times"; fontset = leftfooter, inactive, L2, 12, "Times"; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; currentKernel; ] :[font = input; initialization; preserveAspect] *) (********************************************************************* Package PseudoRandom.m Version 1.0 November 26, 1993 Erik Jensen Department of Physics University of Windsor Windsor Ont. Canada ejensen@server.uwindsor.ca Permission is hereby granted to make copies of this file for any purpose other than direct profit, or as part of a commercial product, provided this copyright notice is left intact. Sale, other than for the cost of media, is prohibited. Permission is hereby granted to reproduce part or all of this file, provided that the source is acknowledged. If you do enhance or add to this package, please email me a copy as I would be most interested. One major addition that would be of interest would be routines to help in determining a "real" deconvolution matrix based on perturbations of the ideal deconvolution matrix that is calculated here. See Ref. 1 for details. This package defines a few routines that are useful for working with Pseudorandom Sequences. The routines are derived from algorithms and data presented in the papers: 1. "Magnetically suspended cross-correlation chopper in molecular beam-surface experiments", Review of Scientific Instruments 52(6), p. 789 (1981), by G. Comsa, R. David and B.J. Schumacher. 2. "Generation of pseudorandom sequences for use in cross-correlation modulation", Review of Scientific Instruments 63(8), p. 3852 (1992), by D.D. Koleske and S.J. Sibener. The format of the package is adapted from: Roman E. Maeder: Programming in Mathematica, Second Edition, Addison-Wesley, 1991. Base 10 values for the recursion coefficients which produce Maximum Length Pseudorandom Sequences (MLPRS's) (from Table III of Koleske and Sibener) n N M's (seed values) 2 3 3 3 7 3 4 15 9 5 31 5,15,23 6 63 3,27,39 7 127 3,9,15,29,39,43,63,75,111 8 255 29,43,45,77,95,99,135,207 9 511 17,27,45,51,89,95,111,119,125,135,149,163,175, 183,189,207,219,275,287,315,335,347,383,399 10 1023 9,27,39,45,101,111,139,197,... 11 2047 5,23,43,45,71,99,101,113,123,... 12 4095 83,105,123,125,153,209,235,263,... *********************************************************************) BeginPackage["PseudoRandom`"] (* usage messages for the exported functions and the context itself *) PseudoRandom::usage = "PseudoRandom.m works with finite length pseudorandom sequences" PRSequence::usage = "PRSequence[n, m] returns a list (length 2^n-1) of 1's and 0's corresponding to the seed value m." PRConvolution::usage = "PRConvolution[list, m] calculates the self-convolution of the pseudorandom sequence with itself, shifted by m." PRConvolutionMatrix::usage = "PRConvolutionMatrix[list] calculates convolving matrix of the pseudorandom sequence ." PRDeconvolutionMatrix::usage = "PRDeconvolutionMatrix[list] calculates ideal deconvolution matrix for the pseudorandom sequence ." Begin["`Private`"] (* begin the private context *) (* definition of the exported functions *) PRSequence[n_Integer, m_Integer] := Module[ {smalln, bigN, startSequence, bigM, mSequence, aSubset }, smalln= n; bigN= 2^smalln - 1; startSequence= Table[1,{bigN}]; bigM=m; mSequence= IntegerDigits[bigM, 2]; While[Length[mSequence]