(*^ ::[ frontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.1"; macintoshStandardFontEncoding; paletteColors = 128; automaticGrouping; currentKernel; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times"; ; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times"; ; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times"; ; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times"; ; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times"; ; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times"; ; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; ; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 12, "Courier"; ; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R65535, L-5, 12, "Courier"; ; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier"; ; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier"; ; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; ; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = leftheader, inactive, L2, 12, "Times"; ; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times"; ; fontset = leftfooter, inactive, L2, 12, "Times"; ; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; ; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; ] :[font = special1; inactive; preserveAspect; ] Vector Spaces, II -- Two, Three, ... N, ... Infinity Using Mathematica we can experiment with some crude images. They are crude in two ways--first, they are essentially monochromatic, black-and-white, rather than in color; and, second, they are very low resolution. We are using crude images because we can work with them simply but the ideas we develop with crude images work equally well with more refined images. ;[s] 5:0,0;24,1;76,0;94,2;105,0;456,-1; 3:3,13,9,Times,0,12,0,0,0;1,13,9,Times,1,12,0,0,0;1,13,9,Times,2,12,0,0,0; :[font = input; initialization; closed; preserveAspect; ] *) VisibleColor[x_] := Which[x < 0, RGBColor[0, 0, 1], x <= 1, RGBColor[x, x, x], True, RGBColor[1, 0, 0]] ShowImage[a_, n_, k_] := Show[Graphics[ Table[{VisibleColor[a[[i]][[j]]], Rectangle[{j - 1, n - i}, {j, n - i + 1}]}, {i, 1, n}, {j, 1, k}], PlotRange -> {{0, k}, {0, n}}, AspectRatio -> Automatic]] (* :[font = special1; inactive; preserveAspect; ] The procedure ShowImage defined in the closed initialization cell above displays an image defined by a matrix. It has three arguments 1. An (n by k)- matrix, A, whose entries give the intensity of light for each pixel in an image with n lines, each having k pixels. 0 represents black and 1 represents the maximum intensity on your particular screen. If an entry is outside the range [0, 1] then ShowImage colors the corresponding pixel blue if the entry is negative and red if it is greater than one. These colors are meant to indicate errors, not as part of an image in color. 2. n -- the number of lines in the image. 3. k -- the number of pixels in each line. The following cell illustrates how ShowImage is used. Evaluate it now. ;[s] 25:0,0;25,3;34,0;200,3;201,0;434,3;441,0;449,3;458,0;492,1;496,0;514,1;522,0;527,2;530,0;540,2;556,0;671,3;672,0;747,3;748,0;852,3;861,0;873,4;890,0;894,-1; 5:13,13,9,Times,0,12,0,0,0;2,13,9,Times,0,12,0,0,65535;2,13,9,Times,0,12,65535,0,0;7,13,9,Times,1,12,0,0,0;1,13,9,Times,1,12,65535,0,0; :[font = input; preserveAspect; ] Demo := {{-1.00, 0.00, 0.11, 0.22}, { 0.33, 0.44, 0.55, 0.66}, { 0.77, 0.88, 0.99, 2.00}} MatrixForm[Demo] ShowImage[Demo, 3, 4] :[font = special1; inactive; preserveAspect; ] We will work with two images, one showing the letter "L" and the other showing the letter "H". The cell below defines matrices representing these two images and displays them using the procedure ShowImage. Evaluate it now. ;[s] 8:0,0;59,1;60,0;96,1;97,0;202,1;211,0;214,2;231,-1; 3:4,13,9,Times,0,12,0,0,0;3,13,9,Times,1,12,0,0,0;1,13,9,Times,1,12,65535,0,0; :[font = input; preserveAspect; ] ImageOne := {{1, 0, 1, 1, 1}, {1, 0, 1, 1, 1}, {1, 0, 1, 1, 1}, {1, 0, 1, 1, 1}, {1, 0, 0, 0, 1}} ImageTwo := {{0, 1, 1, 1, 0}, {0, 1, 1, 1, 0}, {0, 0, 0, 0, 0}, {0, 1, 1, 1, 0}, {0, 1, 1, 1, 0}} ShowImage[ImageOne, 5, 5] ShowImage[ImageTwo, 5, 5] :[font = special1; inactive; preserveAspect; ] The following cell creates a series of twenty-one frames with ImageOne gradually changing to ImageTwo. Notice that the key algebraic expression (1 - t) ImageOne + t ImageTwo is exactly the same algebraic expression that we used to move from one point to another point in the plane. Evaluate the cell below. Then, if your computer supports animation, animate the resulting frames to produce a movie. ;[s] 10:0,0;68,1;76,0;100,1;108,0;198,2;227,1;264,0;375,3;399,0;493,-1; 4:5,13,9,Times,0,12,0,0,0;3,13,9,Times,1,12,0,0,0;1,13,9,Times,1,12,65535,0,65535;1,13,9,Times,1,12,65535,0,0; :[font = input; preserveAspect; ] Do[ShowImage[(1 - t) ImageOne + t ImageTwo, 5, 5], {t, 0, 1, 1/20}] ;[s] 3:0,0;13,1;42,0;77,-1; 2:2,12,10,Courier,1,12,0,0,0;1,12,10,Courier,1,12,65535,0,65535; :[font = special1; inactive; preserveAspect; fontColorRed = 65535; ] Exercises 1. Create a series of 21 frames starting with ImageOne and gradually becoming completely black. 2. Create a series of 21 frames starting with ImageTwo and gradually becoming completely white. If your computer supports animation, animate the two sequences you created above. ;[s] 5:0,0;198,1;206,0;308,1;316,0;452,-1; 2:3,13,9,Times,0,12,65535,0,0;2,13,9,Times,1,12,65535,0,0; ^*)