(*********************************************************************** 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[ 112619, 4612]*) (*NotebookOutlinePosition[ 113779, 4648]*) (* CellTagsIndexPosition[ 113735, 4644]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[TextData["Discrete Cosine Transform"], "Subtitle", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Credits & Version"], "Section", Evaluatable->False, AspectRatioFixed->False], Cell[TextData[{ "Written by Andrew B. Watson. All rights reserved. Do not distribute or \ reproduce without permission. No warranties expressed or implied. This is \ Version 3.0 , compatible with ", StyleBox["Mathematica", FontSlant->"Italic"], " 2.2." }], "Text", Evaluatable->False, AspectRatioFixed->False] }, Open ]], Cell[CellGroupData[{ Cell[TextData["History"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "4/27/94 Changed low level DCT and IDCT to use matrix multiplication instead \ of FFT. Is about twice as fast."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Changed IDCTMatrix to Transpose. should be same as inverse...10/24/94."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Changed DCTMatrix to add nDCT arg. 12/7/95"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Added n arg to DCT, IDCT, DCTMatrix, IDCTMatrix, 12/7/95 abw"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["MapBlock 12/7/95."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "added functions for downsampled clor compression from DCTune. 12/19/95. \ abw"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "5/15/96 Changed structure of huffman code table. Fixed error for case of \ {cat,run} = {0,15}. New functions BitsAC, CatRunToBits, HuffCodeSizeAC, ", StyleBox["BlockToBitCountAC now have initial cap in name.", FontFamily->"Times", FontSize->14] }], "Text", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Preliminaries"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Needs[\"ImageProcessing`\"]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell["<< Entropy.m", "Input", InitializationCell->True, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["DCT Transform"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["DCTMatrix"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCTMatrix[n_:8] := DCTMatrix[n] = N[Table[If[k==0,Sqrt[1/n],Sqrt[2/n] Cos[Pi \ ( 2 j + 1) k / (2 n)]],{k,0,n-1},{j,0,n-1}]]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "IDCTMatrix[n_:8] := IDCTMatrix[n] = Transpose[DCTMatrix[n]];"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["(Plus @@ (#^2))& /@ DCTMatrix[16]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 0.999999999999999, 1., 1., 1., 1., 1.}\ \>", "\<\ {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["Chop[DCTMatrix[16] . Transpose[DCTMatrix[16]]]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["{Max@#,Min@#}& @ DCTMatrix[8]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {0.4903926402016153, -0.4903926402016153}\ \>", "\<\ {0.490393, -0.490393}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["ShowImage[DCTMatrix[8]];"], "Input", AspectRatioFixed->True], Cell[TextData["PrintQM[DCTMatrix[8],False]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Plotting 1D DCT basis functions"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "freqs=Range[0,7];\nShow[{\n\ ListPlot[Transpose[{freqs,#}],DisplayFunction->Identity,PlotJoined->True]& /@ \ (DCTMatrix[8]+Range[8]),\n\ ListPlot[Transpose[{freqs,#}],DisplayFunction->Identity,PlotJoined->False,\ PlotStyle->{PointSize[0.02]}]& /@ \ (DCTMatrix[8]+Range[8])},DisplayFunction->$DisplayFunction,Frame->True\n\ ,Axes->False\n,FrameTicks->{Range[0,7],Automatic}\n\ ,PlotRange->{{-1,8},{0,9}}];"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Direct computation of 1D DCT"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCT[list_] := Module[{length},\n length = Length[list];\n N @ Join[\n \ {Sqrt[1/length] Plus @@ list},\n Table[Sqrt[2/length] Plus @@ (list * \n \ Table[Cos[Pi ( 2 j + 1) k / (2 n)],{j,0,length-1}])\n ,{k,length-1}] ] ]"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["1D DCT using DFT for length 8"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "This method is described in Jain p. 152. A new sequence is made by \ extracting the even elements, followed by the reversed odd elements. The DFDT \ of this is multiplied by twiddle factors and DCT gains, and the real part is \ taken."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Jain, A. K. (1989). ", FontFamily->"Geneva", FontSize->0], StyleBox["Fundamentals of digital image processing", FontFamily->"Geneva", FontSize->0, FontSlant->"Italic"], StyleBox[" . Prentice Hall: Englewood Cliffs, NJ.", FontFamily->"Geneva", FontSize->0] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "We precompute the factors. These factors do not include Sqrt[1/n] because it \ is in InverseFourier."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCTTwiddleFactors = N @ Join[{1},Table[\n\tSqrt[2] Exp[-I Pi k / (2 \ n)],{k,n-1}]]"], "Input", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCT[list_] :=\n Re[DCTTwiddleFactors \ InverseFourier[list[[{1,3,5,7,8,6,4,2}]]]]"], "Input", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "This is a kluge to deal with 2.2 \"feature\" of no Fourier of integers..."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCT[list_] :=\n Re[DCTTwiddleFactors InverseFourier[0. + \ list[[{1,3,5,7,8,6,4,2}]]]]"], "Input", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["This is slower but more general."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCT2[list_] := Module[{shuf},\n shuf = Flatten[MapAt[Reverse,\n \ Transpose[Partition[list,2]],2]];\n Re[DCTTwiddleFactors \ InverseFourier[shuf]] ]"], "Input", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["1D IDCT using IDFT for length 8"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "We precompute the factors. These factors do not include Sqrt[1/n] because it \ is in InverseFourier."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "IDCTTwiddleFactors = N @ Join[{1},Table[Sqrt[2] Exp[I Pi k / (2 \ n)],{k,n-1}]]"], "Input", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "IDCT[list_] := \n Re[ Fourier[IDCTTwiddleFactors list] \ ][[{1,8,2,7,3,6,4,5}]]"], "Input", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "This is a kluge to deal with 2.2 \"feature\" of no Fourier of integers..."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "IDCT[list_] := \n Re[ Fourier[0. + (IDCTTwiddleFactors list)] \ ][[{1,8,2,7,3,6,4,5}]]"], "Input", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["This version is more general but slower."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "IDCT2[list_] := \n Flatten[Transpose[MapAt[Reverse,\n Partition[\n Re[ \ Fourier[IDCTTwiddleFactors list] ],4],2]]]"], "Input", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["DCTTensor"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "The DCT 2D basis images are arranged in a 2D array. Note the indexing is \ DCTTensor[[u,v]], so if the tensor is pictured, it must be transposed."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCTTensor[n_] := DCTTensor[n] = Transpose[Outer[ \ Times,DCTMatrix[n],DCTMatrix[n]],{1,4,2,3}]"], "Input", AspectRatioFixed->True], Cell[TextData["Must use this temporarily because of bug in Outer:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCTTensor[n_] := DCTTensor[n] = Array[\n Outer[ \ Times,DCTMatrix[n][[#2]],DCTMatrix[n][[#1]]]&,\n {n,n}];"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData["This shows that their magnitudes are 1 (orthnormal)."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Map[(Plus @@ Flatten @ (#^2))&, DCTTensor[8],{2}]"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[DCTTensor[8][[1,8]]];"], "Input", AspectRatioFixed->True], Cell[TextData[ "Show[GraphicsArray[\n Map[GraphicsImage[#,{-.25,.25}]&\n ,Reverse @ \ Transpose[DCTTensor[8]],{2}]]];"], "Input", AspectRatioFixed->True], Cell[TextData[{ "Note that the transpose is necessary because ", StyleBox["Mathematica", FontSlant->"Italic"], " uses row-major indexing." }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "ShowImage[IDCT[ test2=Transpose[Map[(Plus @@ \ Flatten[test*#])&,DCTTensor[8],{2}]]]]"], "Input", AspectRatioFixed->True], Cell[TextData["Used in making stimuli. Amplified to unit amplitude."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCTTensorNorm[n_] := DCTTensorNorm[n] =\n DCTTensor[n] / \ Map[Max,Abs[DCTTensor[n]],{2}];"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["DCT"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCT::usage = \"DCT[array_,n_:8]: Compute the blocked Discrete Cosine \ Transform of the list array. The length of each block is n. array may have \ one or two dimensions.\";"], "Info", Evaluatable->True, InitializationCell->True, AspectRatioFixed->False], Cell[TextData[ "We rely on two principles: 1) DCT is separable, and 2) we can partition each \ row into sequences of length n, DCT them, and rejoin them, and then transpose \ the whole image, and repeat the process."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["DCT for list of length > n"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCT[array_,n_:8] :=\n Join @@ (DCT[#,n]& /@ Partition[array,n]) /; \ (Length[array]>n)"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["1D DCT using matrix multiplication"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["DCT[list_,n_:8] := DCTMatrix[n] . list"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["2D DCT using separable method"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCT[array_?MatrixQ,n_:8] := \n Transpose[ DCT[#,n]& /@ Transpose[ DCT[#,n]& \ /@ array] ]"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["testing"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["test1 = Table[Random[Real,{-1,1}],{16}];"], "Input", AspectRatioFixed->True], Cell[TextData["test2 = DCT[test1,8];"], "Input", AspectRatioFixed->True], Cell[TextData["test3 = IDCT[test2];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Chop[Max[Abs[test1-test3]]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0\ \>", "\<\ 0\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["test4 = Table[Random[Real,{-1,1}],{16},{16}];"], "Input", AspectRatioFixed->True], Cell[TextData["test5 = DCT[test4,8];"], "Input", AspectRatioFixed->True], Cell[TextData["test6 = IDCT[test5];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Chop[Max[Abs[test4-test6]]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0\ \>", "\<\ 0\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData[{ "source = Reverse /@ ", StyleBox["ReadByteImage", FontWeight->"Plain"], "[\"011-0002 p.64x64\",64,64,3] / 255.;" }], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[source];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[testDCT=DCT[source[[1]]];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {3.166666666666515*Second, Null}\ \>", "\<\ {3.16667 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["ShowImage[testDCT];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[IDCT[testDCT]//Chop];"], "Input", AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["IDCT"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Note that this code is identical to DCT, except for matrix. Should exploit \ this..."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["DCT for list of length > n"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "IDCT[array_,n_:8] :=\n Join @@ (IDCT[#,n]& /@ Partition[array,n]) /; \ (Length[array]>n)"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["1D DCT using matrix multiplication"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["IDCT[list_,n_:8] := IDCTMatrix[n] . list"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["2D DCT using separable method"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "IDCT[array_?MatrixQ,n_:8] := \n Transpose[ IDCT[#,n]& /@ Transpose[ \ IDCT[#,n]& /@ array] ]"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Testing"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["test = Table[Random[Real,{-1,1}],{16},{32}];"], "Input", AspectRatioFixed->True], Cell[TextData["out0 = IDCT[test];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["out0[[1]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {0.7280396927778999, 0.4580227925593717, -1.132228961802171, 0.1123047932744164, 0.3738676799713475, -0.5475355734759058, -0.891867952990344, 0.2522063695324537, 0.3672987830447579, 0.5391156551753705, 0.6166997934990384, 0.3782343943586122, 0.7177399850300393, 0.05932954994927198, 0.0969539685201262, 0.824662782710935, 0.1471037587245314, -0.4035814773682557, -0.7491523110345808, 0.6120165418146085, 0.2572754490695781, 0.2886005149633136, 1.542516638821091, 0.2240241342573961, 0.5421127598480826, 0.996796346733876, 0.4353555361010225, -0.4981146492668429, -0.01070075181987748, -0.861130864023854, 0.1457978962095669, 0.3740481748184277}\ \>", "\<\ {0.72804, 0.458023, -1.13223, 0.112305, 0.373868, -0.547536, -0.891868, 0.252206, 0.367299, 0.539116, 0.6167, 0.378234, 0.71774, 0.0593295, 0.096954, 0.824663, 0.147104, -0.403581, -0.749152, 0.612017, 0.257275, 0.288601, 1.54252, 0.224024, 0.542113, 0.996796, 0.435356, -0.498115, -0.0107008, -0.861131, 0.145798, 0.374048}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["out1 = IDCT[test];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Max[Abs[out0-out1]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0.\ \>", "\<\ 0.\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["out1[[1]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {0.7280396927778999, 0.4580227925593717, -1.132228961802171, 0.1123047932744164, 0.3738676799713475, -0.5475355734759058, -0.891867952990344, 0.2522063695324537, 0.3672987830447579, 0.5391156551753705, 0.6166997934990384, 0.3782343943586122, 0.7177399850300393, 0.05932954994927198, 0.0969539685201262, 0.824662782710935, 0.1471037587245314, -0.4035814773682557, -0.7491523110345808, 0.6120165418146085, 0.2572754490695781, 0.2886005149633136, 1.542516638821091, 0.2240241342573961, 0.5421127598480826, 0.996796346733876, 0.4353555361010225, -0.4981146492668429, -0.01070075181987748, -0.861130864023854, 0.1457978962095669, 0.3740481748184277}\ \>", "\<\ {0.72804, 0.458023, -1.13223, 0.112305, 0.373868, -0.547536, -0.891868, 0.252206, 0.367299, 0.539116, 0.6167, 0.378234, 0.71774, 0.0593295, 0.096954, 0.824663, 0.147104, -0.403581, -0.749152, 0.612017, 0.257275, 0.288601, 1.54252, 0.224024, 0.542113, 0.996796, 0.435356, -0.498115, -0.0107008, -0.861131, 0.145798, 0.374048}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["out2 = IDCT[DCT[test]];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Max[Abs[test-out2]]//Chop"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0\ \>", "\<\ 0\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Tests"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData[ "test = Table[Random[Real,{-1,1}],{16},{32}];\n\ Max[Abs[test-IDCT[DCT[test]]]]//Chop"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0\ \>", "\<\ 0\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData[ "n=16;\ntest = Table[Random[Real,{-1,1}],{16},{32}];\n\ Max[Abs[test-IDCT[DCT[test,n],n]]]//Chop"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0\ \>", "\<\ 0\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData[ "n=4;\ntest = Table[Random[Real,{-1,1}],{16},{32}];\n\ Max[Abs[test-IDCT[DCT[test,n],n]]]//Chop"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0\ \>", "\<\ 0\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["DCT Timing"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["comparison of matrix mult and FFT"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "test=\n {{0, 1, 0, 0, 0, 1, 0, 0},{0, 1, 0, 0, 0, 1, 0, 0}, \n {0, 1, 1, 1, \ 1, 1, 0, 0},{0, 1, 0, 0, 0, 1, 0, 0}, \n {0, 0, 1, 0, 1, 0, 0, 0},{0, 0, 1, \ 0, 1, 0, 0, 0}, \n {0, 0, 1, 0, 1, 0, 0, 0},{0, 0, 0, 1, 0, 0, 0, 0}};"], "Input", AspectRatioFixed->True], Cell[TextData["test = UnBlockImage[Table[test,{4},{4}]];"], "Input", AspectRatioFixed->True], Cell[TextData["test = UnBlockImage[Table[test,{4},{4}]];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[test]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Dimensions[test]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {64, 64}\ \>", "\<\ {64, 64}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["test = test+0.;"], "Input", AspectRatioFixed->True], Cell[TextData[ "DCT[list_] :=\n Re[DCTTwiddleFactors \ InverseFourier[list[[{1,3,5,7,8,6,4,2}]]]]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["?DCT"], "Input", AspectRatioFixed->True], Cell[TextData[ "Global`DCT\n\nDCT[(array_)?MatrixQ] := Transpose[DCT /@ Transpose[DCT /@ \ array]]\n \nDCT[(array_)?(Length[#1] > 8 & )] := Apply[Join, DCT /@ \ Partition[array, 8]]\n \nDCT[list_] := \ Re[DCTTwiddleFactors*InverseFourier[list[[{1, 3, 5, 7, 8, 6, 4, 2}]]]]"], "Print", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Timing[test3=DCT[test];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {2.189999999999998*Second, Null}\ \>", "\<\ {2.19 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["DCT[list_] := DCTMatrix . list"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["?DCT"], "Input", AspectRatioFixed->True], Cell[TextData[ "Global`DCT\n\nDCT[(array_)?MatrixQ] := Transpose[DCT /@ Transpose[DCT /@ \ array]]\n \nDCT[(array_)?(Length[#1] > 8 & )] := Apply[Join, DCT /@ \ Partition[array, 8]]\n \nDCT[list_] := DCTMatrix . list"], "Print", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Timing[test4=DCT[test];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {1.329999999999998*Second, Null}\ \>", "\<\ {1.33 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["?IDCT"], "Input", AspectRatioFixed->True], Cell[TextData[ "Global`IDCT\n\nIDCT[(array_)?MatrixQ] := Transpose[IDCT /@ Transpose[IDCT /@ \ array]]\n \nIDCT[(array_)?(Length[#1] > 8 & )] := Apply[Join, IDCT /@ \ Partition[array, 8]]\n \nIDCT[list_] := Re[Fourier[0. + \ IDCTTwiddleFactors*list]][[{1, 8, 2, 7, 3, 6, 4, 5}]]"], "Print", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Timing[test5=IDCT[test4];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {2.530000000000001*Second, Null}\ \>", "\<\ {2.53 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["IDCTMatrix = Inverse[DCTMatrix];"], "Input", AspectRatioFixed->True], Cell[TextData["IDCT[list_] := IDCTMatrix . list"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["?IDCT"], "Input", AspectRatioFixed->True], Cell[TextData[ "Global`IDCT\n\nIDCT[(array_)?MatrixQ] := Transpose[IDCT /@ Transpose[IDCT /@ \ array]]\n \nIDCT[(array_)?(Length[#1] > 8 & )] := Apply[Join, IDCT /@ \ Partition[array, 8]]\n \nIDCT[list_] := IDCTMatrix . list"], "Print", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Timing[test6=IDCT[test4];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {1.299999999999997*Second, Null}\ \>", "\<\ {1.3 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Max[Abs[test6-test5]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1.221245327087672*10^-15\ \>", "\<\ -15 1.22125 10\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["ShowImage[Chop[IDCT[test4]]]"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[Chop[IDCT[test3]]]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Max[Abs[test3-test4]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 6.66133814775094*10^-16\ \>", "\<\ -16 6.66134 10\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData[ "Timing[test2=Transpose[Map[(Plus @@ Flatten[test*#])&,DCTTensor,{2}]];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {0.2800000000000002*Second, Null}\ \>", "\<\ {0.28 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Dimensions[Plus @@ (Plus @@ test . DCTTensor)]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {8, 8}\ \>", "\<\ {8, 8}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["quadra 950"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["in256 = Reverse[readHips[\"mandril256\"]];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[in256];"], "Input", AspectRatioFixed->True], Cell[TextData[ "shuttle=Reverse[readImageRaw[\"011-0002 p.64x64\",64,64,3][[2]]];"], "Input",\ AspectRatioFixed->True], Cell[TextData["ShowImage[shuttle];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[out256=DCTCompress[in256,qLum,True];]"], "Input", AspectRatioFixed->True], Cell[TextData["Entropy = 1.81479 bits/pixel"], "Print", Evaluatable->False, AspectRatioFixed->True], Cell[OutputFormData["\<\ {1069.55*Second, Null}\ \>", "\<\ {1069.55 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Timing[out256=DCTCompress[in256,qLum];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {716.55*Second, Null}\ \>", "\<\ {716.55 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["in128=DownSample[in256,{2,2},{1,1}];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[out128=DCTCompress[in128,qLum,True];]"], "Input", AspectRatioFixed->True], Cell[TextData["Entropy = 1.98589 bits/pixel"], "Print", Evaluatable->False, AspectRatioFixed->True], Cell[OutputFormData["\<\ {264.35*Second, Null}\ \>", "\<\ {264.35 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Timing[out128=DCTCompress[in128,qLum];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {180.05*Second, Null}\ \>", "\<\ {180.05 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Timing[out64=DCTCompress[shuttle,qLum,True];]"], "Input", AspectRatioFixed->True], Cell[TextData["Entropy = 1.7534 bits/pixel"], "Print", Evaluatable->False, AspectRatioFixed->True], Cell[OutputFormData["\<\ {56.11666666666666667*Second, Null}\ \>", "\<\ {56.1167 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Timing[out64=DCTCompress[shuttle,qLum];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {39.73333333333333333*Second, Null}\ \>", "\<\ {39.7333 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["{{39.73,56.11},{180.0,264.35},{716.55,1069.55}}"], "Input", AspectRatioFixed->True], Cell[TextData["SetOptions[ListPlot,PlotJoined->True];"], "Input", AspectRatioFixed->True], Cell[TextData[ "results=Transpose[{{39.73,56.11},{180.0,264.35},{716.55,1069.55}}];"], "Input", AspectRatioFixed->True], Cell[TextData[ "ListPlot[Transpose[{{64,128,256}^2,#}]\n\ ,FrameTicks->{{{64^2,\"64^2\"},{128^2,\"128^2\"},{256^2,\"256^2\"}},Automatic}\ \n,Frame->True\n,FrameLabel->{\"pixels\",\"seconds\"}\n\ ,PlotRange->{{0,270^2},{0,1100}}]& /@ Join[{-Subtract @@ results},results];"], "Input", AspectRatioFixed->True], Cell[TextData[ "Show[%48,Graphics[Text[\"E\",{230^2,400}],Text[\"C\",{230^2,620}],Text[\"E+C\ \",{230^2,850}]]];"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Poisson"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["in256 = Reverse[readHips[\"mandril256\"]];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[out256=DCTCompress[in256,qLum,True];]"], "Input", AspectRatioFixed->True], Cell[TextData["Entropy = 1.81462bits/pixel"], "Print", Evaluatable->False, AspectRatioFixed->True], Cell[OutputFormData["\<\ {503.65*Second, Null}\ \>", "\<\ {503.65 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Timing[out256=DCTCompress[in256,qLum];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {329.1166666666667*Second, Null}\ \>", "\<\ {329.117 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["in128=DownSample[in256,{2,2},{1,1}];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[out128=DCTCompress[in128,qLum,True];]"], "Input", AspectRatioFixed->True], Cell[TextData["Entropy = 1.98581bits/pixel"], "Print", Evaluatable->False, AspectRatioFixed->True], Cell[OutputFormData["\<\ {124.6166666666667*Second, Null}\ \>", "\<\ {124.617 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Timing[out128=DCTCompress[in128,qLum];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {83.2666666666667*Second, Null}\ \>", "\<\ {83.2667 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Timing[out64=DCTCompress[shuttle,qLum,True];]"], "Input", AspectRatioFixed->True], Cell[TextData["Entropy = 1.7534bits/pixel"], "Print", Evaluatable->False, AspectRatioFixed->True], Cell[OutputFormData["\<\ {29.78333333333333*Second, Null}\ \>", "\<\ {29.7833 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Timing[out64=DCTCompress[shuttle,qLum];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {21.08333333333333*Second, Null}\ \>", "\<\ {21.0833 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["SetOptions[ListPlot,PlotJoined->True];"], "Input", AspectRatioFixed->True], Cell[TextData[ "results=Transpose[{{21.08,29.78},{83.26,124.61},{329.17,503.65}}];"], "Input",\ AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Fit[Transpose[{{64,128,256}^2,results[[1]]}],{x},x]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0.005026649782509157*x\ \>", "\<\ 0.00502665 x\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData[ "all=ListPlot[Transpose[{{64,128,256}^2,#}]\n\ ,FrameTicks->{{{64^2,\"64^2\"},{128^2,\"128^2\"},{256^2,\"256^2\"}},Automatic}\ \n,Frame->True\n,FrameLabel->{\"pixels\",\"seconds\"}\n\ ,PlotRange->{{0,270^2},{0,600}}]& /@ Join[{-Subtract @@ results},results];"], "Input", AspectRatioFixed->True], Cell[TextData[ "Show[all,Graphics[Text[\"E\",{230^2,100}],Text[\"C\",{230^2,220}],Text[\"E+C\ \",{230^2,350}]]];"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Riemann"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "shuttle=Reverse[readImageRaw[\"011-0002 p.64x64\",64,64,3][[2]]];"], "Input",\ AspectRatioFixed->True], Cell[TextData["ShowImage[shuttle];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[IDCT[DCT[shuttle]];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {5.316666666666666*Second, Null}\ \>", "\<\ {5.31667 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["fusion"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[IDCT[DCT[shuttle]];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {2.550000000000004*Second, Null}\ \>", "\<\ {2.55 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[TextData["DCT Compression"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["PrintQM"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Useful for printing color quantization matrices."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "PrintQM[qm_,n_:3] := MatrixForm[\nIf[VectorQ[Flatten[qm],IntegerQ],qm,N[ \ qm,n]], \n TableDirections->{Column,Column,Row},\n TableSpacing->{2,1,1}]"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Quantization tables from JPEG"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Luminance"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "qLum={{16,11,10,16,24,40,51,61}\n ,{12,12,14,19,26,58,60,55}\n \ ,{14,13,16,24,40,57,69,56}\n ,{14,17,22,29,51,87,80,62}\n \ ,{18,22,37,56,68,109,103,77}\n ,{24,35,55,64,81,104,113,92}\n \ ,{49,64,78,87,103,121,120,101}\n ,{72,92,95,98,112,100,103,99}};"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Chrominance"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "qChrom={{17,18,24,47,99,99,99,99}\n ,{18,21,26,66,99,99,99,99}\n \ ,{24,26,56,99,99,99,99,99}\n ,{47,66,99,99,99,99,99,99}\n \ ,{99,99,99,99,99,99,99,99}\n ,{99,99,99,99,99,99,99,99}\n \ ,{99,99,99,99,99,99,99,99}\n ,{99,99,99,99,99,99,99,99} };"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["DCT Quantization"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "This is a general routine for doing an operation between an {8,8} matrix and \ each {8,8} block of an image."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "This version allows matrix to be of arbitrary dimensions. Took DCT out of \ name. Should be in ImageProcessing.m. Could also be more general, i.e. \ MapBlock[f,array, blocksize]"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "MapBlock[image_,matrix_,op_] :=\n UnBlockImage[\n Map[(# ~ op ~ matrix)& \ \n , BlockImage[image,Dimensions[matrix]] ,{2}] ]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "IDCTQ[image_,matrix_] := MapBlock[image,matrix,Times]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "DCTQ[image_,matrix_] :=\n Round[MapBlock[image,matrix,Divide]]"], "Input",\ InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "DCTQ[image_?(TensorRank[#[[1]]]==2&),matrix_] :=\n Round[MapThread[\n \ MapBlock[#1,#2,Divide]&,{image,matrix}]]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "IDCTQ[image_?(TensorRank[#[[1]]]==2&),matrix_] :=\n MapThread[\n \ MapBlock[#1,#2,Times]&,{image,matrix}]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "Note that this could be speeded by using a single routine that does forward \ and inverse together, but then cannot compute entropy."], "Text", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["DCT Compression"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Note that the nominal range of the image and matrix must be consistent. For \ example, the qLum matrix defined in a previous section assumes that \ greylevels are in the range {0,255}."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Following version not tested. Does dct of size specified by size of matrix. \ Seems to be much faster!? Maybe doesn't need to deal w/optional args...?"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCTCompress[image_,matrix_] :=\n IDCT[ IDCTQ[DCTQ[ \n \ DCT[image,Length[matrix]], matrix], matrix] \n ,Length[matrix]]"], "Input",\ InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "If the matrix assumes {0,255} but the image has some other range {0,max}, \ the following routine can be used."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCTCompress[image_,matrix_,max_] :=\nIDCT[ IDCTQ[ DCTQ[ DCT[image], matrix \ (max/255.)], matrix (255./max)] ]"], "Input", AspectRatioFixed->True], Cell[TextData[ "This version also computes the zero-order entropy of the quantized DCT \ coefficients. It returns {image,entropy}, and also prints the entropy. It \ takes much longer."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["not tested..."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCTCompress[image_,matrix_,True] := Module[{tmp,ent},\n tmp=DCTQ[ \ DCT[image,Length[matrix]], matrix];\n Print[\"Entropy = \ \",ent=entropy[Flatten[tmp]]];\n {IDCT[IDCTQ[ tmp, \ matrix],Length[matrix]],ent}]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["testing"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["test = Table[Random[Integer,{0,255}],{16},{32}];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData[ "Timing[out0 = DCTCompress[test,Table[.001,{8},{8}]];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {2.133333333333212*Second, Null}\ \>", "\<\ {2.13333 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["out0[[0]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ IDCT\ \>", "\<\ IDCT\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["?IDCT"], "Input", AspectRatioFixed->True], Cell[TextData[ "Global`IDCT\n\nIDCT[(array_)?MatrixQ] := \n Transpose[IDCT /@ \ Transpose[IDCT /@ array]]\n \nIDCT[(array_)?(Length[#1] > 8 & )] := \n \ Apply[Join, IDCT /@ Partition[array, 8]]\n \nIDCT[list_] := IDCTMatrix[8] . \ list"], "Print", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Max[Abs[out0-test]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ The Unformatted text for this cell was not generated. Use options in the Actions Preferences dialog box to control when Unformatted text is generated.\ \>", "\<\ -interrupted-\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["DCT YCbCr Compression"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["RGBToYBRSubDCT"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "This function takes an RGB image, converts to YCbCr, then block-averages \ each color channel by the entries in YBRSampling, then takes the DCT of each \ the three subimages."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "RGBToYBRSubDCT[in_,YBRSampling_:{1,2,2},nDCT_:8] :=\nDCT[#,nDCT]& /@\n \ MapThread[ If[#2 == 1,#1,BlockAverage[#1,#2,#2]]&,\n \ {RGBDToYCbCrD[in],YBRSampling}]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData["?RGBDToYCbCrD"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["YBRReconstructToRGB"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Takes a downsampled, quantized YCbCr DCT, and a quantization matrix, and \ sampling factors, and reconstructs a clipped integer RGBD image."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "YBRReconstructToRGB[ybrsq_,qm_,YBRSampling_,nDCT_:8] :=\n Clip[\n \ YCbCrDToRGBD[\n MapThread[\n PixRep[IDCT[IDCTQ[#1,#2],nDCT],#3 \ {1,1}]& \n , {ybrsq, qm, YBRSampling}]]\n ,0,255,True]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "ShowImage[YBRReconstructToRGB[tmpq,Qnew,{1,2,2}]/255.]\n"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["DCTCompress"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCTCompress[image_?(TensorRank[#]==3&&Length[#]==3&)\n , matrix_, \ YBRSampling_:{1,2,2},nDCT_:8] :=\n YBRReconstructToRGB[\n DCTQ[\n \ RGBToYBRSubDCT[image,YBRSampling,nDCT]\n ,matrix]\n \ ,matrix,YBRSampling,nDCT]"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Compression Examples"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["color image w/downsampling"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "in = Reverse /@ ", StyleBox["ReadByteImage", FontWeight->"Plain"], "[\"011-0002 p.64x64\",64,64,3];" }], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[in/255.];"], "Input", AspectRatioFixed->True], Cell[TextData["r9 = DCTCompress[in,{qLum,qChrom,qChrom},{1,2,2},8];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[r9/255.];"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Mandril image (256^2)"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["<True], Cell[TextData["in=Reverse[readHips[\"apehips\"]];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Dimensions[in]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {256, 256}\ \>", "\<\ {256, 256}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["ShowImage[in];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[ShowImage[DCTCompress[in,qLum]];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {347.7833333333334*Second, Null}\ \>", "\<\ {347.783 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Lena (512^2)"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["in=Reverse[readHips[\"/usr1/images/ipi/5.2.4\"]];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Dimensions[in]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {512, 512}\ \>", "\<\ {512, 512}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["ShowImage[in];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["MemoryInUse[] 10.^-6"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 10.074344\ \>", "\<\ 10.0743\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Timing[out=DCTCompress[in,qLum,True];]"], "Input", AspectRatioFixed->True], Cell[TextData["Entropy = 1.04666"], "Print", Evaluatable->False, AspectRatioFixed->True], Cell[OutputFormData["\<\ {2187.4*Second, Null}\ \>", "\<\ {2187.4 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["ShowImage[ out[[1]] ];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["MemoryInUse[] 10.^-6"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 19.527664\ \>", "\<\ 19.5277\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Albert's Image"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["in=Reverse[readHips[\"/u/ahumada/dctoil/line2.b\"]];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["{Max[in],Min[in]}"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {255, 0}\ \>", "\<\ {255, 0}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Timing[entropy[ Flatten[in] ]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {96.35*Second, 5.832999248205582}\ \>", "\<\ {96.35 Second, 5.833}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["ShowImage[in];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[ShowImage[DCTCompress[in,qLum]];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {87.1833333333333*Second, Null}\ \>", "\<\ {87.1833 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Timing[ShowImage[DCTCompress[in,qLum,True][[1]]];]"], "Input", AspectRatioFixed->True], Cell[TextData["Entropy = 1.7446"], "Print", Evaluatable->False, AspectRatioFixed->True], Cell[OutputFormData["\<\ {137.0166666666667*Second, Null}\ \>", "\<\ {137.017 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData[ "\nq0gMat=ReadList[\"/u/ahumada/dctfoil/q0g.mat\",Table[Number,{8}]];"], "Input", AspectRatioFixed->True], Cell[TextData["q0gMat //MatrixForm"], "Input", AspectRatioFixed->True], Cell[TextData[ "\nd4g=ReadList[\"/u/ahumada/dctfoil/d4g.qm\",Table[Number,{8}]];"], "Input", AspectRatioFixed->True], Cell[TextData["d4g //MatrixForm"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["ShowImage[out=DCTCompress[in,d4g]];"], "Input", AspectRatioFixed->True], Cell[TextData["Entropy = 0.566832"], "Print", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["ShowImage[out=DCTCompress[in,q0gMat],{0,255}];"], "Input", AspectRatioFixed->True], Cell[TextData["Entropy = 1.53557"], "Print", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["Show[GraphicsArray[{%38,%77}]];"], "Input", AspectRatioFixed->True] }, Closed]], Cell[TextData["color image using apw93"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["matrix"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "rgbMat = {{{47.34703278942936, 51.85244657179565, 52.68301344354809, \n \ 68.91127181749606, 93.6334531932738, 126.9147790898975, \n \ 169.869007685313, 224.0080010231241}, \n {51.85244657179565, \ 55.58477585334997, 51.99688378077247, \n 59.28101485297699, \ 75.08577201596295, 97.9341078259859, \n 128.087328661652, \ 166.4088036710763}, \n {52.68301344354809, 51.99688378077247, \ 74.69417805213519, \n 86.6881611563069, 101.1181996407677, \ 122.7656337308096, \n 152.474486643299, 190.9584684517256}, \n \ {68.91127181749606, 59.28101485297699, 86.6881611563069, \n \ 115.0636471559956, 138.109273317091, 162.5462739605834, \n \ 193.3657474887313, 232.8383478908609}, \n {93.6334531932738, \ 75.08577201596295, 101.1181996407677, \n 138.109273317091, \ 175.5806783858476, 210.7589092659302, \n 247.8585086581001, \ 291.2907481464824}, \n {126.9147790898975, 97.9341078259859, \ 122.7656337308096, \n 162.5462739605834, 210.7589092659302, \ 260.40508482598, \n 310.0656037669587, 362.7855344053999}, \n \ {169.869007685313, 128.087328661652, 152.474486643299, \n \ 193.3657474887313, 247.8585086581001, 310.0656037669587, \n \ 375.1384315620521, 442.3263630983978}, \n {224.0080010231241, \ 166.4088036710763, 190.9584684517256, \n 232.8383478908609, \ 291.2907481464824, 362.7855344053999, \n 442.3263630983978, \ 526.4364454621491}}, \n {{18.78967474036409, 14.13868534578891, \ 14.36515727594334, \n 18.79014112972774, 25.53117586662616, \ 34.60604553726905, \n 46.31844027530264, 61.08060179995153}, \n \ {14.13868534578891, 15.15638523861276, 14.17806925889163, \n \ 16.16424433945962, 20.4737514749553, 26.7038418959645, \n \ 34.92576640954114, 45.37494119234636}, \n {14.36515727594334, \ 14.17806925889163, 20.36697495419451, \n 23.63739254033078, \ 27.57205304621307, 33.47469177163992, \n 41.57544980882168, \ 52.06893556728096}, \n {18.79014112972774, 16.16424433945962, \ 23.63739254033078, \n 31.37457939665281, 37.65846527727858, \ 44.32173935085167, \n 52.72533199780638, 63.48838588944929}, \n \ {25.53117586662616, 20.4737514749553, 27.57205304621307, \n \ 37.65846527727858, 47.87585019851245, 57.46795183148615, \n \ 67.58395593429018, 79.42669062837889}, \n {34.60604553726905, \ 26.7038418959645, 33.47469177163992, \n 44.32173935085167, \ 57.46795183148615, 71.00504991023224, \n 84.5460590204369, \ 98.9212825639713}, \n {46.31844027530264, 34.92576640954114, \ 41.57544980882168, \n 52.72533199780638, 67.58395593429018, \ 84.5460590204369, \n 102.2895657898162, 120.6098011081533}, \n \ {61.08060179995153, 45.37494119234636, 52.06893556728096, \n \ 63.48838588944929, 79.42669062837889, 98.9212825639713, \n \ 120.6098011081533, 143.5442249892498}}, \n {{54.81378965714482, \ 94.0248997626975, 150.6616709498381, \n 197.0708712482338, \ 267.7707973181573, 362.9479681606033, \n 485.787483813616, \ 640.6129326000067}, \n {94.0248997626975, 158.9600643936497, \ 148.6994931106225, \n 169.5304837283463, 214.7285649976231, \ 280.0697105881218, \n 366.3011984753678, 475.8920719049778}, \n \ {150.6616709498381, 148.6994931106225, 213.6086935804844, \n \ 247.908810785339, 289.175503175077, 351.082337628975, 436.0430323431223, \n \ 546.0986389813714}, {197.0708712482338, 169.5304837283463, \n \ 247.908810785339, 329.0563734491145, 394.9617254509778, \n \ 464.846098217466, 552.9829202411447, 665.8657556106997}, \n \ {267.7707973181573, 214.7285649976231, 289.175503175077, \n \ 394.9617254509778, 502.1215884027522, 602.7234845173623, \n \ 708.820066141025, 833.026586358873}, \n {362.9479681606033, \ 280.0697105881218, 351.082337628975, \n 464.846098217466, \ 602.7234845173623, 744.7004762883623, \n 886.718486930467, \ 1037.485732825734}, \n {485.787483813616, 366.3011984753678, \ 436.0430323431223, \n 552.9829202411447, 708.820066141025, \ 886.718486930467, 1072.81226418839, \n 1264.954766510812}, \ {640.6129326000067, 475.8920719049778, \n 546.0986389813714, \ 665.8657556106997, 833.026586358873, \n 1037.485732825734, \ 1264.954766510812, 1505.490846821215}}};"], "Input", AspectRatioFixed->True], Cell[TextData[ "in = Reverse /@ readImageRaw[\"011-0002 p.252x176\",252,176,3];"], "Input", AspectRatioFixed->True], Cell[TextData["in=cutImage[#,{1,5},{176,248}]& /@ in;"], "Input", AspectRatioFixed->True], Cell[TextData["in=cutImage[#,{100,75},{32,32}]& /@ in;"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImageRGB[in/255.];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[out=MapThread[DCTCompress,{in,rgbMat}];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {10.61666666666667*Second, Null}\ \>", "\<\ {10.6167 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["ShowImageRGB[out/255.];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImageRGB[in/255.];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[out=MapThread[DCTCompress,{in,rgbMat}];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {427.1666666666667*Second, Null}\ \>", "\<\ {427.167 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["ShowImageRGB[out/255.];"], "Input", AspectRatioFixed->True], Cell[TextData["showMatrix[rgbMat[[1]]]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData[ "Timing[MapThread[bits[DCTQ[DCT[#1-128],#2]]&,{in,rgbMat}]];"], "Input", AspectRatioFixed->True], Cell[TextData[ "ac bits = 11072\ndc bits = 3304\nov bits = 2464\nac bits = 33616\ndc bits = \ 4248\nov bits = 2464\nac bits = 6888\ndc bits = 3352\nov bits = 2464"], "Print", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["%80"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {485.0666666666668*Second, {16840, 40328, 12704}}\ \>", "\<\ {485.067 Second, {16840, 40328, 12704}}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["(Plus @@ %80[[2]] ) / (176 248.)"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1.600806451612903\ \>", "\<\ 1.60081\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["color image using QuantizationMatrix"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["<True], Cell[CellGroupData[{ Cell[TextData["qm=QuantizationMatrix[YCbCrToXYZ,35.7,35.7,40.];"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ $Aborted\ \>", "\<\ $Aborted\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["matrix"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "in = Reverse /@ ", StyleBox["ReadByteImage", FontWeight->"Plain"], "[\"011-0002 p.64x64\",64,64,3];" }], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[in/255.];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[in[[3]]];"], "Input", AspectRatioFixed->True], Cell[TextData["Transform to YCrCb..."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Dimensions[inybr=RGBToYCbCr[in]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {3, 128, 192}\ \>", "\<\ {3, 128, 192}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Dimensions[tst=YCbCrToRGB[inybr]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {3, 128, 192}\ \>", "\<\ {3, 128, 192}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["ShowImage[inybr[[1]]]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["{Max[#],Min[#]}& /@ inybr"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {{255., 0.3}, {27.65, -86.2}, {84.875, -39.25}}\ \>", "\<\ {{255., 0.3}, {27.65, -86.2}, {84.875, -39.25}}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["ShowImage[inybr[[2]]];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[inybr[[3]]];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[outybr=MapThread[DCTCompress,{inybr,qm}];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {198.45*Second, Null}\ \>", "\<\ {198.45 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["out=YCbCrToRGB[outybr];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImageRGB[out/255.];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[out[[2]],{0,255}];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[in[[2]],{0,255}];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImageRGB[in/255.];"], "Input", AspectRatioFixed->True] }, Closed]] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[TextData["DCT stimuli"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["DCTImage"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCTImage[imageSize_:32,freq_:{1,5},mean_:0.,amp_:1,zoom_:1,nDCT_:8] :=\n \ PasteImage[ Table[mean,{imageSize},{imageSize}],\n mean + PixRep[(amp \ DCTTensorNorm[nDCT][[##]])& @@ (freq+1), {zoom,zoom}]\n , Round[(imageSize - \ nDCT zoom)/2+1] {1,1} ]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData["ShowImage[in = DCTImage[32,{0,7},.5,.5,2,8],{0,1}];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[in = DCTImage[8,{0,7},0,1,1,8],{-1,1}];"], "Input", AspectRatioFixed->True], Cell[TextData[ "ShowImage[in = DCTImage[8,{0,7},0,1,1,8];\nin = \ UnBlockImage[{{in,in},{in,in}}],{-1,1}];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[DCT[in]];"], "Input", AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Error Images"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["<< noise"], "Input", AspectRatioFixed->True], Cell[TextData["Clear[errorImage]"], "Input", AspectRatioFixed->True], Cell[TextData["aNoise[UniformDistribution,2 {-.5,.5}\n ,{1,1} 1]"], "Input", AspectRatioFixed->True], Cell[TextData[ "errorImage[imageSize_:32,errorSize_:16,freq_:{1,5},binWidth_:1024] := 128. + \ \n pasteImage[ Table[0,{imageSize},{imageSize}],\n IDCT[upSample[\n \ aNoise[UniformDistribution,binWidth {-.5,.5}\n ,{1,1} errorSize/8], \ {8,8},freq] ] \n , (imageSize - errorSize)/2+1 {1,1} ]"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[abc=errorImage[32,16,{1,8}],{0,255}];"], "Input", AspectRatioFixed->True], Cell[TextData[ "Timing[ShowImage[abc=errorImage[128,64,{8,8},1000],{0,255}]];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["error summation experiment"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "ShowImage[#,{0,255}]& /@ (abc= errorImage[64,48,{1,#}]& /@ {2,4,6,8});"], "Input", AspectRatioFixed->True], Cell[TextData[ "ShowImage[def= 128. + .5 (Plus @@ (abc-128.)),{0,255}];"], "Input", AspectRatioFixed->True], Cell[TextData[ "Show[GraphicsArray[Partition[graphicsImage /@ abc,2]]]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Min[def]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 41.27321096847998912\ \>", "\<\ 41.2732\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Max[def]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 214.7267890315200109\ \>", "\<\ 214.727\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Grating Images (replicated basis functions)"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "This function creates an image consisting of replicated DCT basis functions \ of a selected frequency. The odd functions are reflected in alternate rows \ and/or columns to avoid large discontinuities."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCTGratImage[imageSize_:32,errorSize_:16,freq_:{1,5},binWidth_:512] := 128. \ + \n pasteImage[ Table[0,{imageSize},{imageSize}],\n IDCT[upSample[\n \ binWidth signs[freq,errorSize/8]\n , {8,8},freq] ] \n , (imageSize - \ errorSize)/2+1 {1,1} ]"], "Input", AspectRatioFixed->True], Cell[TextData[ "signs[freq_,size_] := Outer[Times,##]& @@\n (Table[(2 \ Mod[#,2]-1)^k,{k,size}]& /@ freq)"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[DCTGratImage[16,16,{1,2},512],{0,255}]"], "Input", AspectRatioFixed->True], Cell[TextData[ "Show[GraphicsArray[\n Reverse[\n Table[graphicsImage[\n \ DCTGratImage[16,16,{u,v},512]\n ,{0,255}],{u,8},{v,8}]]\n ]];"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["pixel size"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Viewing distance should be"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData[ "width=4 cm;\ndeg=2;\nv = width / Tan[deg Degree] //N"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 114.5450131316624*cm\ \>", "\<\ 114.545 cm\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["Then the pixels/deg is"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["size=64 pixels;\nsize/deg //N"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 32.*pixels\ \>", "\<\ 32. pixels\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["Clear[pxDeg]"], "Input", AspectRatioFixed->True], Cell[TextData[ "pxDeg[sizepx_:64,sizecm_:4,viewcm_:114] :=\n sizepx / (ArcTan[sizecm/viewcm] \ /Degree ) //N"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["pxDeg[256,16]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 32.04274996946374\ \>", "\<\ 32.0427\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["pxDeg[256,8,57]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 32.04274996946374\ \>", "\<\ 32.0427\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData[" ArcTan[4/114] /Degree //N"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 2.009553813021139\ \>", "\<\ 2.00955\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Entropy Coding"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "The following functions are used to convert, losslessly, between quantized \ DCT coefficients and a bitstream as specified by JPEG. They are introduced \ approximately in the order they are applied"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["diffCat"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Converts a DCT AC coefficient value into a category number. (F.1.2.2.1)"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["diffCat[0] := 0"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData["diffCat[x_] := 1+Floor[N[Log[2,Abs[x]]]]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData["test"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["zigzag"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Converts one 8x8 block into a one-dimensional list, using a zig-zag scanning \ order."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Derivation"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "This is the (unpacked) matrix describing the ordering of DCT coefficients \ given in Table 5.4.2.1 of JPEG, with 1 added so that indices start at 1."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "order = {1, 2, 6, 7, 15, 16, 28, 29, 3, 5, 8, 14, 17, 27, 30, 43, 4, 9, 13, \ 18, 26, 31, 42, 44, 10, 12, 19, 25, 32, 41, 45, 54, 11, 20, 24,33, 40, 46, \ 53, 55, 21, 23, 34, 39, 47, 52, 56, 61, 22, 35, 38, 48, 51, 57, 60, 62, 36, \ 37, 49, 50, 58, 59, 63, 64};"], "Input", AspectRatioFixed->True], Cell[TextData["This yields the sequence of indeices:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Flatten[Table[Position[order,i],{i,64}]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {1, 2, 9, 17, 10, 3, 4, 11, 18, 25, 33, 26, 19, 12, 5, 6, 13, 20, 27, 34, 41, 49, 42, 35, 28, 21, 14, 7, 8, 15, 22, 29, 36, 43, 50, 57, 58, 51, 44, 37, 30, 23, 16, 24, 31, 38, 45, 52, 59, 60, 53, 46, 39, 32, 40, 47, 54, 61, 62, 55, 48, 56, 63, 64}\ \>", "\<\ {1, 2, 9, 17, 10, 3, 4, 11, 18, 25, 33, 26, 19, 12, 5, 6, 13, 20, 27, 34, 41, 49, 42, 35, 28, 21, 14, 7, 8, 15, 22, 29, 36, 43, 50, 57, 58, 51, 44, 37, 30, 23, 16, 24, 31, 38, 45, 52, 59, 60, 53, 46, 39, 32, 40, 47, 54, 61, 62, 55, 48, 56, 63, 64}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData[ "zigzag[matrix_] := Part[Flatten[matrix],\n{1, 2, 9, 17, 10, 3, 4, 11, 18, \ 25, 33, 26, 19, 12, 5, 6, 13, 20, 27, 34, 41, 49, 42, 35, 28, 21, 14, 7, 8, \ 15, 22, 29, 36, 43, 50, 57, 58, 51, 44, 37, 30, 23, 16, 24, 31, 38, 45, 52, \ 59, 60, 53, 46, 39, 32, 40, 47, 54, 61, 62, 55, 48, 56, 63, 64}]"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["testing"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["(test=Table[(i-1) 8 + j,{i,8},{j,8}])//MatrixForm"], "Input", AspectRatioFixed->True], Cell[TextData["zigzag[test]"], "Input", AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["zeroRun"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Detects runs of zeros in a list. Returns a list of pairs {value,run} where \ run is the number of zeros that precede value. This is loosely derived from \ Joe Wald and Bill McGregor via Ilan Vardi, Mathematica Journal, 1991, 1(3), \ p. 54."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["SetAttributes[times,Flat];"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData["times[{0,a_},{c_,b_}] := times[{c,a+b}]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "zeroRun[list_] :=\n-{0,1}+#& /@ (List @@ times @@ ({#,1}& /@ list))"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["testing"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["test = Join[{1,2,0,0,0,3,3},Table[0,{16}],{4}]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {1, 2, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}\ \ \>", "\<\ {1, 2, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 4}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["zeroRun[test]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {{1, 0}, {2, 0}, {3, 3}, {3, 0}, {4, 16}}\ \>", "\<\ {{1, 0}, {2, 0}, {3, 3}, {3, 0}, {4, 16}}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["test = Table[Random[Integer,{0,1}],{64}]"], "Input", AspectRatioFixed->True], Cell[TextData["zeroRun[test]"], "Input", AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["eob"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "This replaces the last element of the list with the special symbol {0,0} \ when all remaining elements are zero."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "eob[list_] := If[ Last[ list ][[1]] == 0\n ,ReplacePart[list,{0,0},-1]\n \ ,list]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["old"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "eob[list_] := ReplacePart[list,{0,0},-1] /; Last[list][[1]] ==0"], "Input", AspectRatioFixed->True], Cell[TextData["3/15/93 don't think we need this following case."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["eob[list_] := Append[list,{0,0}]"], "Input", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["eob[{{1,2},{1,2},{0,2},{1,1}}]"], "Input", AspectRatioFixed->True] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["zrl"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Not sure why, but this fails when Module is used. Appears not to localize \ value of \"a\"."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Clear[zrl]"], "Input", AspectRatioFixed->True], Cell[TextData["3/15/93 changed 16 to 15."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "zrl[list_] := Block[{a,x},\n Partition[Flatten[list //. ({a_,x_} /; x>16 -> \ {{0,16},{a,x-16}})],2]]"], "Input", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "zrl[list_] := Block[{a,x},\n Partition[Flatten[list //. ({a_,x_} /; x>15 -> \ {{0,15},{a,x-15}})],2]]"], "Input", AspectRatioFixed->True], Cell[TextData["3/18/93 changed from above"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "zrl[list_] := Block[{a,x},\n Partition[Flatten[list //. ({a_,x_} /; x>15 -> \ {{0,15},{a,x-16}})],2]]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["zrl[{{1,2},{1,34}}]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {{1, 2}, {0, 15}, {0, 15}, {1, 2}}\ \>", "\<\ {{1, 2}, {0, 15}, {0, 15}, {1, 2}}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["CatRunToBits"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Converts the list of {category,runLength} pairs to a list of code lengths in \ bits."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "catRunToBits[list_] := huffCodeSizeAC[[(#[[2]] 10 + #[[1]] + 1)]]+#[[1]]& /@ \ list"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["catRunToBits[{{8,7},{1,1},{0,0},{0,15}}]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {24, 5, 4, 16}\ \>", "\<\ {24, 5, 4, 16}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["CatRunToBits[{{8,7},{1,1},{0,0},{0,15}}]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {24, 5, 4, 11}\ \>", "\<\ {24, 5, 4, 11}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["Clear[test]"], "Input", AspectRatioFixed->True], Cell[TextData[ "test[run_,size_] := huffCodeSizeAC[[(size 10 + run + 1)]]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["test[14,1]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 12\ \>", "\<\ 12\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["new"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "CatRunToBits[list_] := (HuffCodeSizeAC[[#[[2]]+1,#[[1]]+1]] + #[[1]])& /@ \ list"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData[StyleBox["HuffCodeSizeAC", FontFamily->"Courier", FontSize->12]], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["This is taken from JPEG Table 13.3.2.1. (K.3.2)"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "huffCodeSizeAC=\n{4,2,2,3,4,5,7,8,10,16,16,\n4,5,7,9,11,16,16,16,16,16,\n\ 5,8,10,12,16,16,16,16,16,16,\n6,9,12,16,16,16,16,16,16,16,\n\ 6,10,16,16,16,16,16,16,16,16,\n7,11,16,16,16,16,16,16,16,16,\n\ 7,12,16,16,16,16,16,16,16,16,\n8,12,16,16,16,16,16,16,16,16,\n\ 9,15,16,16,16,16,16,16,16,16,\n9,16,16,16,16,16,16,16,16,16,\n\ 9,16,16,16,16,16,16,16,16,16,\n10,16,16,16,16,16,16,16,16,16,\n\ 10,16,16,16,16,16,16,16,16,16,\n11,16,16,16,16,16,16,16,16,16,\n\ 16,16,16,16,16,16,16,16,16,16,\n11,16,16,16,16,16,16,16,16,16,16};"], "Input",\ InitializationCell->True, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["new"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "HuffCodeSizeAC = {\n{4,2,2,3,4,5,7,8,10,16,16},\n\ {0,4,5,7,9,11,16,16,16,16,16},\n{0,5,8,10,12,16,16,16,16,16,16},\n\ {0,6,9,12,16,16,16,16,16,16,16},\n{0,6,10,16,16,16,16,16,16,16,16},\n\ {0,7,11,16,16,16,16,16,16,16,16},\n{0,7,12,16,16,16,16,16,16,16,16},\n\ {0,8,12,16,16,16,16,16,16,16,16},\n{0,9,15,16,16,16,16,16,16,16,16},\n\ {0,9,16,16,16,16,16,16,16,16,16},\n{0,9,16,16,16,16,16,16,16,16,16},\n\ {0,10,16,16,16,16,16,16,16,16,16},\n{0,10,16,16,16,16,16,16,16,16,16},\n\ {0,11,16,16,16,16,16,16,16,16,16},\n{0,16,16,16,16,16,16,16,16,16,16},\n\ {11,16,16,16,16,16,16,16,16,16,16}};"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Length /@ HuffCodeSizeAC"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11}\ \>", "\<\ {11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Huffman DC code size table"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["huffCodeSizeDC={2,3,3,3,3,3,4,5,6,7,8,9};"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["BlockToBitCountAC"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Converts a block of DCT coefficients to a to number of bits."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "blockToBitCountAC[block_] :=\n Plus @@ catRunToBits[\n zrl[\n eob[\n \ zeroRun[\n Drop[\n zigzag[block],1] ] ] ] ]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "BlockToBitCountAC[block_] :=\n Plus @@ CatRunToBits[\n zrl[\n eob[\n \ zeroRun[\n Drop[\n zigzag[block],1] ] ] ] ]"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["BitsAC"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "bitsAC[dct_] := \n 8 Ceiling[0.125 *\n Plus @@ blockToBitCountAC /@\n \ Flatten[Partition[\n Map[diffCat,dct,{2}], {8, 8}],1] ]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "BitsAC[dct_] := \n 8 Ceiling[0.125 *\n Plus @@ BlockToBitCountAC /@\n \ Flatten[Partition[\n Map[diffCat,dct,{2}], {8, 8}],1] ]"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["bitsDC"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Revised 7/16/92 to subtract 1024 (equivalent to subtracting 128 from \ image)."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "bitsDC[dct_] :=\n 8 Ceiling[0.125 *\n Plus @@\n ((huffCodeSizeDC[[#+1]] + \ #)& /@\n diffCat /@\n Flatten @\n (dpcm /@ \n \ (DownSample[dct,{8,8},{1,1}]-1024)))]"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["bitsOverhead"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "bitsOverhead[] :=\n 8 * (\n 16 + (* DC code lengths *)\n 12 + (* DC \ codes *)\n 16 + (* AC code lengths *)\n 162 + (* AC Codes *)\n 64 + \ (* luminance quantization matrix *)\n 2\t+ (* FF SOI *)\n 5 + \ (* FF DQT length PmNm *)\n 0 + (* FF DRI *)\n 13 + (* FF SOF \ length parameters *)\n 6 + (* FF DHT length id0 id1 *)\n 10 + (* \ FF SOS length parameters *)\n 2 (* FF EOI *)\n )"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["bitsOverhead[]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 2464\ \>", "\<\ 2464\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["bitsOverhead[] / 256 / 256."], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0.03759765625\ \>", "\<\ 0.0375977\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["bits"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "bits[dct_] :=\n bitsAC[dct] + bitsDC[dct] + bitsOverhead[]"], "Input", AspectRatioFixed->True], Cell[TextData[ "bits[dct_] := Module[{ac,dc,ov},\n Print[\"ac bits = \",ac=bitsAC[dct]];\n \ Print[\"dc bits = \",dc=bitsDC[dct]];\n Print[\"ov bits = \ \",ov=bitsOverhead[]];\n ac + dc + ov ]"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["BitsPerPixel"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "BitsPerPixel[dct_,overhead_:False] := N[(BitsAC[dct] + bitsDC[dct] + \ If[overhead,bitsOverhead[],0])/ \n (Times @@ Dimensions[dct])]"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["dpcm"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "dpcm[list_] := ReplacePart[list-RotateRight[list],list[[1]],1]"], "Input", InitializationCell->True, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["testing"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "in = Reverse[", StyleBox["ReadByteImage", FontWeight->"Plain"], "[\"011-0002 p.64x64\",64,64,3][[2]]];" }], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[in]"], "Input", AspectRatioFixed->True], Cell[TextData["dctq = DCTQ[DCT[in],qLum];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["bitsAC[dctq]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 5056\ \>", "\<\ 5056\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["BitsAC[dctq]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 5056\ \>", "\<\ 5056\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["BitsPerPixel[dctq] "], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1.365234375\ \>", "\<\ 1.36523\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["BitsPerPixel[dctq] "], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1.365234375\ \>", "\<\ 1.36523\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["step by step (large)"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Map[diffCat,tmp1,{2}]"], "Input", AspectRatioFixed->True], Cell[TextData["Flatten[Partition[ %, {8, 8}],1];"], "Input", AspectRatioFixed->True], Cell[TextData["zigzag /@ %"], "Input", AspectRatioFixed->True], Cell[TextData["zeroRun[Drop[#,1]]& /@ %"], "Input", AspectRatioFixed->True], Cell[TextData["eob /@ %"], "Input", AspectRatioFixed->True], Cell[TextData["zrl /@ %109"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["step by step (small)"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["tmp0=DCTQ[DCT[test8-128],aja];"], "Input", AspectRatioFixed->True], Cell[TextData["showMatrix[tmp0]"], "Input", AspectRatioFixed->True], Cell[TextData["tmp2=zigzag[tmp1]"], "Input", AspectRatioFixed->True], Cell[TextData["tmp3=zeroRun[Drop[tmp2,1]]"], "Input", AspectRatioFixed->True], Cell[TextData["tmp4=eob[tmp3]"], "Input", AspectRatioFixed->True], Cell[TextData["tmp5 = zrl[tmp4]"], "Input", AspectRatioFixed->True], Cell[TextData["tmp6 = catRunToBits[tmp5]"], "Input", AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Miscellany"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["cjpeg file sizes"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["!ls -l ~/images/*jpeg.*"], "Input", AspectRatioFixed->True], Cell[TextData[ "These are bytecounts for {cjpeg,heidi,beau} for lena and mandril."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["dpcm /@ {{7696,7583,0},{12273,12133,12129}}"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {{7696, -113, -7583}, {12273, -140, -4}}\ \>", "\<\ {{7696, -113, -7583}, {12273, -140, -4}}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["in=Reverse[readHips[\"mandril256\"]];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[DCTMandril=DCTQ[DCT[in],qLum];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {193.*Second, Null}\ \>", "\<\ {193. Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Timing[bits[DCTMandril]]"], "Input", AspectRatioFixed->True], Cell[TextData["ac bits = 88032\ndc bits = 6536\nov bits = 2464"], "Print", Evaluatable->False, AspectRatioFixed->True], Cell[OutputFormData["\<\ {230.7833333333333*Second, 97032}\ \>", "\<\ {230.783 Second, 97032}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["%[[2]]/8"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 12129\ \>", "\<\ 12129\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["%58[[2]] /(256 256.)"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1.4805908203125\ \>", "\<\ 1.48059\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["out=IDCT[ IDCTQ[DCTMandril, qLum] ];"], "Input", AspectRatioFixed->True], Cell[TextData["out=Map[clipC[#,0,255]& ,Round[out] ,{-1}];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["{Min[out],Max[out]}"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {0., 253.}\ \>", "\<\ {0., 253.}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["ShowImage[out];"], "Input", AspectRatioFixed->True], Cell[TextData[{ StyleBox["writeByteImage[", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], "\"mandril256.rec\",out];" }], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["entropy[Flatten[DCTMandril]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1.770400660591724\ \>", "\<\ 1.7704\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[TextData["in=Reverse[readHips[\"lena256\"]];"], "Input", AspectRatioFixed->True], Cell[TextData["Timing[DCTLena=DCTQ[DCT[in-128],qLum];]"], "Input", AspectRatioFixed->True], Cell[TextData["Timing[bits[DCTLena]]"], "Input", AspectRatioFixed->True], Cell[TextData["entropy[Flatten[DCTLena]]"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Hadamard"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Thaar = {\n{+1,+1,+1,+1,+1,+1,+1,+1},\n{+1,+1,+1,+1,-1,-1,-1,-1},\n\ {+1,+1,-1,-1,-1,-1,+1,+1},\n{+1,+1,-1,-1,+1,+1,-1,-1},\n\ {+1,-1,-1,+1,+1,-1,-1,+1},\n{+1,-1,-1,+1,-1,+1,+1,-1},\n\ {+1,-1,+1,-1,-1,+1,-1,+1},\n{+1,-1,+1,-1,+1,-1,+1,-1}\n};"], "Input", AspectRatioFixed->True], Cell[TextData[ "Tict = {\n{+1,+1,+1,+1,+1,+1,+1,+1},\n{+5,+3,+2,+1,-1,-2,-3,-5},\n\ {+3,+1,-1,-3,-3,-1,+1,+3},\n{+3,-1,-5,-2,+2,+5,+1,-3},\n\ {+1,-1,-1,+1,+1,-1,-1,+1},\n{+2,-5,+1,+3,-3,-1,+5,-2},\n\ {+1,-3,+3,-1,-1,+3,-3,+1},\n{+1,-2,+3,-5,+5,-3,+2,-1}\n};\n"], "Input", AspectRatioFixed->True], Cell[TextData["N[ThaarNorm = Thaar/Sqrt[8.],3]//TableForm"], "Input", AspectRatioFixed->True], Cell[TextData[ "N[TictNorm = Tict/Sqrt[Plus @@ ((#^2)& /@ Tict)],3]//TableForm"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Plus @@ ((#^2)& /@ Tict)"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {51^(1/2), 51^(1/2), 51^(1/2), 51^(1/2), 51^(1/2), 51^(1/2), 51^(1/2), \ 51^(1/2)}\ \>", "\<\ {Sqrt[51], Sqrt[51], Sqrt[51], Sqrt[51], Sqrt[51], Sqrt[51], Sqrt[51], \ Sqrt[51]}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["((#^2)& /@ Tict)//TableForm"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData[ "Tictmags=Sqrt[Plus @@ Transpose[((#^2)& /@ Tict)]]//N"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {2.82842712474619, 8.83176086632785, 6.324555320336759, \ 8.83176086632785, 2.82842712474619, 8.83176086632785, 6.324555320336759, 8.83176086632785}\ \>", "\<\ {2.82843, 8.83176, 6.32456, 8.83176, 2.82843, 8.83176, 6.32456, 8.83176}\ \ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["TictNorm = Table[Tict[[i]]/Tictmags[[i]],{i,8}]"], "Input", AspectRatioFixed->True], Cell[TextData["Chop[TictNorm . Transpose[TictNorm]]"], "Input", AspectRatioFixed->True], Cell[TextData["test = Table[Thaar[[2]],{8}]"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[test];"], "Input", AspectRatioFixed->True], Cell[TextData["DCT[test]"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[%]"], "Input", AspectRatioFixed->True], Cell[TextData["<True], Cell[CellGroupData[{ Cell[TextData["in=Reverse[readHips2[\"galileo/r.12.hips\"]];"], "Input", AspectRatioFixed->True], Cell["", "Print", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData[{ "in2=", StyleBox["DownSample[in,{4,4},{1,1}];", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]] }], "Input", AspectRatioFixed->True], Cell[TextData["in3=DownSample[in2,{5,5},{1,1}];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[in3];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[out=DCT[in3];]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {1.050000000000001*Second, Null}\ \>", "\<\ {1.05 Second, Null}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["ShowImage[out]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["uni=Table[1,{8},{8}];"], "Input", AspectRatioFixed->True], Cell[TextData["Entropy = 0.943896"], "Print", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData[ "albert[image_] :=\nTable[\n(result=DCTCompress[image,2^scale uni,True];\n\ ShowImage[result[[1]],{0,255},PlotLabel->ToString[2^scale]];\n{8/result[[2]],\ \nSqrt[(Plus @@ Flatten[(image-result[[1]])^2])/(Times @@ \ Dimensions[image])]}\n)\n,{scale,3,5}]"], "Input", AspectRatioFixed->True], Cell[TextData["DCT[list_] := ThaarNorm . list"], "Input", AspectRatioFixed->True], Cell[TextData["IDCT[list_] := Transpose[ThaarNorm] . list"], "Input", AspectRatioFixed->True], Cell[TextData["DCT[list_] := TictNorm . list"], "Input", AspectRatioFixed->True], Cell[TextData["IDCT[list_] := Transpose[TictNorm] . list"], "Input", AspectRatioFixed->True], Cell[TextData["albert[in3]"], "Input", AspectRatioFixed->True], Cell[TextData["albert[in3]"], "Input", AspectRatioFixed->True], Cell[TextData[ "ListPlot[%158,PlotJoined->True,PlotRange->{{0,8},{1,6}}]"], "Input", AspectRatioFixed->True], Cell[TextData[ "ListPlot[%155,PlotJoined->True,PlotRange->{{0,8},{1,6}}]"], "Input", AspectRatioFixed->True], Cell[TextData["Show[%,%%]"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["big runs"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["DCT[list_] := ThaarNorm . list"], "Input", AspectRatioFixed->True], Cell[TextData["IDCT[list_] := Transpose[ThaarNorm] . list"], "Input", AspectRatioFixed->True], Cell[TextData["rd=albert[in]"], "Input", AspectRatioFixed->True], Cell[TextData["rd >> \"rd.haar\";"], "Input", AspectRatioFixed->True], Cell[TextData["DCT[list_] := TictNorm . list"], "Input", AspectRatioFixed->True], Cell[TextData["IDCT[list_] := Transpose[TictNorm] . list"], "Input", AspectRatioFixed->True], Cell[TextData["rd=albert[in]"], "Input", AspectRatioFixed->True], Cell[TextData["rd >> \"rd.ict\";"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Reconstruction"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "test=\n {{0, 1, 0, 0, 0, 1, 0, 0},{0, 1, 0, 0, 0, 1, 0, 0}, \n {0, 1, 1, 1, \ 1, 1, 0, 0},{0, 1, 0, 0, 0, 1, 0, 0}, \n {0, 0, 1, 0, 1, 0, 0, 0},{0, 0, 1, \ 0, 1, 0, 0, 0}, \n {0, 0, 1, 0, 1, 0, 0, 0},{0, 0, 0, 1, 0, 0, 0, 0}};"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["ShowImage[test]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ The Unformatted text for this cell was not generated. Use options in the Actions Preferences dialog box to control when Unformatted text is generated.\ \>", "\<\ -Graphics-\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Dimensions[test]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {8, 8}\ \>", "\<\ {8, 8}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["ShowImage[Join[test,Transpose[test]]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ The Unformatted text for this cell was not generated. Use options in the Actions Preferences dialog box to control when Unformatted text is generated.\ \>", "\<\ -Graphics-\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["fixPair[ DCT[test], DCT[ Transpose[test] ] ]"], "Input", AspectRatioFixed->True], Cell[TextData[ "rec[image_,qmatrix_] := Module[{},\n qdct = DCTQ[DCT[image], qmatrix];\n "], "Input", AspectRatioFixed->True], Cell[TextData[ "fixPair[blockL_,blockR_] := Module[{},\n\nClear[err,ineq,vars];\n\nerr[v] :=\ \n (Plus @@\n Table[\n eblockL[u,v] DCTMatrix[[u,8]] -\n \ eblockR[u,v] DCTMatrix[[u,1]]\n ,{u,8}])^2;\n\nineq[v] := Table[\n\ (blockL[[u,v]] - eblockL[u,v])^2 < (qmatrix[[u,v]]/2)^2\n,{u,8}];\n\nvars[v] \ := Flatten[Table[{eblockL[u,v],eblockR[u,v]},{u,8}]];\n \nTable[\n \ ConstrainedMin[ err[v] , ineq[v] ,vars[v] ],{v,8}] ]"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["tech 2003 picture"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["<True], Cell[CellGroupData[{ Cell[TextData["in = readHips2[\"tmp3\"];"], "Input", AspectRatioFixed->True], Cell["", "Print", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Dimensions[in]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {512, 512}\ \>", "\<\ {512, 512}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["in2=cutImage[in,{16,16},{128,128}];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[in2];"], "Input", AspectRatioFixed->True], Cell[TextData["<True], Cell[TextData["randomTable=shuffle[Table[i,{i,0,255}]];"], "Input", AspectRatioFixed->True], Cell[TextData[ "randomColorTable = Transpose[Table[shuffle[randomTable],{3}]];"], "Input", AspectRatioFixed->True], Cell[TextData["in2c=Map[ randomColorTable[[#+1]]&,in2,{2}];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImageRGB[in2c/255.//N,True];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImageRGB[in2c/255.//N,True];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImageRGB[in2c/255.//N,True];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImageRGB[in2c/255.//N,True];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImageRGB[in2c/255.//N,True];"], "Input", AspectRatioFixed->True], Cell[TextData["inc=Map[ randomColorTable[[#+1]]&,in,{2}];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData[ "stream=OpenWrite[\"remap.0.25\"];\n\ WriteString[stream,FromCharacterCode[Flatten[inc]]];\nClose[stream]"], "Input",\ AspectRatioFixed->True], Cell[OutputFormData["\<\ \"remap.0.25\"\ \>", "\<\ remap.0.25\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["randomColorTable >> \"randomColorTable\""], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["!ls -l remap.0.25"], "Input", AspectRatioFixed->True], Cell[TextData["-rw-r--r-- 1 beau 786432 Jul 29 14:56 remap"], "Print", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["512 512 3"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 786432\ \>", "\<\ 786432\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["DCT Power Spectrum"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "For the analysis of power spectra in DCT imaging we propose the concept of \ the DCT Power Spectrum (DCTPS), given by"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "DCTPowerSpectrum[dct_] := Plus @@ Flatten[BlockImage[dct]^2,1]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "The logic here is that if we wish to preserve maximum information after \ quantization, then the quantization error power at each frequency should be \ proportional to the square of the signal to noise ratio for that frequency. \ That in turn will be given by the ratio of the DCTPS of the target class of \ imagery, divided by the DCTPS of the prevailing noise process."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Example of DCTPS for shuttle image"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["shuttle=readImageRaw[\"shuttle\",64,64,1];"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[shuttle ];"], "Input", AspectRatioFixed->True], Cell[TextData["out=DCT[shuttle];"], "Input", AspectRatioFixed->True], Cell[TextData["dps=DCTPowerSpectrum[out]"], "Input", AspectRatioFixed->True], Cell[TextData["ShowImage[Log[10,dps]];"], "Input", AspectRatioFixed->True] }, Open ]], Cell[TextData["Question: What is DCTPS of flat noise?"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Question: What is DCTPS of 1/f noise?"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "n=8;\nDCTMatrix=Table[If[k==0,Sqrt[1/n],Sqrt[2/n] Cos[Pi ( 2 j + 1) k / (2 \ n)]],{k,0,n-1},{j,0,n-1}];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Pi ( 2 j + 1) k / (2 n) //Expand"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ (k*Pi)/16 + (j*k*Pi)/8\ \>", "\<\ k Pi j k Pi ---- + ------ 16 8\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData[ "frequency is k/2 cycles/block. In cycles/deg this would be k/2 / (n dx), \ where dx is in deg."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["2 Pi "], "Input", AspectRatioFixed->True], Cell[TextData[ "Consider a continuous 2D signal f[x,y]. To get a DCT we must first sample, \ then window, then convolve with a windowed basis function, then sample again. \ Let us try to represent this mathematically.\n\n(( (f[x,y] sample[dx,dy]) \ pulse[wdx,wdy] ) * (pulse[dx,dy] cosine[u,v] )) sample[n dx, n dy]\n\nThe \ corresponding operations in the frequency domain are\n\n((( F[u,v] * \ sample[1/dx,1/dy]) * ( sinc[u/wdx] sinc[v/wdx] ) ) ( (sinc[u/dx] sinc[v/dx]) \ * (delta[uSqrt[u^2+v^2]/(2 n dx)"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData[ "TrigExpand[Cos[Pi ( 2 x + 1) u / (2 n)] Cos[Pi ( 2 y + 1) v / (2 n)]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ Cos[(Pi*u*(1 + 2*x))/16 - (Pi*v*(1 + 2*y))/16]/2 + Cos[(Pi*u*(1 + 2*x))/16 + (Pi*v*(1 + 2*y))/16]/2\ \>", "\<\ Pi u (1 + 2 x) Pi v (1 + 2 y) Cos[-------------- - --------------] 16 16 ------------------------------------ + 2 Pi u (1 + 2 x) Pi v (1 + 2 y) Cos[-------------- + --------------] 16 16 ------------------------------------ 2\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["Needs[\"Calculus`FourierTransform`\"]"], "Input", AspectRatioFixed->True], Cell[TextData["FourierTransform[expr, t, w]"], "Input", AspectRatioFixed->True], Cell[TextData["Needs[\"Algebra`Trigonometry`\"]"], "Input", AspectRatioFixed->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Observations on normalization"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Map[(Plus @@ Flatten @ (#^2))&, DCTTensor,{2}]"], "Input", AspectRatioFixed->True], Cell[TextData["test = Table[Random[Real,{-1,1}],{8}]"], "Input", AspectRatioFixed->True], Cell[TextData["out1 = DCT[test];"], "Input", AspectRatioFixed->True], Cell[TextData["out2 = DCTMatrix . test;"], "Input", AspectRatioFixed->True], Cell[TextData["Chop[out1-out2]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["DCT[Table[128,{8},{8}]][[1,1]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1024.\ \>", "\<\ 1024.\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["ShowImage[test =Table[(-1)^(i+j),{i,8},{j,8}]]"], "Input", AspectRatioFixed->True], Cell[TextData["Table[255 ( (1 + (-1)^(i+j))/2),{i,8},{j,8}]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData[ "DCT[Table[255 ( (1 + (-1)^(i+j))/2),{i,8},{j,8}]][[8,8]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 837.488288014685\ \>", "\<\ 837.488\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData[ "test=Table[128 (-1)^(i+j),{i,8},{j,8}];\nShowImage[test];\n\ DCT[test][[8,8]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 840.772555810822\ \>", "\<\ 840.773\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Sqrt[ 64 128^2]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1024\ \>", "\<\ 1024\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Sqrt[Plus @@ Flatten @ (test^2)]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1024\ \>", "\<\ 1024\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Sign[test] - Sign[DCTTensor[[8,8]]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {{0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, \ 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, \ 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}}\ \>", "\<\ {{0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, \ 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, \ 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData[ "test = 128 + 128 DCTTensor[8][[8,8]]/Max[Abs[DCTTensor[8][[8,8]]]];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Chop[DCT[test]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {{1024., 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, \ 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, \ 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 532.2578585070485}}\ \>", "\<\ {{1024., 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, \ 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, \ 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 532.258}}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["ShowImage[DCT[test]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ The Unformatted text for this cell was not generated. Use options in the Actions Preferences dialog box to control when Unformatted text is generated.\ \>", "\<\ -Graphics-\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData[ "test = Table[0,{8},{8}];\ntest[[1,1]] = 2040;\ntest[[8,8]] = 1023;\n\ out=IDCT[test];\nShowImage[out];\n{Max@#,Min@#}&[out]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {501.0160952198807, 8.98390478011924}\ \>", "\<\ {501.016, 8.9839}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData[ "test = Table[0,{8},{8}];\ntest[[2,2]] = 512;\nout=IDCT[test];\n\ ShowImage[out];\n{Max@#,Min@#}&[out]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ {123.1282900807223, -123.1282900807223}\ \>", "\<\ {123.128, -123.128}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["374+118"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 492\ \>", "\<\ 492\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["ShowImage[DCTTensor[8][[8,8]]]"], "Input", AspectRatioFixed->True], Cell[TextData[ "My code uses orthonormal bases. So does the JPEG standard (A.3.3). Also \ evident from range of Huffman tables. DC difference table range is \ {-2047,2047}. AC table range is {-1023,1023}. Not exactly sure what max of \ orthonormal coefficients are, but they are about this range..."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "This shows that the DFT-based DCT gives the same result as multipliucation \ by the orthonormal 2D DCT basis functions."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["test = Table[Random[],{8},{8}];"], "Input", AspectRatioFixed->True], Cell[TextData["out1 = DCT[test];"], "Input", AspectRatioFixed->True], Cell[TextData[ "out2 = Table[ Plus @@ Flatten[test DCTTensor[8][[u,v]]],{v,8},{u,8}];"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Chop[out1-out2]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {{0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, \ 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, \ 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}}\ \>", "\<\ {{0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, \ 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, \ 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["ShowImage[DCTTensor[8][[1,8]]]"], "Input", AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData["Photometric accuracy"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["DCT[Table[255,{8},{8}]][[1,1]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 2040.\ \>", "\<\ 2040.\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["2040 /(64 255)"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1/8\ \>", "\<\ 1 - 8\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["2040/255"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 8\ \>", "\<\ 8\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["1/64."], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0.015625\ \>", "\<\ 0.015625\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["?checkErr"], "Input", AspectRatioFixed->True], Cell[TextData[ "Global`checkErr\n\ncheckErr[n_] := \n StandardDeviationMLE[Table[data = \n \ Table[Random[Integer, {0, 255}], {8}, {8}]; \n mean = Apply[Plus, \ Flatten[data]]/64.; \n dmean = Apply[Plus, \ Flatten[IDCT[Round[DCT[data]]]]]/64.; \n mean - dmean, {n}]]"], "Print", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData[ "checkErr[n_] :=\nStandardDeviationMLE[\nTable[\n(data = \ Table[Random[Integer,{0,255}],{8},{8}];\nmean = (Plus @@ Flatten[data])/64.;\n\ dmean = (Plus @@ Flatten[IDCT[Round[DCT[data]]]])/64.;\nmean-dmean)\n,{n}]]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Timing[checkErr[4]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {3.916666666666666741*Second, 0.04279082480509110515}\ \>", "\<\ {3.91667 Second, 0.0427908}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Timing[checkErr[4]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {3.933333333333333126*Second, 0.03726325005534944469}\ \>", "\<\ {3.93333 Second, 0.0372633}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Timing[checkErr[100]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {98.73333333333333339*Second, 0.03647157497627433048}\ \>", "\<\ {98.7333 Second, 0.0364716}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData[ "RMS[list_List] := Sqrt[(Plus @@ (list^2))/Length[list]]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["255/2040"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1/8\ \>", "\<\ 1 - 8\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData[{ "Error is uniformly distributed over {-1/2,1/2}, in a quantity ranging over \ {0,2040}. In the inverse transform, this vaue is divided by 8 and inserted in \ each pixel of the block. In their average, then, the error is uniform over \ the interval {-1/16,1/16}. The variance of a uniform random variable over \ the interval {-1/16, 1/16} is 1/768, and the standard deviation is \ Sqrt[1/768] ~= 0.03608439182435161028. This is also what we obtain from a \ simulation (", StyleBox[ "0.03647157497627433048).This corresponds to a percentage accuracy of \ 0.014%.", FontFamily->"Courier"] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ "Needs[\"Statistics`DescriptiveStatistics`\"]", StyleBox["", FontFamily->"New York", FontWeight->"Plain"] }], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["100/16/255//N"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0.02450980392156862745\ \>", "\<\ 0.0245098\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["StandardDeviationMLE[list]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ VarianceMLE[list]^(1/2)\ \>", "\<\ Sqrt[VarianceMLE[list]]\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["StandardDeviation[UniformDistribution[-1/16,1/16]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0.03608439182435161028\ \>", "\<\ 0.0360844\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["100(%93 / 255)"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 0.01415074189190259227\ \>", "\<\ 0.0141507\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData["StandardDeviation[UniformDistribution[-1/16,1/16]]/"], "Input", AspectRatioFixed->True], Cell[TextData["Needs[\"Statistics`ContinuousDistributions`\"]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Variance[UniformDistribution[-1/16,1/16]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1/768\ \>", "\<\ 1 --- 768\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["768/32"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 24\ \>", "\<\ 24\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["1/(2 32 12)"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1/768\ \>", "\<\ 1 --- 768\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Variance[UniformDistribution[-1/2,1/2]]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1/12\ \>", "\<\ 1 -- 12\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell[TextData["% 64"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 16/3\ \>", "\<\ 16 -- 3\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]], Cell[TextData[ "What is the accuracy of the mean in the \"raw data.\" Each pixel has a \ uniform error over {-1/2,1/2}, and consequently a variance of 1/12. The sum \ has an error which is Normal with variance of 64/12 = 16/3, and sd of \ Sqrt[16/3]. The average has a sd of Sqrt[16/3]/64 and variance of \ (16/3)/(64^2) = 1/768."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["(16/3)/(64^2)"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ 1/768\ \>", "\<\ 1 --- 768\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True] }, Open ]] }, Closed]] }, Closed]] }, Open ]] }, FrontEndVersion->"Macintosh 3.0", ScreenRectangle->{{0, 1024}, {0, 748}}, AutoGeneratedPackage->Automatic, WindowToolbars->{"RulerBar", "EditBar"}, CellGrouping->Automatic, WindowSize->{520, 653}, WindowMargins->{{84, Automatic}, {Automatic, 1}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, 256}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, CharacterEncoding->"MacintoshAutomaticEncoding", MacintoshSystemPageSetup->"\<\ 00000000000000002eDg`000000;ED>d0000066XHJH000002eE4D000000;EDA@ 0000000000X000002eE4J000000;EDB@000000]EAI0000000000000000000000 0000066THJ80000000U9UP00001Xoo@0\>" ] (*********************************************************************** 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, 103, 2, 52, "Subtitle"], Cell[CellGroupData[{ Cell[1859, 57, 95, 2, 50, "Section"], Cell[1957, 61, 323, 9, 64, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[2317, 75, 84, 2, 50, "Section"], Cell[2404, 79, 184, 4, 70, "Text"], Cell[2591, 85, 148, 4, 70, "Text"], Cell[2742, 91, 116, 2, 70, "Text"], Cell[2861, 95, 135, 3, 70, "Text"], Cell[2999, 100, 91, 2, 70, "Text"], Cell[3093, 104, 152, 4, 70, "Text"], Cell[3248, 110, 333, 8, 70, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[3618, 123, 90, 2, 30, "Section"], Cell[3711, 127, 108, 2, 26, "Input", InitializationCell->True], Cell[3822, 131, 83, 2, 26, "Input", InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[3942, 138, 90, 2, 50, "Section"], Cell[CellGroupData[{ Cell[4057, 144, 89, 2, 44, "Subsection"], Cell[4149, 148, 205, 4, 70, "Input", InitializationCell->True], Cell[4357, 154, 142, 3, 70, "Input", InitializationCell->True], Cell[CellGroupData[{ Cell[4524, 161, 86, 1, 70, "Input"], Cell[4613, 164, 255, 11, 70, "Output"] }, Closed]], Cell[4883, 178, 99, 1, 70, "Input"], Cell[CellGroupData[{ Cell[5007, 183, 82, 1, 70, "Input"], Cell[5092, 186, 165, 7, 70, "Output"] }, Closed]], Cell[5272, 196, 77, 1, 70, "Input"], Cell[5352, 199, 80, 1, 70, "Input"], Cell[CellGroupData[{ Cell[5457, 204, 114, 2, 70, "Subsubsection"], Cell[5574, 208, 458, 9, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[6069, 222, 111, 2, 70, "Subsubsection"], Cell[6183, 226, 279, 5, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[6499, 236, 112, 2, 70, "Subsubsection"], Cell[6614, 240, 309, 6, 70, "Text"], Cell[6926, 248, 375, 13, 70, "Text"], Cell[7304, 263, 175, 4, 70, "Text"], Cell[7482, 269, 159, 4, 70, "Input"], Cell[7644, 275, 157, 4, 70, "Input"], Cell[7804, 281, 151, 4, 70, "Text"], Cell[7958, 287, 162, 4, 70, "Input"], Cell[8123, 293, 106, 2, 70, "Text"], Cell[8232, 297, 226, 5, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[8495, 307, 114, 2, 70, "Subsubsection"], Cell[8612, 311, 175, 4, 70, "Text"], Cell[8790, 317, 155, 4, 70, "Input"], Cell[8948, 323, 157, 4, 70, "Input"], Cell[9108, 329, 151, 4, 70, "Text"], Cell[9262, 335, 164, 4, 70, "Input"], Cell[9429, 341, 114, 2, 70, "Text"], Cell[9546, 345, 195, 4, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[9790, 355, 89, 2, 28, "Subsection"], Cell[9882, 359, 223, 5, 70, "Text"], Cell[10108, 366, 148, 3, 70, "Input"], Cell[10259, 371, 124, 2, 70, "Text"], Cell[10386, 375, 190, 4, 70, "Input", InitializationCell->True], Cell[10579, 381, 126, 2, 70, "Text"], Cell[10708, 385, 102, 1, 70, "Input"], Cell[10813, 388, 84, 1, 70, "Input"], Cell[10900, 391, 155, 3, 70, "Input"], Cell[11058, 396, 208, 7, 70, "Text"], Cell[11269, 405, 139, 3, 70, "Input"], Cell[11411, 410, 126, 2, 70, "Text"], Cell[11540, 414, 172, 4, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[11749, 423, 83, 2, 28, "Subsection"], Cell[11835, 427, 276, 6, 70, "Info", InitializationCell->True], Cell[12114, 435, 274, 5, 70, "Text"], Cell[CellGroupData[{ Cell[12413, 444, 109, 2, 70, "Subsubsection"], Cell[12525, 448, 168, 4, 70, "Input", InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[12730, 457, 117, 2, 70, "Subsubsection"], Cell[12850, 461, 119, 2, 70, "Input", InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[13006, 468, 112, 2, 70, "Subsubsection"], Cell[13121, 472, 171, 4, 70, "Input", InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[13329, 481, 90, 2, 70, "Subsubsection"], Cell[13422, 485, 93, 1, 70, "Input"], Cell[13518, 488, 74, 1, 70, "Input"], Cell[13595, 491, 73, 1, 70, "Input"], Cell[CellGroupData[{ Cell[13693, 496, 80, 1, 70, "Input"], Cell[13776, 499, 104, 6, 70, "Output"] }, Closed]], Cell[13895, 508, 98, 1, 70, "Input"], Cell[13996, 511, 74, 1, 70, "Input"], Cell[14073, 514, 73, 1, 70, "Input"], Cell[CellGroupData[{ Cell[14171, 519, 80, 1, 70, "Input"], Cell[14254, 522, 104, 6, 70, "Output"] }, Closed]], Cell[14373, 531, 177, 6, 70, "Input"], Cell[14553, 539, 71, 1, 70, "Input"], Cell[CellGroupData[{ Cell[14649, 544, 86, 1, 70, "Input"], Cell[14738, 547, 157, 7, 70, "Output"] }, Closed]], Cell[14910, 557, 72, 1, 70, "Input"], Cell[14985, 560, 84, 1, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[15118, 567, 84, 2, 28, "Subsection"], Cell[15205, 571, 159, 4, 70, "Text"], Cell[CellGroupData[{ Cell[15389, 579, 109, 2, 70, "Subsubsection"], Cell[15501, 583, 170, 4, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[15708, 592, 117, 2, 70, "Subsubsection"], Cell[15828, 596, 121, 2, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[15986, 603, 112, 2, 70, "Subsubsection"], Cell[16101, 607, 174, 4, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[16312, 616, 90, 2, 70, "Subsubsection"], Cell[16405, 620, 97, 1, 70, "Input"], Cell[16505, 623, 71, 1, 70, "Input"], Cell[CellGroupData[{ Cell[16601, 628, 62, 1, 70, "Input"], Cell[16666, 631, 1147, 38, 70, "Output"] }, Closed]], Cell[17828, 672, 71, 1, 70, "Input"], Cell[CellGroupData[{ Cell[17924, 677, 72, 1, 70, "Input"], Cell[17999, 680, 106, 6, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[18142, 691, 62, 1, 70, "Input"], Cell[18207, 694, 1147, 38, 70, "Output"] }, Closed]], Cell[19369, 735, 76, 1, 70, "Input"], Cell[CellGroupData[{ Cell[19470, 740, 78, 1, 70, "Input"], Cell[19551, 743, 104, 6, 70, "Output"] }, Closed]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[19716, 756, 85, 2, 28, "Subsection"], Cell[CellGroupData[{ Cell[19826, 762, 138, 3, 70, "Input"], Cell[19967, 767, 104, 6, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[20108, 778, 149, 3, 70, "Input"], Cell[20260, 783, 104, 6, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[20401, 794, 148, 3, 70, "Input"], Cell[20552, 799, 104, 6, 70, "Output"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[20705, 811, 90, 2, 28, "Subsection"], Cell[CellGroupData[{ Cell[20820, 817, 116, 2, 70, "Subsubsection"], Cell[20939, 821, 286, 5, 70, "Input"], Cell[21228, 828, 94, 1, 70, "Input"], Cell[21325, 831, 94, 1, 70, "Input"], Cell[21422, 834, 68, 1, 70, "Input"], Cell[CellGroupData[{ Cell[21515, 839, 69, 1, 70, "Input"], Cell[21587, 842, 118, 6, 70, "Output"] }, Closed]], Cell[21720, 851, 68, 1, 70, "Input"], Cell[21791, 854, 135, 3, 70, "Input"], Cell[CellGroupData[{ Cell[21951, 861, 57, 1, 70, "Input"], Cell[22011, 864, 335, 7, 70, "Print"] }, Closed]], Cell[CellGroupData[{ Cell[22383, 876, 77, 1, 70, "Input"], Cell[22463, 879, 154, 7, 70, "Output"] }, Closed]], Cell[22632, 889, 83, 1, 70, "Input"], Cell[CellGroupData[{ Cell[22740, 894, 57, 1, 70, "Input"], Cell[22800, 897, 276, 5, 70, "Print"] }, Closed]], Cell[CellGroupData[{ Cell[23113, 907, 77, 1, 70, "Input"], Cell[23193, 910, 154, 7, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[23384, 922, 58, 1, 70, "Input"], Cell[23445, 925, 338, 6, 70, "Print"] }, Closed]], Cell[CellGroupData[{ Cell[23820, 936, 79, 1, 70, "Input"], Cell[23902, 939, 154, 7, 70, "Output"] }, Closed]], Cell[24071, 949, 85, 1, 70, "Input"], Cell[24159, 952, 85, 1, 70, "Input"], Cell[CellGroupData[{ Cell[24269, 957, 58, 1, 70, "Input"], Cell[24330, 960, 284, 5, 70, "Print"] }, Closed]], Cell[CellGroupData[{ Cell[24651, 970, 79, 1, 70, "Input"], Cell[24733, 973, 153, 7, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[24923, 985, 74, 1, 70, "Input"], Cell[25000, 988, 150, 7, 70, "Output"] }, Closed]], Cell[25165, 998, 81, 1, 70, "Input"], Cell[25249, 1001, 81, 1, 70, "Input"], Cell[CellGroupData[{ Cell[25355, 1006, 74, 1, 70, "Input"], Cell[25432, 1009, 149, 7, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[25618, 1021, 128, 3, 70, "Input"], Cell[25749, 1026, 155, 7, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[25941, 1038, 99, 1, 70, "Input"], Cell[26043, 1041, 114, 6, 70, "Output"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[26206, 1053, 93, 2, 70, "Subsubsection"], Cell[26302, 1057, 95, 1, 70, "Input"], Cell[26400, 1060, 70, 1, 70, "Input"], Cell[26473, 1063, 121, 3, 70, "Input"], Cell[26597, 1068, 72, 1, 70, "Input"], Cell[CellGroupData[{ Cell[26694, 1073, 97, 1, 70, "Input"], Cell[26794, 1076, 103, 2, 70, "Print"], Cell[26900, 1080, 147, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[27084, 1092, 92, 1, 70, "Input"], Cell[27179, 1095, 145, 7, 70, "Output"] }, Closed]], Cell[27339, 1105, 89, 1, 70, "Input"], Cell[CellGroupData[{ Cell[27453, 1110, 97, 1, 70, "Input"], Cell[27553, 1113, 103, 2, 70, "Print"], Cell[27659, 1117, 145, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[27841, 1129, 92, 1, 70, "Input"], Cell[27936, 1132, 145, 7, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[28118, 1144, 98, 1, 70, "Input"], Cell[28219, 1147, 102, 2, 70, "Print"], Cell[28324, 1151, 160, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[28521, 1163, 93, 1, 70, "Input"], Cell[28617, 1166, 160, 7, 70, "Output"] }, Closed]], Cell[28792, 1176, 100, 1, 70, "Input"], Cell[28895, 1179, 91, 1, 70, "Input"], Cell[28989, 1182, 124, 3, 70, "Input"], Cell[29116, 1187, 311, 6, 70, "Input"], Cell[29430, 1195, 150, 3, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[29617, 1203, 90, 2, 70, "Subsubsection"], Cell[29710, 1207, 95, 1, 70, "Input"], Cell[CellGroupData[{ Cell[29830, 1212, 97, 1, 70, "Input"], Cell[29930, 1215, 102, 2, 70, "Print"], Cell[30035, 1219, 145, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[30217, 1231, 92, 1, 70, "Input"], Cell[30312, 1234, 157, 7, 70, "Output"] }, Closed]], Cell[30484, 1244, 89, 1, 70, "Input"], Cell[CellGroupData[{ Cell[30598, 1249, 97, 1, 70, "Input"], Cell[30698, 1252, 102, 2, 70, "Print"], Cell[30803, 1256, 157, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[30997, 1268, 92, 1, 70, "Input"], Cell[31092, 1271, 156, 7, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[31285, 1283, 98, 1, 70, "Input"], Cell[31386, 1286, 101, 2, 70, "Print"], Cell[31490, 1290, 157, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[31684, 1302, 93, 1, 70, "Input"], Cell[31780, 1305, 157, 7, 70, "Output"] }, Closed]], Cell[31952, 1315, 91, 1, 70, "Input"], Cell[32046, 1318, 122, 3, 70, "Input"], Cell[CellGroupData[{ Cell[32193, 1325, 104, 1, 70, "Input"], Cell[32300, 1328, 137, 7, 70, "Output"] }, Closed]], Cell[32452, 1338, 314, 6, 70, "Input"], Cell[32769, 1346, 150, 3, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[32956, 1354, 90, 2, 70, "Subsubsection"], Cell[33049, 1358, 121, 3, 70, "Input"], Cell[33173, 1363, 72, 1, 70, "Input"], Cell[CellGroupData[{ Cell[33270, 1368, 80, 1, 70, "Input"], Cell[33353, 1371, 157, 7, 70, "Output"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[33559, 1384, 89, 2, 70, "Subsubsection"], Cell[CellGroupData[{ Cell[33673, 1390, 80, 1, 70, "Input"], Cell[33756, 1393, 154, 7, 70, "Output"] }, Closed]] }, Closed]] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[33983, 1408, 92, 2, 30, "Section"], Cell[CellGroupData[{ Cell[34100, 1414, 87, 2, 44, "Subsection"], Cell[34190, 1418, 122, 2, 70, "Text"], Cell[34315, 1422, 233, 5, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[34585, 1432, 109, 2, 28, "Subsection"], Cell[CellGroupData[{ Cell[34719, 1438, 92, 2, 70, "Subsubsection"], Cell[34814, 1442, 366, 7, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[35217, 1454, 94, 2, 70, "Subsubsection"], Cell[35314, 1458, 369, 6, 70, "Input", InitializationCell->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[35732, 1470, 96, 2, 28, "Subsection"], Cell[35831, 1474, 183, 4, 70, "Text"], Cell[36017, 1480, 252, 5, 70, "Text"], Cell[36272, 1487, 214, 4, 70, "Input", InitializationCell->True], Cell[36489, 1493, 135, 3, 70, "Input", InitializationCell->True], Cell[36627, 1498, 149, 4, 70, "Input", InitializationCell->True], Cell[36779, 1504, 201, 4, 70, "Input", InitializationCell->True], Cell[36983, 1510, 194, 4, 70, "Input", InitializationCell->True], Cell[37180, 1516, 207, 4, 70, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[37424, 1525, 95, 2, 28, "Subsection"], Cell[37522, 1529, 259, 5, 70, "Text"], Cell[37784, 1536, 228, 5, 70, "Text"], Cell[38015, 1543, 207, 5, 70, "Input", InitializationCell->True], Cell[38225, 1550, 185, 4, 70, "Text"], Cell[38413, 1556, 164, 3, 70, "Input"], Cell[38580, 1561, 242, 5, 70, "Text"], Cell[38825, 1568, 87, 2, 70, "Text"], Cell[38915, 1572, 293, 6, 70, "Input", InitializationCell->True], Cell[CellGroupData[{ Cell[39233, 1582, 90, 2, 70, "Subsubsection"], Cell[39326, 1586, 101, 1, 70, "Input"], Cell[CellGroupData[{ Cell[39452, 1591, 107, 2, 70, "Input"], Cell[39562, 1595, 157, 7, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[39756, 1607, 62, 1, 70, "Input"], Cell[39821, 1610, 110, 6, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[39968, 1621, 58, 1, 70, "Input"], Cell[40029, 1624, 297, 6, 70, "Print"] }, Closed]], Cell[CellGroupData[{ Cell[40363, 1635, 72, 1, 70, "Input"], Cell[40438, 1638, 268, 10, 70, "Output"] }, Closed]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[40767, 1655, 101, 2, 70, "Subsection"], Cell[CellGroupData[{ Cell[40893, 1661, 97, 2, 70, "Subsubsection"], Cell[40993, 1665, 249, 5, 70, "Text"], Cell[41245, 1672, 242, 5, 70, "Input", InitializationCell->True], Cell[41490, 1679, 66, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[41593, 1685, 102, 2, 70, "Subsubsection"], Cell[41698, 1689, 214, 4, 70, "Text"], Cell[41915, 1695, 283, 5, 70, "Input", InitializationCell->True], Cell[42201, 1702, 110, 2, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[42348, 1709, 94, 2, 70, "Subsubsection"], Cell[42445, 1713, 305, 6, 70, "Input", InitializationCell->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[42799, 1725, 100, 2, 70, "Subsection"], Cell[CellGroupData[{ Cell[42924, 1731, 109, 2, 70, "Subsubsection"], Cell[43036, 1735, 166, 6, 70, "Input"], Cell[43205, 1743, 72, 1, 70, "Input"], Cell[43280, 1746, 105, 1, 70, "Input"], Cell[43388, 1749, 72, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[43497, 1755, 104, 2, 70, "Subsubsection"], Cell[43604, 1759, 59, 1, 70, "Input"], Cell[43666, 1762, 87, 1, 70, "Input"], Cell[CellGroupData[{ Cell[43778, 1767, 67, 1, 70, "Input"], Cell[43848, 1770, 122, 6, 70, "Output"] }, Closed]], Cell[43985, 1779, 67, 1, 70, "Input"], Cell[CellGroupData[{ Cell[44077, 1784, 93, 1, 70, "Input"], Cell[44173, 1787, 157, 7, 70, "Output"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[44379, 1800, 95, 2, 70, "Subsubsection"], Cell[44477, 1804, 102, 1, 70, "Input"], Cell[CellGroupData[{ Cell[44604, 1809, 67, 1, 70, "Input"], Cell[44674, 1812, 122, 6, 70, "Output"] }, Closed]], Cell[44811, 1821, 67, 1, 70, "Input"], Cell[CellGroupData[{ Cell[44903, 1826, 73, 1, 70, "Input"], Cell[44979, 1829, 118, 6, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[45134, 1840, 91, 1, 70, "Input"], Cell[45228, 1843, 92, 2, 70, "Print"], Cell[45323, 1847, 145, 7, 70, "Output"] }, Closed]], Cell[45483, 1857, 75, 1, 70, "Input"], Cell[CellGroupData[{ Cell[45583, 1862, 73, 1, 70, "Input"], Cell[45659, 1865, 118, 6, 70, "Output"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[45826, 1877, 97, 2, 70, "Subsubsection"], Cell[45926, 1881, 105, 1, 70, "Input"], Cell[CellGroupData[{ Cell[46056, 1886, 70, 1, 70, "Input"], Cell[46129, 1889, 118, 6, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[46284, 1900, 83, 1, 70, "Input"], Cell[46370, 1903, 157, 7, 70, "Output"] }, Closed]], Cell[46542, 1913, 67, 1, 70, "Input"], Cell[CellGroupData[{ Cell[46634, 1918, 93, 1, 70, "Input"], Cell[46730, 1921, 156, 7, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[46923, 1933, 103, 1, 70, "Input"], Cell[47029, 1936, 91, 2, 70, "Print"], Cell[47123, 1940, 157, 7, 70, "Output"] }, Closed]], Cell[47295, 1950, 125, 3, 70, "Input"], Cell[47423, 1955, 72, 1, 70, "Input"], Cell[47498, 1958, 118, 2, 70, "Input"], Cell[47619, 1962, 69, 1, 70, "Input"], Cell[CellGroupData[{ Cell[47713, 1967, 88, 1, 70, "Input"], Cell[47804, 1970, 93, 2, 70, "Print"] }, Closed]], Cell[CellGroupData[{ Cell[47934, 1977, 99, 1, 70, "Input"], Cell[48036, 1980, 92, 2, 70, "Print"] }, Closed]], Cell[48143, 1985, 84, 1, 70, "Input"] }, Closed]], Cell[48242, 1989, 106, 2, 70, "Subsubsection"], Cell[CellGroupData[{ Cell[48373, 1995, 89, 2, 70, "Subsubsection"], Cell[48465, 1999, 4240, 65, 70, "Input"], Cell[52708, 2066, 117, 2, 70, "Input"], Cell[52828, 2070, 91, 1, 70, "Input"], Cell[52922, 2073, 92, 1, 70, "Input"], Cell[53017, 2076, 75, 1, 70, "Input"], Cell[CellGroupData[{ Cell[53117, 2081, 100, 1, 70, "Input"], Cell[53220, 2084, 157, 7, 70, "Output"] }, Closed]], Cell[53392, 2094, 76, 1, 70, "Input"], Cell[53471, 2097, 75, 1, 70, "Input"], Cell[CellGroupData[{ Cell[53571, 2102, 100, 1, 70, "Input"], Cell[53674, 2105, 157, 7, 70, "Output"] }, Closed]], Cell[53846, 2115, 76, 1, 70, "Input"], Cell[53925, 2118, 76, 1, 70, "Input"], Cell[CellGroupData[{ Cell[54026, 2123, 113, 2, 70, "Input"], Cell[54142, 2127, 225, 5, 70, "Print"] }, Closed]], Cell[CellGroupData[{ Cell[54404, 2137, 56, 1, 70, "Input"], Cell[54463, 2140, 192, 8, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[54692, 2153, 85, 1, 70, "Input"], Cell[54780, 2156, 126, 6, 70, "Output"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[54955, 2168, 119, 2, 70, "Subsubsection"], Cell[55077, 2172, 73, 1, 70, "Input"], Cell[CellGroupData[{ Cell[55175, 2177, 101, 1, 70, "Input"], Cell[55279, 2180, 118, 6, 70, "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[55446, 2192, 89, 2, 70, "Subsubsection"], Cell[55538, 2196, 166, 6, 70, "Input"], Cell[55707, 2204, 72, 1, 70, "Input"], Cell[55782, 2207, 72, 1, 70, "Input"], Cell[55857, 2210, 95, 2, 70, "Text"], Cell[CellGroupData[{ Cell[55977, 2216, 85, 1, 70, "Input"], Cell[56065, 2219, 129, 7, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[56231, 2231, 86, 1, 70, "Input"], Cell[56320, 2234, 129, 7, 70, "Output"] }, Closed]], Cell[56464, 2244, 74, 1, 70, "Input"], Cell[CellGroupData[{ Cell[56563, 2249, 78, 1, 70, "Input"], Cell[56644, 2252, 197, 7, 70, "Output"] }, Closed]], Cell[56856, 2262, 75, 1, 70, "Input"], Cell[56934, 2265, 75, 1, 70, "Input"], Cell[CellGroupData[{ Cell[57034, 2270, 102, 1, 70, "Input"], Cell[57139, 2273, 145, 7, 70, "Output"] }, Closed]], Cell[57299, 2283, 76, 1, 70, "Input"], Cell[57378, 2286, 76, 1, 70, "Input"], Cell[57457, 2289, 81, 1, 70, "Input"], Cell[57541, 2292, 80, 1, 70, "Input"], Cell[57624, 2295, 75, 1, 70, "Input"] }, Closed]] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[57760, 2303, 88, 2, 70, "Section"], Cell[CellGroupData[{ Cell[57873, 2309, 88, 2, 70, "Subsection"], Cell[57964, 2313, 333, 6, 70, "Input", InitializationCell->True], Cell[58300, 2321, 104, 1, 70, "Input"], Cell[58407, 2324, 102, 1, 70, "Input"], Cell[58512, 2327, 144, 3, 70, "Input"], Cell[58659, 2332, 72, 1, 70, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[58768, 2338, 92, 2, 70, "Subsection"], Cell[58863, 2342, 61, 1, 70, "Input"], Cell[58927, 2345, 70, 1, 70, "Input"], Cell[59000, 2348, 104, 1, 70, "Input"], Cell[59107, 2351, 333, 5, 70, "Input"], Cell[59443, 2358, 100, 1, 70, "Input"], Cell[59546, 2361, 115, 2, 70, "Input"], Cell[CellGroupData[{ Cell[59686, 2367, 109, 2, 70, "Subsubsection"], Cell[59798, 2371, 127, 3, 70, "Input"], Cell[59928, 2376, 109, 2, 70, "Input"], Cell[60040, 2380, 108, 2, 70, "Input"], Cell[CellGroupData[{ Cell[60173, 2386, 61, 1, 70, "Input"], Cell[60237, 2389, 130, 7, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[60404, 2401, 61, 1, 70, "Input"], Cell[60468, 2404, 130, 7, 70, "Output"] }, Closed]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[60659, 2418, 123, 2, 70, "Subsection"], Cell[60785, 2422, 276, 5, 70, "Text"], Cell[61064, 2429, 302, 5, 70, "Input"], Cell[61369, 2436, 144, 3, 70, "Input"], Cell[61516, 2441, 101, 1, 70, "Input"], Cell[61620, 2444, 176, 3, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[61833, 2452, 90, 2, 70, "Subsection"], Cell[61926, 2456, 100, 2, 70, "Text"], Cell[CellGroupData[{ Cell[62051, 2462, 108, 2, 70, "Input"], Cell[62162, 2466, 133, 7, 70, "Output"] }, Closed]], Cell[62310, 2476, 96, 2, 70, "Text"], Cell[CellGroupData[{ Cell[62431, 2482, 82, 1, 70, "Input"], Cell[62516, 2485, 122, 6, 70, "Output"] }, Closed]], Cell[62653, 2494, 65, 1, 70, "Input"], Cell[62721, 2497, 174, 4, 70, "Input", InitializationCell->True], Cell[CellGroupData[{ Cell[62920, 2505, 66, 1, 70, "Input"], Cell[62989, 2508, 126, 6, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[63152, 2519, 68, 1, 70, "Input"], Cell[63223, 2522, 126, 6, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[63386, 2533, 79, 1, 70, "Input"], Cell[63468, 2536, 126, 6, 70, "Output"] }, Closed]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[63655, 2549, 91, 2, 70, "Section"], Cell[63749, 2553, 272, 5, 70, "Text"], Cell[CellGroupData[{ Cell[64046, 2562, 87, 2, 70, "Subsection"], Cell[64136, 2566, 149, 4, 70, "Text"], Cell[64288, 2572, 96, 2, 70, "Input", InitializationCell->True], Cell[64387, 2576, 121, 2, 70, "Input", InitializationCell->True], Cell[64511, 2580, 87, 2, 70, "Subsubsection"] }, Closed]], Cell[CellGroupData[{ Cell[64635, 2587, 86, 2, 70, "Subsection"], Cell[64724, 2591, 160, 4, 70, "Text"], Cell[CellGroupData[{ Cell[64909, 2599, 93, 2, 70, "Subsubsection"], Cell[65005, 2603, 226, 5, 70, "Text"], Cell[65234, 2610, 315, 5, 70, "Input"], Cell[65552, 2617, 111, 2, 70, "Text"], Cell[CellGroupData[{ Cell[65688, 2623, 93, 1, 70, "Input"], Cell[65784, 2626, 625, 18, 70, "Output"] }, Closed]], Cell[66424, 2647, 378, 6, 70, "Input", InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[66839, 2658, 90, 2, 70, "Subsubsection"], Cell[66932, 2662, 102, 1, 70, "Input"], Cell[67037, 2665, 65, 1, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[67151, 2672, 87, 2, 70, "Subsection"], Cell[67241, 2676, 314, 6, 70, "Text"], Cell[67558, 2684, 107, 2, 70, "Input", InitializationCell->True], Cell[67668, 2688, 120, 2, 70, "Input", InitializationCell->True], Cell[67791, 2692, 152, 4, 70, "Input", InitializationCell->True], Cell[CellGroupData[{ Cell[67968, 2700, 90, 2, 70, "Subsubsection"], Cell[CellGroupData[{ Cell[68083, 2706, 99, 1, 70, "Input"], Cell[68185, 2709, 251, 9, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[68473, 2723, 66, 1, 70, "Input"], Cell[68542, 2726, 185, 7, 70, "Output"] }, Open ]], Cell[68742, 2736, 93, 1, 70, "Input"], Cell[68838, 2739, 66, 1, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[68953, 2746, 83, 2, 70, "Subsection"], Cell[69039, 2750, 187, 4, 70, "Text"], Cell[69229, 2756, 165, 4, 70, "Input", InitializationCell->True], Cell[CellGroupData[{ Cell[69419, 2764, 86, 2, 70, "Subsubsection"], Cell[69508, 2768, 117, 2, 70, "Input"], Cell[69628, 2772, 122, 2, 70, "Text"], Cell[69753, 2776, 107, 2, 70, "Input"], Cell[69863, 2780, 83, 1, 70, "Input"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[69995, 2787, 83, 2, 70, "Subsection"], Cell[70081, 2791, 166, 4, 70, "Text"], Cell[70250, 2797, 63, 1, 70, "Input"], Cell[70316, 2800, 99, 2, 70, "Text"], Cell[70418, 2804, 177, 4, 70, "Input"], Cell[70598, 2810, 155, 3, 70, "Input"], Cell[70756, 2815, 100, 2, 70, "Text"], Cell[70859, 2819, 183, 4, 70, "Input", InitializationCell->True], Cell[CellGroupData[{ Cell[71067, 2827, 72, 1, 70, "Input"], Cell[71142, 2830, 171, 7, 70, "Output"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[71362, 2843, 92, 2, 70, "Subsection"], Cell[71457, 2847, 159, 4, 70, "Text"], Cell[71619, 2853, 165, 4, 70, "Input", InitializationCell->True], Cell[CellGroupData[{ Cell[71809, 2861, 93, 1, 70, "Input"], Cell[71905, 2864, 131, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[72073, 2876, 93, 1, 70, "Input"], Cell[72169, 2879, 131, 7, 70, "Output"] }, Open ]], Cell[72315, 2889, 64, 1, 70, "Input"], Cell[72382, 2892, 111, 2, 70, "Input"], Cell[CellGroupData[{ Cell[72518, 2898, 63, 1, 70, "Input"], Cell[72584, 2901, 106, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[72727, 2912, 86, 2, 70, "Subsubsection"], Cell[72816, 2916, 162, 4, 70, "Input", InitializationCell->True] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[73027, 2926, 145, 4, 70, "Subsection"], Cell[73175, 2932, 121, 2, 70, "Text"], Cell[73299, 2936, 610, 11, 70, "Input", InitializationCell->True], Cell[CellGroupData[{ Cell[73934, 2951, 86, 2, 70, "Subsubsection"], Cell[74023, 2955, 672, 11, 70, "Input", InitializationCell->True], Cell[CellGroupData[{ Cell[74720, 2970, 77, 1, 70, "Input"], Cell[74800, 2973, 235, 9, 70, "Output"] }, Open ]] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[75096, 2989, 106, 2, 70, "Subsection"], Cell[75205, 2993, 122, 2, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[75364, 3000, 97, 2, 70, "Subsection"], Cell[75464, 3004, 135, 3, 70, "Text"], Cell[75602, 3009, 216, 4, 70, "Input", InitializationCell->True], Cell[75821, 3015, 216, 4, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[76074, 3024, 86, 2, 70, "Subsection"], Cell[76163, 3028, 215, 4, 70, "Input", InitializationCell->True], Cell[76381, 3034, 215, 4, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[76633, 3043, 86, 2, 70, "Subsection"], Cell[76722, 3047, 153, 4, 70, "Text"], Cell[76878, 3053, 269, 5, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[77184, 3063, 92, 2, 70, "Subsection"], Cell[77279, 3067, 532, 8, 70, "Input", InitializationCell->True], Cell[CellGroupData[{ Cell[77836, 3079, 67, 1, 70, "Input"], Cell[77906, 3082, 110, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[78053, 3093, 80, 1, 70, "Input"], Cell[78136, 3096, 124, 6, 70, "Output"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[78309, 3108, 84, 2, 70, "Subsection"], Cell[78396, 3112, 112, 2, 70, "Input"], Cell[78511, 3116, 258, 5, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[78806, 3126, 92, 2, 70, "Subsection"], Cell[78901, 3130, 216, 4, 70, "Input", InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[79154, 3139, 84, 2, 70, "Subsection"], Cell[79241, 3143, 144, 3, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[79422, 3151, 87, 2, 70, "Subsection"], Cell[79512, 3155, 169, 6, 70, "Input"], Cell[79684, 3163, 66, 1, 70, "Input"], Cell[79753, 3166, 79, 1, 70, "Input"], Cell[CellGroupData[{ Cell[79857, 3171, 65, 1, 70, "Input"], Cell[79925, 3174, 110, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[80072, 3185, 65, 1, 70, "Input"], Cell[80140, 3188, 110, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[80287, 3199, 72, 1, 70, "Input"], Cell[80362, 3202, 120, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[80519, 3213, 72, 1, 70, "Input"], Cell[80594, 3216, 120, 6, 70, "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[80763, 3228, 100, 2, 70, "Subsection"], Cell[80866, 3232, 74, 1, 70, "Input"], Cell[80943, 3235, 86, 1, 70, "Input"], Cell[81032, 3238, 64, 1, 70, "Input"], Cell[81099, 3241, 77, 1, 70, "Input"], Cell[81179, 3244, 61, 1, 70, "Input"], Cell[81243, 3247, 64, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[81344, 3253, 100, 2, 70, "Subsection"], Cell[81447, 3257, 83, 1, 70, "Input"], Cell[81533, 3260, 69, 1, 70, "Input"], Cell[81605, 3263, 70, 1, 70, "Input"], Cell[81678, 3266, 79, 1, 70, "Input"], Cell[81760, 3269, 67, 1, 70, "Input"], Cell[81830, 3272, 69, 1, 70, "Input"], Cell[81902, 3275, 78, 1, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[82029, 3282, 87, 2, 70, "Section"], Cell[CellGroupData[{ Cell[82141, 3288, 96, 2, 70, "Subsection"], Cell[82240, 3292, 76, 1, 70, "Input"], Cell[82319, 3295, 140, 3, 70, "Text"], Cell[CellGroupData[{ Cell[82484, 3302, 96, 1, 70, "Input"], Cell[82583, 3305, 183, 7, 70, "Output"] }, Closed]], Cell[82781, 3315, 90, 1, 70, "Input"], Cell[CellGroupData[{ Cell[82896, 3320, 91, 1, 70, "Input"], Cell[82990, 3323, 141, 7, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[83168, 3335, 77, 1, 70, "Input"], Cell[83248, 3338, 122, 2, 70, "Print"], Cell[83373, 3342, 159, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[83569, 3354, 61, 1, 70, "Input"], Cell[83633, 3357, 112, 6, 70, "Output"] }, Closed]], Cell[CellGroupData[{ Cell[83782, 3368, 73, 1, 70, "Input"], Cell[83858, 3371, 124, 6, 70, "Output"] }, Closed]], Cell[83997, 3380, 89, 1, 70, "Input"], Cell[84089, 3383, 96, 1, 70, "Input"], Cell[CellGroupData[{ Cell[84210, 3388, 72, 1, 70, "Input"], Cell[84285, 3391, 122, 6, 70, "Output"] }, Closed]], Cell[84422, 3400, 68, 1, 70, "Input"], Cell[84493, 3403, 173, 6, 70, "Input"], Cell[CellGroupData[{ Cell[84691, 3413, 81, 1, 70, "Input"], Cell[84775, 3416, 125, 6, 70, "Output"] }, Closed]], Cell[84915, 3425, 87, 1, 70, "Input"], Cell[85005, 3428, 92, 1, 70, "Input"], Cell[85100, 3431, 74, 1, 70, "Input"], Cell[85177, 3434, 78, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[85292, 3440, 88, 2, 70, "Subsection"], Cell[85383, 3444, 296, 5, 70, "Input"], Cell[85682, 3451, 297, 5, 70, "Input"], Cell[85982, 3458, 95, 1, 70, "Input"], Cell[86080, 3461, 116, 2, 70, "Input"], Cell[CellGroupData[{ Cell[86221, 3467, 77, 1, 70, "Input"], Cell[86301, 3470, 268, 10, 70, "Output"] }, Open ]], Cell[86584, 3483, 80, 1, 70, "Input"], Cell[CellGroupData[{ Cell[86689, 3488, 107, 2, 70, "Input"], Cell[86799, 3492, 329, 11, 70, "Output"] }, Open ]], Cell[87143, 3506, 100, 1, 70, "Input"], Cell[87246, 3509, 89, 1, 70, "Input"], Cell[87338, 3512, 81, 1, 70, "Input"], Cell[87422, 3515, 69, 1, 70, "Input"], Cell[87494, 3518, 62, 1, 70, "Input"], Cell[87559, 3521, 65, 1, 70, "Input"], Cell[87627, 3524, 59, 1, 70, "Input"], Cell[CellGroupData[{ Cell[87711, 3529, 98, 1, 70, "Input"], Cell[87812, 3532, 65, 2, 70, "Print"] }, Open ]], Cell[87892, 3537, 165, 6, 70, "Input"], Cell[88060, 3545, 85, 1, 70, "Input"], Cell[88148, 3548, 68, 1, 70, "Input"], Cell[CellGroupData[{ Cell[88241, 3553, 74, 1, 70, "Input"], Cell[88318, 3556, 154, 7, 70, "Output"] }, Open ]], Cell[88487, 3566, 67, 1, 70, "Input"], Cell[CellGroupData[{ Cell[88579, 3571, 74, 1, 70, "Input"], Cell[88656, 3574, 93, 2, 70, "Print"] }, Open ]], Cell[88764, 3579, 306, 5, 70, "Input"], Cell[89073, 3586, 83, 1, 70, "Input"], Cell[89159, 3589, 95, 1, 70, "Input"], Cell[89257, 3592, 82, 1, 70, "Input"], Cell[89342, 3595, 94, 1, 70, "Input"], Cell[89439, 3598, 64, 1, 70, "Input"], Cell[89506, 3601, 64, 1, 70, "Input"], Cell[89573, 3604, 110, 2, 70, "Input"], Cell[89686, 3608, 110, 2, 70, "Input"], Cell[89799, 3612, 63, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[89899, 3618, 88, 2, 70, "Subsection"], Cell[89990, 3622, 83, 1, 70, "Input"], Cell[90076, 3625, 95, 1, 70, "Input"], Cell[90174, 3628, 66, 1, 70, "Input"], Cell[90243, 3631, 71, 1, 70, "Input"], Cell[90317, 3634, 82, 1, 70, "Input"], Cell[90402, 3637, 94, 1, 70, "Input"], Cell[90499, 3640, 66, 1, 70, "Input"], Cell[90568, 3643, 70, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[90675, 3649, 94, 2, 70, "Subsection"], Cell[90772, 3653, 286, 5, 70, "Input"], Cell[CellGroupData[{ Cell[91083, 3662, 68, 1, 70, "Input"], Cell[91154, 3665, 265, 10, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[91456, 3680, 69, 1, 70, "Input"], Cell[91528, 3683, 114, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[91679, 3694, 90, 1, 70, "Input"], Cell[91772, 3697, 265, 10, 70, "Output"] }, Open ]], Cell[92052, 3710, 97, 1, 70, "Input"], Cell[92152, 3713, 130, 3, 70, "Input"], Cell[92285, 3718, 471, 7, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[92793, 3730, 97, 2, 70, "Subsection"], Cell[92893, 3734, 59, 1, 70, "Input"], Cell[CellGroupData[{ Cell[92977, 3739, 78, 1, 70, "Input"], Cell[93058, 3742, 65, 2, 70, "Print"] }, Open ]], Cell[CellGroupData[{ Cell[93160, 3749, 67, 1, 70, "Input"], Cell[93230, 3752, 122, 6, 70, "Output"] }, Open ]], Cell[93367, 3761, 88, 1, 70, "Input"], Cell[93458, 3764, 68, 1, 70, "Input"], Cell[93529, 3767, 68, 1, 70, "Input"], Cell[93600, 3770, 93, 1, 70, "Input"], Cell[93696, 3773, 116, 2, 70, "Input"], Cell[93815, 3777, 97, 1, 70, "Input"], Cell[93915, 3780, 85, 1, 70, "Input"], Cell[94003, 3783, 85, 1, 70, "Input"], Cell[94091, 3786, 85, 1, 70, "Input"], Cell[94179, 3789, 85, 1, 70, "Input"], Cell[94267, 3792, 85, 1, 70, "Input"], Cell[94355, 3795, 95, 1, 70, "Input"], Cell[CellGroupData[{ Cell[94475, 3800, 160, 4, 70, "Input"], Cell[94638, 3806, 126, 6, 70, "Output"] }, Open ]], Cell[94779, 3815, 93, 1, 70, "Input"], Cell[CellGroupData[{ Cell[94897, 3820, 70, 1, 70, "Input"], Cell[94970, 3823, 125, 2, 70, "Print"] }, Open ]], Cell[CellGroupData[{ Cell[95132, 3830, 62, 1, 70, "Input"], Cell[95197, 3833, 114, 6, 70, "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[95360, 3845, 98, 2, 70, "Subsection"], Cell[95461, 3849, 192, 4, 70, "Text"], Cell[95656, 3855, 144, 3, 70, "Input", InitializationCell->True], Cell[95803, 3860, 445, 7, 70, "Text"], Cell[CellGroupData[{ Cell[96273, 3871, 117, 2, 70, "Subsubsection"], Cell[96393, 3875, 95, 1, 70, "Input"], Cell[96491, 3878, 73, 1, 70, "Input"], Cell[96567, 3881, 70, 1, 70, "Input"], Cell[96640, 3884, 78, 1, 70, "Input"], Cell[96721, 3887, 76, 1, 70, "Input"] }, Open ]], Cell[96812, 3891, 121, 2, 70, "Subsubsection"], Cell[CellGroupData[{ Cell[96958, 3897, 120, 2, 70, "Subsubsection"], Cell[97081, 3901, 157, 3, 70, "Input"], Cell[CellGroupData[{ Cell[97263, 3908, 85, 1, 70, "Input"], Cell[97351, 3911, 162, 8, 70, "Output"] }, Open ]], Cell[97528, 3922, 169, 4, 70, "Text"], Cell[97700, 3928, 58, 1, 70, "Input"], Cell[97761, 3931, 567, 9, 70, "Text"], Cell[CellGroupData[{ Cell[98353, 3944, 126, 3, 70, "Input"], Cell[98482, 3949, 539, 19, 70, "Output"] }, Open ]], Cell[99036, 3971, 90, 1, 70, "Input"], Cell[99129, 3974, 81, 1, 70, "Input"], Cell[99213, 3977, 85, 1, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[99347, 3984, 109, 2, 70, "Subsection"], Cell[99459, 3988, 99, 1, 70, "Input"], Cell[99561, 3991, 90, 1, 70, "Input"], Cell[99654, 3994, 70, 1, 70, "Input"], Cell[99727, 3997, 77, 1, 70, "Input"], Cell[99807, 4000, 68, 1, 70, "Input"], Cell[CellGroupData[{ Cell[99900, 4005, 83, 1, 70, "Input"], Cell[99986, 4008, 112, 6, 70, "Output"] }, Open ]], Cell[100113, 4017, 99, 1, 70, "Input"], Cell[100215, 4020, 97, 1, 70, "Input"], Cell[CellGroupData[{ Cell[100337, 4025, 110, 2, 70, "Input"], Cell[100450, 4029, 125, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[100612, 4040, 132, 3, 70, "Input"], Cell[100747, 4045, 125, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[100909, 4056, 68, 1, 70, "Input"], Cell[100980, 4059, 110, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[101127, 4070, 85, 1, 70, "Input"], Cell[101215, 4073, 110, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[101362, 4084, 88, 1, 70, "Input"], Cell[101453, 4087, 544, 18, 70, "Output"] }, Open ]], Cell[102012, 4108, 124, 3, 70, "Input"], Cell[CellGroupData[{ Cell[102161, 4115, 68, 1, 70, "Input"], Cell[102232, 4118, 574, 18, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[102843, 4141, 73, 1, 70, "Input"], Cell[102919, 4144, 265, 10, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[103221, 4159, 177, 3, 70, "Input"], Cell[103401, 4164, 157, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[103595, 4176, 155, 3, 70, "Input"], Cell[103753, 4181, 161, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[103951, 4193, 60, 1, 70, "Input"], Cell[104014, 4196, 108, 6, 70, "Output"] }, Open ]], Cell[104137, 4205, 83, 1, 70, "Input"], Cell[104223, 4208, 357, 6, 70, "Text"], Cell[104583, 4216, 194, 4, 70, "Text"], Cell[104780, 4222, 84, 1, 70, "Input"], Cell[104867, 4225, 70, 1, 70, "Input"], Cell[104940, 4228, 126, 3, 70, "Input"], Cell[CellGroupData[{ Cell[105091, 4235, 68, 1, 70, "Input"], Cell[105162, 4238, 544, 18, 70, "Output"] }, Open ]], Cell[105721, 4259, 83, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[105841, 4265, 100, 2, 70, "Subsection"], Cell[CellGroupData[{ Cell[105966, 4271, 83, 1, 70, "Input"], Cell[106052, 4274, 112, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[106201, 4285, 67, 1, 70, "Input"], Cell[106271, 4288, 110, 8, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[106418, 4301, 61, 1, 70, "Input"], Cell[106482, 4304, 104, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[106623, 4315, 58, 1, 70, "Input"], Cell[106684, 4318, 118, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[106839, 4329, 62, 1, 70, "Input"], Cell[106904, 4332, 344, 6, 70, "Print"] }, Open ]], Cell[107263, 4341, 270, 5, 70, "Input"], Cell[CellGroupData[{ Cell[107558, 4350, 72, 1, 70, "Input"], Cell[107633, 4353, 184, 8, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[107854, 4366, 72, 1, 70, "Input"], Cell[107929, 4369, 184, 8, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[108150, 4382, 74, 1, 70, "Input"], Cell[108227, 4385, 184, 8, 70, "Output"] }, Open ]], Cell[108426, 4396, 109, 2, 70, "Input"], Cell[CellGroupData[{ Cell[108560, 4402, 61, 1, 70, "Input"], Cell[108624, 4405, 110, 8, 70, "Output"] }, Open ]], Cell[108749, 4416, 674, 14, 70, "Text"], Cell[109426, 4432, 172, 6, 70, "Input"], Cell[CellGroupData[{ Cell[109623, 4442, 66, 1, 70, "Input"], Cell[109692, 4445, 134, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[109863, 4457, 79, 1, 70, "Input"], Cell[109945, 4460, 149, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[110131, 4472, 103, 1, 70, "Input"], Cell[110237, 4475, 134, 7, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[110408, 4487, 67, 1, 70, "Input"], Cell[110478, 4490, 134, 7, 70, "Output"] }, Open ]], Cell[110627, 4500, 104, 1, 70, "Input"], Cell[110734, 4503, 99, 1, 70, "Input"], Cell[CellGroupData[{ Cell[110858, 4508, 94, 1, 70, "Input"], Cell[110955, 4511, 117, 8, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[111109, 4524, 59, 1, 70, "Input"], Cell[111171, 4527, 106, 6, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[111314, 4538, 64, 1, 70, "Input"], Cell[111381, 4541, 117, 8, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[111535, 4554, 92, 1, 70, "Input"], Cell[111630, 4557, 113, 8, 70, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[111780, 4570, 57, 1, 70, "Input"], Cell[111840, 4573, 113, 8, 70, "Output"] }, Open ]], Cell[111968, 4584, 388, 7, 70, "Text"], Cell[CellGroupData[{ Cell[112381, 4595, 66, 1, 70, "Input"], Cell[112450, 4598, 117, 8, 70, "Output"] }, Open ]] }, Closed]] }, Closed]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)