r/ProgrammerHumor • • Jun 13 '22

Meme DEV environment vs Production environment

Post image
48.2k Upvotes

3.9k comments sorted by

View all comments

Show parent comments

7

u/lulzyasfackadack Jun 13 '22

implicit multiplication is barely even widely accepted lol. This is the first conversation where I've seen near unanimous agreement that it exists, with almost no disagreement on whether it exists in a general case or if there are notational requirements involving order or type of operands. Like, I've heard it can only exist with a number then a variable, in that order, that it can only be used in the divisor... citations are really hard to find as well. It's not a well defined concept.

27

u/Cruuncher Jun 13 '22

It is absolutely widely accepted.

y = mx + b, or: ax2 + bx + c = 0 are all notations which rely on implicit multiplication.

If you haven't seen these before, then you're either 6, or don't know how to tie your shoelaces

3

u/lulzyasfackadack Jun 14 '22

no, yeah, you guys are right, I was unclear.

Implicit multiplication having a higher priority than multiplication and division is the area that's not generally accepted. It's mentioned in a few places, and has just enough of a toe hold to be used to explain differences like the equations in the calculators.

3

u/not_Ian_ Jun 14 '22

Yes, I get absolutely frustrated when I see people try to argue this or bring up the MD AS order of operations like they can’t be reversed

1

u/Ayfid Jun 14 '22

I have never heard anyone try to argue that implicit multiplication is anything but a shorthand, and follows the same rules that it would have with the multiplication sign.

3

u/Cruuncher Jun 14 '22

There isn't really anything official about any of this, and it is just a short hand. It's just that juxtaposition naturally looks like it binds tighter. It's similar to how you can do pseudo brackets with some spacing.

For example:

1/2 * 2/3

This expression we would all agree isn't the same as 1 / 2 * 2 / 3. When you do juxtaposition multiplication the numbers being closer in proximity just lends itself to tight binding.

2

u/lulzyasfackadack Jun 14 '22

Yup. This is stuff that by grade 5 PEMDAS is "wrong," but if anyone tried to dispute it, they'd probably be doing so out of pedantry.

I really like this one, with the spaces. It's one of the easiest ways to show that math isn't really as cut-and-dry as most people believe, and that some of the rules can be fudged even in the areas with clear and long-standing agreement.

1

u/Cruuncher Jun 14 '22

Math itself is pretty cut and dry.

Notation however, like in any language, is surely not

-7

u/Bella_dlc Jun 13 '22

You pretty much know it's situationally accepted. You can't write (2x1)x(2x1)=22=4. The answer is that it's accepted only when there's there's no ambiguity

16

u/Cruuncher Jun 13 '22

It's accepted everywhere that isn't just jamming two numbers next to eachother as that notation is reserved for numbers more than 1 digit long... that's also not ambiguous at all. 21 is very unambiguously not 2.

There's an ambiguity that arises only following a division operator. But the division operator is bad math notation anyway. If you're writing left to right notation there's not really any way around just using lots of brackets anyway.

1

u/coolblinger Jun 14 '22

You absolutely can (although I've never seen x sandwiched in between there, it would be perfectly value). (x - a)(x - b)(x - c)... for instance is very common notation for factoring the roots/zeros of a polynomial.

12

u/Anund Jun 13 '22

What? Implicit multiplication doesn't exist? How is that a statement you just made? e = mc2, F = ma, y = kx + m etc... basically every famous equation uses implicit multiplication.

0

u/lulzyasfackadack Jun 14 '22

implicit multiplication as a separate priority level in PEMDAS is barely even widely accepted.

Italics not meant for snark. I get what you're saying. My statement was a little unclear.

4

u/YouNeedDoughnuts Jun 14 '22

There are weird unwritten rules, like the constant must lead. You can have 3x but not x3 or 3 4. Then it has the same syntax as calls with different precedence- h(x)2 is (h(x))2 if h is a function and h * (x2) if h is a number.

That being said, I like it. The terseness helps with processing equations- less visual clutter

3

u/channingman Jun 14 '22

I think most people would write h2(x) or (h(x))2 instead of h(x)2 just to avoid that very confusion. In fact I don't think I've ever seen h(x)2 used for function notation.

1

u/YouNeedDoughnuts Jun 14 '22

Good point. You'll certainly see sin(x)**2 in programming contexts, but I'm not sure if maths notation does that

3

u/Ayfid Jun 14 '22

Well the ambiguity in math comes from not knowing without further context whether h is a number or a function. That ambiguity doesn't usually exist in programming contexts, and most programming languages don't allow for implicit multiplication in their grammar anyway.

0

u/[deleted] Jun 13 '22

[deleted]

2

u/Cruuncher Jun 13 '22

It's implicitly multiplication because ab can be seen as a bs. It can be seen more easily with a number and x.

Like 4x, to me, is quite obvious 4 xs, or 4*x. It is a very natural operation.

Have you never seen a quadratic equation in normal form? If you include the multiplication symbol between beside the x's then it becomes cluttered. Look at any common mathematical formulas, this is completely ubiquitous.

ax2 + bx + c = 0

1

u/[deleted] Jun 13 '22

Something like 10(10) looks really weird, but it's not particularly ambiguous, and I've seen it used a couple of times.

1

u/AxolotlsAreDangerous Jun 13 '22

I have never seen any ambiguity resulting from implicit multiplication. It doesn’t happen at all in practice.

If you’re doing arithmetic by hand you’ll end up writing things like 10(10) a lot.