• Inky@lemmy.ca
    link
    fedilink
    arrow-up
    77
    arrow-down
    3
    ·
    1 year ago

    This post confuses me. Why would code be simpler than the math notation? Both involve symbolic abstraction of basically the same complexity

    • hglman@lemmy.ml
      link
      fedilink
      arrow-up
      88
      arrow-down
      4
      ·
      1 year ago

      Its got to be a relatively small group who knows enough to understand loops and is also afraid of math symbols.

      • DogMuffins@discuss.tchncs.de
        link
        fedilink
        arrow-up
        20
        arrow-down
        2
        ·
        1 year ago

        Maybe not so small?

        I never encountered these math symbols but for loops are like step 3 in any programming language after variables and conditionals

        • stoneparchment@possumpat.io
          link
          fedilink
          arrow-up
          14
          arrow-down
          3
          ·
          1 year ago

          lol, like 2.5% of the USA are programmers and even if we say twice that number have experimented and taken programming classes, that’s like 1 in 20 people who would even have ever encountered a for loop. This nsf report says ~70% of highschoolers have taken Algebra 2 or a more advanced math course, which is when sum notation is usually introduced. I think 70% is a little greater than 5%!

          • BeautifulMind ♾️@lemmy.world
            link
            fedilink
            arrow-up
            2
            ·
            1 year ago

            That’s interesting to hear; somehow my algebra 2 skipped sum notation (and it wasn’t remedially covered in subsequent math classes) but I’ve been writing code for decades now and seeing it in code totally explains the sum notation for me

          • kartoffelsaft@programming.dev
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            Huh. When I took Calculus II in community college, the professor introduced sum notation and like 2/3 of the class was like “wow that’s cool I didn’t know about that”. I don’t remember ever being formally taught it before that but it still surprises be how few people where already familiar with it.

          • AnarchistArtificer@slrpnk.net
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            I was great at maths in school, was in all the advanced classes and I found it so fun it didn’t feel like work to me. I learned a lot of the notation, but because I didn’t study maths further, I became rusty. With programming, I never really learned it, I just kept coming into contact with it as part of my post university work (in science), and gradually, I picked up some basics. The coding basics I did get feel much more familiar to me than the maths concepts now, because I literally couldn’t avoid coming into contact with coding in my work.

            The maths they teach in school also is generally very pure maths, and that can make the concepts remain quite abstract. Matrices, for example, made way more intuitive sense to me when I used them as a scientist than when they were taught to me as a maths student.

      • Choco1ateCh1p@lemmy.world
        link
        fedilink
        arrow-up
        12
        arrow-down
        2
        ·
        1 year ago

        I believe this group could be bigger than some may think. I, and the team I work with, work with for loops similar to these on a regular basis. And only one of us has a bachelor’s degree in math. The rest of us don’t really understand the math unless it is applied.

      • charlieb@kbin.social
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        I never made it into algebra in grade school, my scores weren’t good enough. but I took a liking to software dev and the ability to create digitally. Self taught myself all the variables and flow controls and OOP, now been a professional developer for 15 years.

        However I still suck at math, and these fancy symbols still scare me probably because they were never properly explained. But yeah, I fit right in the mold you describe. Glad I have the computer to crunch the numbers for me.

      • karstin@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        I’m in that group I think. I do like a liiitle bit of coding in some tiny specific progrqmming language in one piece of software that I use. I understand the basics but try to avoid having to do it. But while code is a little scary to me, math is much scarier lol

    • sf1tzp@programming.dev
      link
      fedilink
      arrow-up
      11
      arrow-down
      1
      ·
      edit-2
      1 year ago

      Not really sure if this answers your question (I agree with you, ultimately), but here’s my experience:

      At the college I attended, these sigma/pi expressions weren’t taught until the end of Calculus 2, but I wanted to take an Algorithms class - which had calc 2 as a prerequisite.

      I got an exception from my advisor which allowed me to take Algorithms before the pre-req. In my experience, these concepts were easily learned in the context of algorithmic complexity.

      Some might be barred from learning important theory in computer science by “brutal” math classes at university. They might find solace in this post which translates sigma into ‘for’

    • AnarchistArtificer@slrpnk.net
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      I’m a subscriber to her YouTube(one of my favourite videos of hers) and she has a bunch of videos aimed at helping game developers learn the maths concepts they need for making games, so her audience is mostly people with a coding background, I’m guessing.

      So it’s less that code is simpler than math notation, more that the maths notation looks scary to people without a maths background, but here’s a link to a different complex symbolic abstraction that you might already know

    • bane_killgrind@lemmy.ml
      link
      fedilink
      arrow-up
      6
      arrow-down
      4
      ·
      1 year ago

      They are the same difficulty level, sure, but that’s like saying f(x) and f’(x) are at the same difficulty level. Coming from one to the other in a process is the difficult part, and the code offers instructions to follow this process.

      • Jee@lemmy.fmhy.ml
        link
        fedilink
        arrow-up
        4
        arrow-down
        1
        ·
        1 year ago

        I mean they are both the exact same thing, I don’t see why summation is scray when the for loop isn’t. It’s the same thing written in a short and easy format.

    • GTG3000@programming.dev
      link
      fedilink
      arrow-up
      5
      arrow-down
      4
      ·
      1 year ago

      Math notation is just terrible in general because a lot of it is shorthand made up by someone who likes single-letter variables. A symbol you can’t type, something above, something below.

      A for loop is clear and descriptive.
      Or if you’re feeling fancy, you could go functional with reduce(add, range(0, 5), 0).

      • Inky@lemmy.ca
        link
        fedilink
        arrow-up
        1
        arrow-down
        1
        ·
        1 year ago

        Mathematical notation was designed to be written by hand. It is at least as clear and descriptive as any syntax from a programming language. You’re pretending that the abstraction behind a for loop is somehow less than that behind a sum or product notation.

  • Lakso@ttrpg.network
    link
    fedilink
    arrow-up
    56
    ·
    1 year ago

    When you study CompSci (depending on where IG) you tend to see them that way when trying to mathematically prove something about an algorithm. It’s only really a good way of thinking if you’re into coding, but I don’t think a teacher for a non-coding related algebra class should show this, it can be really confusing for some people.

  • physicswizard@lemmy.ml
    link
    fedilink
    English
    arrow-up
    41
    arrow-down
    2
    ·
    1 year ago

    People who are arguing that one way of expressing these concepts is easier to learn/understand than the other are missing the whole point. Mathematical notation was not designed to teach students how to do math or explain how to design algorithms. It was invented to communicate precise, abstract ideas concisely between mathematicians who already understand what the symbols mean.

    Mathematicians require a notation that has the flexibility to manipulate mathematical objects/symbols in a way that naturally emphasizes their properties and relationships. Often they don’t even care whether the objects they’re studying are even computable or have a numerical representation. They just need them to have certain properties so that they can be manipulated appropriately.

    Discrete sums are a rare example of when the mathematical notation overlaps with the description of an algorithm for computing its value (and the overlap is not even complete; infinite sums are easily represented in math notation but are practically uncomputable when implemented naively). Every other advanced mathematical concept puts a premium on ease of symbol manipulation over computability: integrals, derivatives, matrix multiplication, abstract algebra, etc.

    TL;DR math notation is complex because its intended audience is people who already understand it, want maximum flexibility of symbol manipulation, and historically didn’t really care about practical computation.

    • heimchen@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      14
      ·
      edit-2
      1 year ago

      You are right the symbols weren’t created so students can learn them, but students have to learn them at one point and for me personally, a student that knows how to program, figuring out that these symbols kind of represent for loops made them easier to understand.

  • UnfortunateShort@lemmy.world
    link
    fedilink
    arrow-up
    38
    arrow-down
    1
    ·
    1 year ago

    These scary large math symbols aren’t scary at all and easily explained. The scary parts of maths lie elsewhere. They are discrete, nonlinear or high dimensional and sometimes even the numbers are complex… Or worse.

      • cucumberbob@programming.dev
        link
        fedilink
        arrow-up
        11
        ·
        edit-2
        1 year ago

        Continuous.

        Instead of jumping from 1 to 2 to 3, we move smoothly across all (typically real) numbers. Obviously this would go to infinity almost every time because there are infinite real numbers between any two distinct real numbers. So instead, we merge it into a bunch of skinny rectangles with their bottom on the x axis and the top at the value of the function for the start of the rectangle. As we shrink the width of the rectangles, it approaches the continuous notion.

        Continuous means “smooth” - there are no jumps Discrete means there are jump

        Image

      • slampisko@czech-lemmy.eu
        link
        fedilink
        arrow-up
        5
        ·
        edit-2
        1 year ago

        Short answer: Imagine that the integer used in the for loop is a float instead.

        Longer, a bit more precise answer: An integer can only have discrete values (i.e. -1, 0, 1, 2, …, 69, … etc.)

        A real number (~float with infinite precision) can have an infinite amount of values between two discrete values.

        An integral is, to put it simpy, a sum of all the results of taking those infinite values between two discrete values (an interval) and feeding them to the given function.

        It’s a for loop over an infinite set of real numbers rather than over a finite set of integers => a non-discrete for loop

    • affiliate@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      if you take a modular approach and allow different measures to be used, it also lets the integral sign be a discrete for-loop

  • ShustOne@lemmy.one
    link
    fedilink
    arrow-up
    26
    ·
    1 year ago

    Maybe I’m crazy but they did teach me this in school. “This means so this operation until conditions are met”.

  • someacnt@sopuli.xyz
    link
    fedilink
    arrow-up
    23
    arrow-down
    5
    ·
    1 year ago

    Just notational difference other than presence of mutation… How is it harder to understand 3 + 6 + 9 + ... + 3n means compared to the for loop? Is repeated addition hard to grasp?

    • Kempeth@feddit.de
      link
      fedilink
      arrow-up
      12
      ·
      1 year ago

      No it’s not harder to grasp, just less concise. Summation and Product notation exist for the same reason we don’t say “a discernible but subtle level of humidity” and just use “moist” instead - it’s more convenient. People can be taught to readily understand “moist” or the summation notation. It’s much harder to teach people to read the longer notation more quickly.

    • Stan@lemmywinks.com
      link
      fedilink
      arrow-up
      6
      arrow-down
      1
      ·
      1 year ago

      This thread makes me sad as fuck.

      Obviously you can integrate using Sigma notation, if it’s a definite integral.

  • horni3000@feddit.de
    link
    fedilink
    arrow-up
    17
    arrow-down
    1
    ·
    1 year ago

    You can reduce this readable code into one line of confusing python list comprehension that runs 100x slower!

    • hglman@lemmy.ml
      link
      fedilink
      arrow-up
      6
      ·
      1 year ago

      Yes, the classic readability of c style for loops.

      How about some Haskell

      let numbers = [1, 2, 3, 4, 5] let sumOfNumbers = sum numbers

    • Faresh@lemmy.ml
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      I don’t think you can use python list comprehensions in this case, since you don’t want a new list, but rather reduce it to a single value.

    • 0xff@lemmy.world
      cake
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      What’s wrong with list comprehensions? Do I just have Stockholm Syndrome at this point?

      I would skip the square brackets and just use a generator expression: sum(3*n for n in range(5)).

  • proofofnothing@lemmy.fmhy.ml
    link
    fedilink
    arrow-up
    16
    ·
    1 year ago

    While I acknowledhe that I had some pretty awful math teachers, I would like to add that explaining math concepts in an edited video that you could spend a lot of time making has different demands than babysitting/teaching 30+ students at different levels multiple times a day with little prep time.

  • nanoUFO@sh.itjust.works
    link
    fedilink
    arrow-up
    16
    arrow-down
    1
    ·
    1 year ago

    The hard part of math isn’t understanding esoteric symbols it’s the theory behind it and it’s application. Number theory will mindbreak almost all people.

    • Stan@lemmywinks.com
      link
      fedilink
      arrow-up
      4
      arrow-down
      1
      ·
      1 year ago

      The hardest thing for me about math was the symbols. Greek, Roman, English.

      Once you get past that, the numbers are easy.

      • nanoUFO@sh.itjust.works
        link
        fedilink
        arrow-up
        4
        ·
        1 year ago

        Number theory and higher levels of math are a completely different beast. Once your exam is over 50% just writing proofs you will change your tune. Unless you are built for it.

  • 0x4E4F@lemmy.rollenspiel.monster
    link
    fedilink
    arrow-up
    13
    arrow-down
    1
    ·
    edit-2
    1 year ago

    I remember how confused I was when I first encountered i=i+1… like, what 🤨? How can this be correct, this thing has to be wrong… and then you start seing the logic behind it and you’re like “oooh, yeah, that seems to work… but still, this is wrong on almost every level in math”… and then you grow a bit older and realize that coding has nothing to do with math, instead it’s got everything to do with problem solving. If you like to name your variables peach, grape, c*nt, you can, and if that helps you solve the problem, even better, just make it work, i.e. solve the problem 🤷.

    • synthetic_apriori@programming.dev
      link
      fedilink
      arrow-up
      11
      ·
      1 year ago

      and then you grow a bit older and realize that coding has nothing to do with math, instead it’s got everything to do with problem solving.

      Wait until you realize what math is all about

    • 4ce@lemm.ee
      link
      fedilink
      arrow-up
      6
      arrow-down
      2
      ·
      1 year ago

      coding has nothing to do with math

      A monad is just a monoid in the category of endofunctors, what’s the problem?

        • 4ce@lemm.ee
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          edit-2
          1 year ago

          It’s from a longer quote in “A Brief, Incomplete and Mostly Wrong History of Programming Languages” about the language Haskell:

          1990 - A committee formed by Simon Peyton-Jones, Paul Hudak, Philip Wadler, Ashton Kutcher, and People for the Ethical Treatment of Animals creates Haskell, a pure, non-strict, functional language. Haskell gets some resistance due to the complexity of using monads to control side effects. Wadler tries to appease critics by explaining that “a monad is a monoid in the category of endofunctors, what’s the problem?”

          Some other languages like e.g. Rust also use monads. The point I was trying to make humorously was that many programming languages sometimes do use math concepts, sometimes even very abstract maths (like monads), and while it’s not maths per se, programming and computer science in general can have quite a bit to do with maths sometimes.

          • 0x4E4F@lemmy.rollenspiel.monster
            link
            fedilink
            arrow-up
            2
            ·
            edit-2
            1 year ago

            Yeah, I get what you’re trying to say now 😉. Still, they’re mostly used when doing algos, which in real world practical examples is almost never. We do all sorts of repetitive things, like sorting or user input blocks, but new algos is… something that you might do in NASA, CERN, Wall Street, not your every day programming job. Sure, you might optimize a thing or two here and there, but that’s about it 🤷.

    • AshLassay@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Coding has nothing to do with math yet the entire basis of computing and programming is Boolean algebra.

      • Square Singer@feddit.de
        link
        fedilink
        arrow-up
        0
        arrow-down
        1
        ·
        edit-2
        1 year ago

        But isn:t that kinda true for most things? If you go down deep enough, amost all tasks end up in physics und thus maths somewhere. But if I’m stacking shelves, I don’t care that there are some pretty complicated mathy physics things that determine how much weight I can stack on the shelf. I just stack it.

        That’s kinda how most of programming is related to maths. Yeah, math makes it all run, but I mostly just see maybe a little algebra and very simple boolean logic.

        And the rest of my work is following best practices and trying to make sense of requirements.

        • juliebean@lemm.ee
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          you don’t need to worry about the load capacity of the shelf, but only because somebody else already engineered it to be sufficient for the expected load. i’d argue that you aren’t the coder in this analogy, you’re the end user.

          • Square Singer@feddit.de
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            1 year ago

            But how often, as a coder, are you going low-level?

            If I want to sort a list, I don’t invent a sorting algo.

            I don’t even code out a known sorting algo.

            I just type .sort(), and I don’t even care which algo is used.

            Same with most other things. Thinking about different kinds of lists/maps/sets is something you do in university.

            In reality, many languages (like e.g. Python) don’t even give you the choice. There are List(), Map(), Set() and that’s it. And even on languages like Java, everybody just goes for ArrayList, HashMap and HashSet. Can’t remember a single time since university where I was like “You know what I’d fancy now? A LinkedList.”

            I honestly don’t even know if Java offers any Map/Set implementations that don’t use hash buckets.

            And even of boolean logic we only use a fraction. We use and, or, not and equals. We don’t use nand, nor, identity, xor, both material conditional variants, material biconditional or their negations.

    • Julian@lemm.ee
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      edit-2
      1 year ago

      I mean, coding does have to do with math, it’s usually just different notation. i = i + 1 in math notation is just i := i + 1.

      • 0x4E4F@lemmy.rollenspiel.monster
        link
        fedilink
        arrow-up
        1
        arrow-down
        2
        ·
        1 year ago

        That’s advanced calculus, and my guess is, those notations were made up to give rise to a new field in math, which has more to do with computers than math, so I don’t think that counts.

          • 0x4E4F@lemmy.rollenspiel.monster
            link
            fedilink
            arrow-up
            1
            arrow-down
            2
            ·
            edit-2
            1 year ago

            Computation theory, but that’s not math as in regular math. It’s just a fancy way of expressing how things inside a computer work, so we can actually make better versions of it. You just have to express it somehow in math terms.

            It’s like saying engineers use math all the time. No, they don’t. We use simple aproximations of what is actually happening to dumb down the problem, cuz, it does the job nicely and no one will notice the difference between what we used, a simple aproximation, and the real thing, a full blown advanced calculus model of the thing we’re working on.

  • MrMobius @sh.itjust.works
    link
    fedilink
    arrow-up
    10
    ·
    1 year ago

    In a way I always thought coding was more intuitive than maths writing norms. That is if you speak English. If not, it’s as much daunting as weird greek symbols.

  • lasagna@programming.dev
    link
    fedilink
    arrow-up
    8
    arrow-down
    1
    ·
    1 year ago

    Invented in the 50s, Fortran = FORmula Translating language. It was basically created to solve this sort of problem.