{"id":265,"date":"2015-08-28T23:30:47","date_gmt":"2015-08-29T03:30:47","guid":{"rendered":"http:\/\/aristotle2digital.blogwyrm.com\/?p=265"},"modified":"2015-08-28T18:08:20","modified_gmt":"2015-08-28T22:08:20","slug":"images-representations-and-programming","status":"publish","type":"post","link":"https:\/\/aristotle2digital.blogwyrm.com\/?p=265","title":{"rendered":"Images, Representations, and Programming"},"content":{"rendered":"<p>It\u2019s an old idea.\u00a0 Someone you know holds up a photograph depicting something familiar, say a beautiful car, maybe a Corvette, and asks you \u201cwhat this?\u201d.\u00a0 You answer, \u201cit\u2019s a Corvette,\u201d and are greeted with the cheeky response, \u201cNo! silly, it\u2019s a picture.\u201d<\/p>\n<p>This\u00a0simple joke, while annoying, makes an important philosophical point about keeping a clear distinction between the image of a thing and the thing itself.\u00a0 As important as this distinction is for basic reasoning and logic, it is much more important to keep it straight in the practice of mathematics and computing \u2013 particularly in the study of vectors.<\/p>\n<p>Formally, a vector is any kind of object that belongs to a class of like objects that all \u2018obey\u2019 a set of rules that define how they combine to form new objects also in the same class.\u00a0 For simplicity, a vector will be denoted in underlined, bold face but, as will discussed below, there are other common ways to denote the vectors, all of which suffer from \u2018Corvette-problem\u2019 above.\u00a0 The set of combination rules are:<\/p>\n<ol>\n<li>There is a combination rule \u2018+\u2019 such that <strong><u>U<\/u> <\/strong>+ <strong><u>V<\/u> <\/strong>is a vector if <strong><u>U<\/u><\/strong>, <strong><u>V<\/u><\/strong> are vectors<\/li>\n<li><strong><u>U<\/u> <\/strong>+ <strong><u>V<\/u> <\/strong>= <strong><u>V<\/u> <\/strong>+ <strong><u>U<\/u> <\/strong>(order doesn\u2019t matter)<\/li>\n<li><strong><u>U<\/u> <\/strong>+ (<strong><u>V<\/u> <\/strong>+ <strong><u>W<\/u><\/strong>) = (<strong><u>U<\/u> <\/strong>+ <strong><u>V<\/u><\/strong>) + <strong><u>W<\/u> <\/strong>(the combination rule is associative)<\/li>\n<li><strong><u>0<\/u><\/strong> + <strong><u>U<\/u> <\/strong>= <strong><u>U<\/u> <\/strong>+<strong> <u>0<\/u> <\/strong>=<strong> <u>U<\/u><\/strong> (there is a zero vector)<\/li>\n<li><strong><u>U<\/u> <\/strong>+ (<strong><u>-U<\/u><\/strong>) = <strong><u>0<\/u> <\/strong>(there is a way to add up vectors to get a zero one)<\/li>\n<li>There is a scaling rule such that the product k<strong><u>U<\/u><\/strong> is a vector, (k is an ordinary complex number)<\/li>\n<li>k(<strong><u>U<\/u><\/strong> + <strong><u>V<\/u><\/strong>) = k<strong><u>U<\/u><\/strong> + k<strong><u>V<\/u><\/strong><\/li>\n<li>(k+l)<strong><u>U<\/u> = <\/strong>k<strong><u>U<\/u><\/strong> + l<strong><u>U<\/u><\/strong> (where k &amp; l are ordinary complex numbers)<\/li>\n<li>k(l<strong><u>U<\/u>) = <\/strong>(kl)<strong><u>U<\/u><\/strong><\/li>\n<li>1<strong><u>U<\/u><\/strong> = <strong><u>U<\/u><\/strong><\/li>\n<\/ol>\n<p>Some purist out there may object and point out that only occasionally does an author actually enumerate all 10 items above separately (even though such a purist will concede that all 10 must be there in some form or another).\u00a0 The purist may also go on to say that some authors prefer 0<strong><u>U<\/u><\/strong> = <strong><u>0<\/u><\/strong> to rule #5.\u00a0 But none of these details are particularly important.<\/p>\n<p>What is important is that the rules are abstract and simple.\u00a0 They apply equally well to vectors defined as a directed arrows as they do to vectors defined as column arrays of numbers as they do to vectors defined in terms of partial derivatives.\u00a0 They apply equally well to vectors that we can observe and touch, for example pulls and pushes on an object, as they do to those that live in an abstract space like column arrays or partial derivatives, whose sole existence is built from ideas in the mind and symbols on the page.<\/p>\n<p><a href=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2015\/08\/vector_representations.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-270\" src=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2015\/08\/vector_representations.jpg\" alt=\"vector_representations\" width=\"1289\" height=\"634\" srcset=\"https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2015\/08\/vector_representations.jpg 1289w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2015\/08\/vector_representations-300x148.jpg 300w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2015\/08\/vector_representations-1024x504.jpg 1024w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2015\/08\/vector_representations-810x398.jpg 810w\" sizes=\"auto, (max-width: 1289px) 100vw, 1289px\" \/><\/a><\/p>\n<p>As the study of vectors deepened, several clarifying points made computation with them very simple.\u00a0 The most powerful, and hence most dangerous, realization is the point that an arbitrary vector can be decomposed in terms of primitive vectors, usually referred to as basis vectors.\u00a0 This realization, which arguably finds its crystallization in the work of Descartes, reduces the infinity of possibilities into a manageable number of chunks and is the driving force between the 10 rules listed above.<\/p>\n<p>The manageable chunks consist of a set of basic vectors whose number equals the number of dimensions in the space (1 for a line, 2 for a plane, 3 for a volume, and so on) and a list of the numbers whose length also equals the number of dimensions.<\/p>\n<p>And here is the first of the traps.\u00a0 Once the basis vectors are agreed-upon and understood, they can be pushed to the back and the list (called a list of components) can be manipulated without much additional thought.\u00a0 The list becomes a stand-in for the original object in analogy for the way that the image of the car becomes a stand-in for the car itself.\u00a0 The list is now a representation of the original object.<\/p>\n<p>This blurring between the original object and its representation becomes even more fuzzy with some additional reflection.\u00a0 A list is also a valid choice as an original object in the vector space since it also obeys the 10 rules (with the appropriate definition of \u2018+\u2019 and \u2018x\u2019).\u00a0 To show how strange this is in the physical world, consider the possibility of getting into the picture of the car, kicking over its motor, and taking it for a spin.<\/p>\n<p>It\u2019s no wonder that otherwise well-trained and intelligent people get hung up over vectors and their manipulations each and every day.\u00a0 Functionally, every object shown in the figure above is equivalent to a list of numbers.<\/p>\n<p>Now suppose that one wanted to represent these abstract objects in a computer language.\u00a0 Well, as long as one was careful, one could actually exploit these ambiguities and simply say that the list will always be the representation.\u00a0 This is actually what most, if not all, languages do, though they differ in the terminology, with many choosing array, some choose vector, and others stay with list.<\/p>\n<p>Of course, most users aren\u2019t careful about maintaining that distinction and, I suppose, most aren\u2019t even really conscious of it.\u00a0 But one hopes that at least the language creators do.<\/p>\n<p>In most cases, this hope is realized.\u00a0 Many languages make the distinction between a heterogeneous list (not a vector) and a homogeneous list (which is, or at least can be, a vector).\u00a0 Some languages, like those underlying the computer algebra system Maple, use the word vector to connote a special kind of list.\u00a0 However, sadly, sometimes a language gets befuddled and either loses these distinctions or creates ones where none exist.<\/p>\n<p>An example of the later problem comes from the numpy\/scipy family of packages used in the Python programming language.\u00a0 To properly discuss this minor defect in what is really a great set of packages, I need to add one more ingredient that adds a few more ingredients to the vector space turning it into a metric space.<\/p>\n<p>In a metric space, there is added to the original 10 rules an additional notion of the length of a vector.\u00a0 A new combination rule, usually denoted with a dot \u2018.\u2019, allows for two vectors to be combined to produce not another vector but a number, specifying how much of the length of one of the two lies along the other.\u00a0 This combination is defined such that <strong><u>A<\/u><\/strong>.<strong><u>B<\/u> = <u>B<\/u><\/strong>.<strong><u>A<\/u><\/strong> and that <strong><u>A<\/u><\/strong>.<strong><u>A<\/u><\/strong> is the square of the length of <strong><u>A<\/u><\/strong>. This combination rule is called variously as a dot product, an inner product, or a scalar product.<\/p>\n<p>Once defined, another operation can be derived from these 11 rules.\u00a0 This operation, called the cross product, mixes the components from various places in the list to get new components. \u00a0It depends on the dot product to bring meaning to the idea of having the component from one dimension multiplying the component from another dimension and, like the dot product, actually results in an object that doesn\u2019t (properly) belong in the vector space.\u00a0 In other words, both the dot and the cross products take two vectors and produce something different.<\/p>\n<p>In addition, both rules belong to the space itself since they both apply to any two pairs of vectors.\u00a0 Unfortunately, the numpy\/scipy team missed this concept entirely.<\/p>\n<p>In numpy, the vector space as a whole can be thought of as being represented by the family of functions that make up numpy proper.\u00a0 These functions include the function \u2018array\u2019 for making a new array and the function \u2018cross\u2019 for taking the cross product.\u00a0 Strangely, the function \u2018dot\u2019 is not found in the collection of numpy functions but rather is a member function of the \u2018array\u2019 object itself.\u00a0 A minor flaw in a really fine set of packages but a solid proof that it isn\u2019t always easy to the tell the image from the thing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It\u2019s an old idea.\u00a0 Someone you know holds up a photograph depicting something familiar, say a beautiful car, maybe a Corvette, and asks you \u201cwhat this?\u201d.\u00a0 You answer, \u201cit\u2019s a&#8230; <a class=\"read-more-button\" href=\"https:\/\/aristotle2digital.blogwyrm.com\/?p=265\">Read more &gt;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-265","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/posts\/265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=265"}],"version-history":[{"count":0,"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/posts\/265\/revisions"}],"wp:attachment":[{"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}