• CompassRed@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      10
      ·
      2 months ago

      A vector space is a collection of vectors in which you can scale vectors and add vectors together such that the scaling and addition operations satisfy some nice relationships. The 2D and 3D vectors that we are used to are common examples. A less common example is polynomials. It’s hard to think of a polynomial as having a direction and a magnitude, but it’s easy to think of polynomials as elements of the vector space of polynomials.

    • Codex@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 months ago

      Start with a list of numbers, like [1 2 3]. That’s it, a list of numbers. If you treat those numbers like they represent something though, and apply some rules to them, you can do math.

      One way to consider them is as coordinates. If we had a 3-D coordinate grid, then [1 2 3] could be the point at x = 1, y = 2, and z = 3. You could also consider the list of numbers to be a line with an arrow at one end, starting from the point at [0 0 0] and stopping at the other point. This is a geometric vector: a thing with a direction and a magnitude. Still just a list of numbers though.

      Now, what if you wanted to take that list and add another one, say [4 5 6], how might you do it? You could concatenate the lists, like [1 2 3 4 5 6] and that has meaning and utility in some cases. But most of the time, you’d like “adding vectors” to give you a result that maps to something geometric such as putting the lines with arrows end-to-end and seeing what new vector that is. You can do that by adding each element of the 2 vectors. And, almost magically, the point at [5 7 9] is where you’d end up if you first went to [1 2 3] and then traveled [4 5 6] further. We made no drawings, but the math modeled the situation well enough to give us an answer anyway.

      Going further, maybe you want to multiply vectors, raise them to exponents, and more? There are several ways to do these, and each has different meanings when you think about them with shapes and geometry.

      But vectors are just lists of numbers, they don’t have to be geometric things. [1 2 3] could also represent the coefficients of a function, say 0 = 1x^2 + 2x + 3(x^0). You can still do the same math to the vector, but now it means something else. It models a function, and combining it with other vectors let’s you combine and transform functions just like if they were lines and shapes.

      When you get into vectors beyond 3 elements, there’s no longer a clean geometric metaphor to help you visualize. A vector with 100 elements can be used just as well as one with 2, but we can’t visualize a space with 100-dimensions. These are “vector spaces” and a vector is a single point (or rather, points to a point) within them.

      Matrices are similar but allow for deeper models of more complex objects.

    • ulterno@lemmy.kde.social
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 months ago

      Life when humans being vectors is considered acceptable and the one calling them out is called an asshole.

  • Codex@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    2 months ago

    A vector is a variable-length collection of homogeneous elements. For fixed-length, use an array if homogeneous or a tuple if not. For heterogeneous, untyped collections, please consider one of the many “list” variants.