(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of 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@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[ 4626, 156]*) (*NotebookOutlinePosition[ 5277, 179]*) (* CellTagsIndexPosition[ 5233, 175]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Generating a binary code and computing its minimal distance", "Title", TextAlignment->Center, TextJustification->0, FontColor->RGBColor[1, 1, 0], Background->RGBColor[0, 0, 1]], Cell[TextData[{ "The function ", StyleBox["points[k_Integer]", FontWeight->"Bold"], " generates the ", Cell[BoxData[ \(TraditionalForm\`2\^k\)]], " co-ordinates of the points in a ", StyleBox["k", FontSlant->"Italic"], "-dimensional vector space over ", Cell[BoxData[ \(TraditionalForm\`\[DoubleStruckCapitalF]\_2\)]], ". The integer ", StyleBox["k", FontSlant->"Italic"], " must be greater than zero.\nThe output is a ", Cell[BoxData[ \(TraditionalForm\`2\^k\[Times]k\)]], " matrix of all possible ", Cell[BoxData[ \(TraditionalForm\`k\)]], " dimensional binary vectors." }], "Text", FontSize->14, Background->RGBColor[1, 1, 0]], Cell[BoxData[{ \(Clear[points, k]\), \(points[k_Integer] := \(points[k] = \n\t\t Module[{tn = Transpose[points[k - 1]]}, \n\t\t\t\ \ \ \ \ \ \ \ \ \ tn = Transpose[\ Join[{Table[0, {2^\((k - 1)\)}]}, tn]]; \n \t\t\t\t\ \ \ \ \ \ \ \ Join[tn, Mod[1 + \ \ tn, 2]]\n\t\t\t\t] \)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \), \(\t\(points[1] = {{0}, {1}}; \)\t\t\)}], "Input"], Cell[TextData[{ "If ", StyleBox["GMat", FontWeight->"Bold"], " is the ", Cell[BoxData[ \(TraditionalForm\`k\[Times]n\)]], " generator matrix of a binary code ", StyleBox["C", FontWeight->"Bold"], " of dimension ", StyleBox["k", FontSlant->"Italic"], " and block length ", StyleBox["n", FontSlant->"Italic"], ", then ", StyleBox["points[k].C", FontWeight->"Bold"], " is a matrix whose rows consist of all the code words in ", StyleBox["C", FontWeight->"Bold"], ". Here is an example." }], "Text", FontSize->14, Background->RGBColor[1, 1, 0]], Cell[BoxData[{ \(GMat = {{1, 0, 0, 0, 1, 1, 1}, {0, 1, 0, 0, 1, 1, 0}, {0, 0, 1, 0, 0, 1, 1}, {0, 0, 0, 1, 1, 0, 1}}; \nMatrixForm[GMat]\), \(code = Mod[points[Length[GMat]] . GMat, 2]; \nMatrixForm[code]\)}], "Input"], Cell[TextData[{ "The function ", StyleBox["distances[GMat_List]", FontWeight->"Bold"], " produces a vector of all the non-zero distances of the code words \ generated by ", StyleBox["GMat", FontWeight->"Bold"], ". One may then compute the minimal distance of the code via the ", StyleBox["Mathematica", FontSlant->"Italic"], " ", StyleBox["Min", FontWeight->"Bold"], " function." }], "Text", FontSize->14, Background->RGBColor[1, 1, 0]], Cell[BoxData[ \(distances[GMat_List] := Plus@@Transpose[Drop[Mod[points[Length[GMat]] . GMat, 2], 1]]\)], "Input"], Cell[BoxData[{ \(dvec = distances[GMat]\), \(Min[dvec]\)}], "Input"] }, Open ]] }, FrontEndVersion->"Microsoft Windows 3.0", ScreenRectangle->{{0, 1024}, {0, 740}}, WindowSize->{496, 602}, WindowMargins->{{92, Automatic}, {Automatic, 22}} ] (*********************************************************************** 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[1731, 51, 190, 4, 211, "Title"], Cell[1924, 57, 699, 25, 91, "Text"], Cell[2626, 84, 445, 8, 150, "Input"], Cell[3074, 94, 604, 25, 93, "Text"], Cell[3681, 121, 241, 4, 110, "Input"], Cell[3925, 127, 474, 17, 93, "Text"], Cell[4402, 146, 128, 3, 50, "Input"], Cell[4533, 151, 77, 2, 50, "Input"] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)