(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@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[ 6718, 243]*) (*NotebookOutlinePosition[ 7484, 269]*) (* CellTagsIndexPosition[ 7440, 265]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["The Lifting Method", "Title"], Cell["\<\ Wavelet Workshop June 6-9, 2007 University of St. Thomas\ \>", "Subtitle"], Cell[CellGroupData[{ Cell["Objectives", "Section"], Cell["\<\ The purpose of this notebook is to introduce you to the lifting method. \ \>", "Text"] }, Open ]], Cell[CellGroupData[{ Cell["DiscreteWavelets", "Section"], Cell[TextData[{ StyleBox["You should run this cell each time you open this notebook!!", FontColor->RGBColor[1, 0, 0]], " It loads the ", StyleBox["Mathematica", FontSlant->"Italic"], " package ", StyleBox["DiscreteWavelets", FontFamily->"Courier"], " for use in subsequent computations." }], "Text"], Cell[BoxData[ \(<< DiscreteWavelets`DiscreteWavelets`\)], "Input", FontColor->GrayLevel[0.500008]] }, Open ]], Cell[CellGroupData[{ Cell["Help on DiscreteWavelets", "Section"], Cell[TextData[{ "If you ever need help with ", StyleBox["DiscreteWavelets", FontFamily->"Courier"], ", go to ", StyleBox["Help", FontSlant->"Italic"], ", then ", StyleBox["Help Browser", FontSlant->"Italic"], ", and click on ", StyleBox["AddOns & Links", FontSlant->"Italic"], ". If you scroll down you will find ", StyleBox["DiscreteWavelets", FontFamily->"Courier"], ". " }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["The One-Dimensional LeGall Wavelet Transform", "Section"], Cell["\<\ The package DiscreteWavelets has a function for computing the LeGall wavelet \ transform. It is called LWT1D1. Here is an example:\ \>", "Text"], Cell[BoxData[{ \(\(v = Table[Random[Integer, {0, 10}], {16}];\)\), "\[IndentingNewLine]", \(wt = LWT1D1[v]\)}], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["A Module for the LeGall Wavelet Transform", "Section"], Cell["", "Text"], Cell["\<\ Our first step is to partition the input into even and odd portions:\ \>", "Text"], Cell[BoxData[{ \(\(z = Array[vv, {16}];\)\), "\[IndentingNewLine]", \(e = Take[z, {2, Length[z], 2}]\), "\n", \(o = Take[z, {1, Length[z], 2}]\)}], "Input"], Cell["\<\ Now we need to append the o vector with the last element of o.\ \>", "Text"], Cell[BoxData[ \(o = Append[o, Last[o]]\)], "Input"], Cell["Now we can easily compute the highpass portion!", "Text"], Cell[BoxData[{ \(\(a = Partition[o, 2, 1];\)\), "\[IndentingNewLine]", \(d = e - Map[Total, a]/2\)}], "Input"], Cell["\<\ Next we need a copy of d with the first element of d prepended to d.\ \>", "Text"], Cell[BoxData[ \(dd = Prepend[d, First[d]]\)], "Input"], Cell["The last step is to compute s!", "Text"], Cell[BoxData[{ \(\(a = Partition[dd, 2, 1];\)\), "\[IndentingNewLine]", \(\(s = Drop[o, \(-1\)] + Map[Total, a]/4;\)\)}], "Input"], Cell["The module is", "Text"], Cell[BoxData[ \(\(\(sLWT1D1[v_] := Module[{o, e, oo, a, d, dd, s}, \[IndentingNewLine]\t e = Take[v, {2, Length[z], 2}]; \n\t\ \ \ \ \ \ \ o = Take[v, {1, Length[z], 2}]; \[IndentingNewLine]\t o = Append[o, Last[o]]; \[IndentingNewLine]\t a = Partition[o, 2, 1]; \[IndentingNewLine]\t d = e - Map[Total, a]/2; \[IndentingNewLine]\t dd = Prepend[d, First[d]]; \[IndentingNewLine]\t a = Partition[dd, 2, 1]; \[IndentingNewLine]\t s = Drop[o, \(-1\)] + Map[Total, a]/4; \[IndentingNewLine]\t Return[Join[s, d]];\[IndentingNewLine]];\)\(\[IndentingNewLine]\) \)\)], "Input"], Cell[BoxData[{ \(\(v = Table[Random[Integer, {0, 100}], {16}];\)\), "\n", \(\(wt = LWT1D1[v];\)\), "\n", \(\(wt1 = sLWT1D1[v];\)\), "\n", \(wt1 - wt\)}], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["A Module for the Inverse LWT", "Section"], Cell["\<\ In the cell below, write the module ILWT1D1 that computes one iteration of \ the inverse one-dimensional LWT.\ \>", "Text"], Cell[BoxData[ \(\(ILWT1D1[v_] := Module[\({ (*\ Put\ local\ variables\ here\ *) }\)\(,\)\[IndentingNewLine] (*\ Put\ code\ here\ *) \[IndentingNewLine]];\)\)], "Input"], Cell["\<\ Test your code on the cell below: \ \>", "Text"], Cell[BoxData[{ \(\(v = Table[Random[Integer, {0, 100}], {16}];\)\), "\[IndentingNewLine]", \(\(wt = LWT1D1[v];\)\), "\[IndentingNewLine]", \(v - ILWT1D1[wt]\)}], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Mapping Integers to Integers", "Section"], Cell["\<\ Use the directive IntegerMap set to True to map integers to integers with the \ LeGall wavelet transform:\ \>", "Text"], Cell[BoxData[{ \(v = Table[Random[Integer, {0, 100}], {16}]\), "\[IndentingNewLine]", \(wt = N[LWT1D1[v]]\), "\[IndentingNewLine]", \(wt1 = LWT1D1[v, IntegerMap \[Rule] True]\)}], "Input"], Cell["We can compute the inverse in the same way:", "Text"], Cell[BoxData[ \(newv = ILWT1D1[wt1, IntegerMap \[Rule] True]\)], "Input"] }, Open ]] }, Open ]] }, FrontEndVersion->"5.2 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 685}}, AutoGeneratedPackage->None, ScreenStyleEnvironment->"Presentation", WindowSize->{1016, 651}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, ShowSelection->True, StyleDefinitions -> "Report.nb" ] (******************************************************************* 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[1776, 53, 35, 0, 117, "Title"], Cell[1814, 55, 84, 4, 143, "Subtitle"], Cell[CellGroupData[{ Cell[1923, 63, 29, 0, 96, "Section"], Cell[1955, 65, 96, 3, 62, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[2088, 73, 35, 0, 96, "Section"], Cell[2126, 75, 324, 10, 63, "Text"], Cell[2453, 87, 104, 2, 51, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[2594, 94, 43, 0, 96, "Section"], Cell[2640, 96, 429, 17, 64, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[3106, 118, 63, 0, 96, "Section"], Cell[3172, 120, 156, 3, 62, "Text"], Cell[3331, 125, 138, 3, 77, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[3506, 133, 60, 0, 96, "Section"], Cell[3569, 135, 16, 0, 40, "Text"], Cell[3588, 137, 92, 2, 40, "Text"], Cell[3683, 141, 170, 3, 103, "Input"], Cell[3856, 146, 86, 2, 40, "Text"], Cell[3945, 150, 55, 1, 51, "Input"], Cell[4003, 153, 63, 0, 40, "Text"], Cell[4069, 155, 119, 2, 77, "Input"], Cell[4191, 159, 92, 2, 40, "Text"], Cell[4286, 163, 58, 1, 51, "Input"], Cell[4347, 166, 46, 0, 40, "Text"], Cell[4396, 168, 139, 2, 77, "Input"], Cell[4538, 172, 29, 0, 40, "Text"], Cell[4570, 174, 680, 12, 337, "Input"], Cell[5253, 188, 181, 4, 129, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[5471, 197, 47, 0, 96, "Section"], Cell[5521, 199, 133, 3, 40, "Text"], Cell[5657, 204, 209, 4, 103, "Input"], Cell[5869, 210, 62, 3, 62, "Text"], Cell[5934, 215, 193, 4, 103, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[6164, 224, 47, 0, 96, "Section"], Cell[6214, 226, 129, 3, 40, "Text"], Cell[6346, 231, 202, 3, 103, "Input"], Cell[6551, 236, 59, 0, 40, "Text"], Cell[6613, 238, 77, 1, 51, "Input"] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)