• Aqarius@lemmy.world
    link
    fedilink
    English
    arrow-up
    19
    ·
    17 hours ago

    You know how you can write “5+5+5-4-4-4” as “35-34”, and then use it for weird shortcuts like “3*(5-4)”? Well, matrices make for relatively easy handling of certain systems of equations, letting you fiddle with the whole system at once instead of restating equations one by one.

      • Aqarius@lemmy.world
        link
        fedilink
        English
        arrow-up
        6
        ·
        15 hours ago

        Essentially.

        A straightforward example would be an equation system: 2x+4y=10, 3x+5y=13. You could solve it manually, or you could call Cramer’s rule and plug the numbers into the formula:

        Ax+By=C
        Dx+Ey=F

        x=[CB/FE]/[AB/DE] = (CE-BF)/(AE-BD)=(10*5-4*13) / (2*5 - 3*4) = (50-52)/(10-12)=1,
        y=[AC/DF]/[AB/DE]=AF-CD / AE-BD = -4/-2=2

        Pure algo, no thinking required. Also note that you don’t strictly need x to get y and vice versa.

        In a more complex example: You’re making a program to draw something in 2D. You could implement mirroring, rotation, scaling etc…, or, you could declare each point (xy) a vector V=[X Y], implement matrices, and then V times [1 0/0 1] gives you V, [-1 0/0 1] gives you V mirrored on the Y axis, [1 0/0 -1] mirrors on the X axis, [j 0/0 j] scales it by j, [cosw -sinw/sinw cosw] rotates it by w… Makes life much easier.

      • lime!@feddit.nu
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        15 hours ago

        that’s a good parallel. as for more uses, a graphics card is basically a big parallel math coprocessor for matrices. so CFD? matrices. call of duty? matrices. all this “ai” stuff nowadays? matrices.