• Codex@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    19 days 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.

    • CompassRed@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      1
      ·
      20 days 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.

    • WolfLink@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      0
      ·
      19 days ago

      A vector space is when you can:

      • add two Things
      • multiply a Thing by any real number

      And get another Thing that’s the same Kind of Thing.

      By Thing I mean Vector and by Kind of Thing I mean element of the same Vector Space.

      Examples of vector spaces:

      • real numbers
      • complex numbers
      • sets of N numbers (what most people think of when they hear “vector”)
      • matrices
      • polynomials
      • functions
      • quantum states of a given system
      • quantities of apples sold, classified by type of apple

      Examples of Not Vector Spaces:

      • integers
      • negative numbers
      • nonzero numbers
      • unitary matrices
      • apples

      Yeah a few of these come with asterisks I’m happy to answer questions but don’t want to argue with pedants.

      • Hadriscus@lemm.ee
        link
        fedilink
        English
        arrow-up
        0
        ·
        19 days ago

        wow didn’t expect this to be so general. How do integers not fit into the definition ? you can add them together and obtain another integer

        • someacnt_@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          19 days ago

          When talking about vector space, you usually need the “scalar (field)”, and scalars need inverse to be well-defined.

          So for integers, the scalar should be integer itself. Sadly, inverse of integers stops being an integer, from where all sorts of number theoretic nightmare occurs Instead, integers form a ring, and is a module over scalar of integers.