• Truscape@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    8
    arrow-down
    1
    ·
    edit-2
    21 days ago

    Some forms of programming syntax, although there are the fringe cases where an equation (or function in programming) is represented by a symbol in conjunction with a parentheses input.

    For example:

    y(x) = 2*x+3

    5+y(1) = 10, as 1 is substituted in for x in the prior equation.

    • TheBlackLounge@lemmy.zip
      link
      fedilink
      English
      arrow-up
      4
      arrow-down
      1
      ·
      21 days ago

      And in some languages a number can be used as a name of a variable or a function, so it can be anything really

      • MotoAsh@piefed.social
        link
        fedilink
        English
        arrow-up
        2
        ·
        21 days ago

        Not in most programming languages, though. You cannot start names with a number. Unless you’re using some strange character that merely looks like a number, anyways. Programming with unicode can get weird but generally works without issue these days.

    • moriquende@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      21 days ago

      Wouldn’t we just assume function expressions are always “in parenthesis”? Then it’s just a substitution and no rules were changed.

        • moriquende@lemmy.world
          link
          fedilink
          English
          arrow-up
          4
          arrow-down
          1
          ·
          edit-2
          4 days ago

          But factorised terms are multiplications, so they’re still following the same rules: a(b+c) = a*(b+c)

          Example: 2(3+5)=16, and also 2*3+2*5=16

          • 💡𝚂𝗆𝖺𝗋𝗍𝗆𝖺𝗇 𝙰𝗉𝗉𝗌📱@programming.dev
            link
            fedilink
            English
            arrow-up
            1
            arrow-down
            3
            ·
            edit-2
            4 days ago

            But factorised terms are multiplications,

            No, they’re Distribution done in the Brackets step, a(b+c)=(ab+ac), now solve (ab+ac)

            a(b+c) = a*(b+c)

            Nope! a(b+c)=(ab+ac). 1/a(b+c)=1/(ab+ac), but 1/ax(b+c)=(b+c)/a.

            23+25=16

            (2x3+2x5) actually, or you’ll get the wrong answer when it follows a Division sign. See previous point

                • moriquende@lemmy.world
                  link
                  fedilink
                  English
                  arrow-up
                  3
                  arrow-down
                  1
                  ·
                  edit-2
                  3 days ago

                  Yes, the math textbook says exactly what I said, that it’s a multiplication. There’s no mention of it being a separate operation taking precedence. The parentheses in your example are added for clarity.

                  Whether you give priority to juxtapositions is an open debate with the consensus being to just use parenthesis around when writing in a single line to avoid confusion. However, there is no distribution step taking precedence, as you mentioned, and the whole debate centers around whether the writer was too lazy to add parenthesis.

                  • Yes, the math textbook says exactly what I said, that it’s a multiplication

                    Nope, they say it’s Brackets

                    5(36)=(5x36) <== Brackets

                    bc=(3x4) <== Brackets

                    There’s no mention of it being a separate operation taking precedence

                    It’s part of the Brackets step. I have no idea what “separate operation” you’re talking about

                    The parentheses in your example are added for clarity

                    Nope. They are there because The Distributive Law requires them. “those who study algebra are required to make their calculations conform to these laws”.

                    Whether you give priority to juxtapositions is a

                    A literal Law of Maths. See textbook.

                    the consensus being to just use parenthesis around when writing in a single line to avoid confusion.

                    No it isn’t. You won’t find any Maths textbook that says that.

                    However, there is no distribution step taking precedence

                    There is the Brackets step, including Distribution, taking precedence, as per Maths textbooks 🙄

                    as you mentioned

                    As the textbooks mention

                    the whole debate centers around whether the writer was too lazy to add parenthesis

                    The only debate is by people like you ignoring what is taught in Maths textbooks.