programming.dev

friendly_ghost, to memes in 6÷2(1+2)

That blog post was awesome, thanks for doing that work and letting us know about it!

wischi,

Thank you for taking the time to read it.

atomicorange, to memes in 6÷2(1+2)

Great write up! The answer is use parentheses or fractions and stop wasting everyone’s time 😅

wischi,

That’s actually a great way of putting it 🤣

Perfide, (edited ) to memes in 6÷2(1+2)

You lost me on the section when you started going into different calculators, but I read the rest of the post. Well written even if I ultimately disagree!

The reason imo there is ambiguity with these math problems is bad/outdated teaching. The way I was taught pemdas, you always do the left-most operations first, while otherwise still following the ordering.

Doing this for 6÷2(1+2), there is no ambiguity that the answer is 9. You do your parentheses first as always, 6÷2(3), and then since division and multiplication are equal in ordering weight, you do the division first because it’s the left most operation, leaving us 3(3), which is of course 9.

If someone wrote this equation with the intention that the answer is 1, they wrote the equation wrong, simple as that.

abraxas, (edited )

There has apparently been historical disagreement over whether 6÷2(3) is equivalent to 6÷2x3

As a logician instead of a mathemetician, the answer is “they’re both wrong because they have proven themselves ambiguous”. Of course, my answer would be RPN to be a jerk or just have more parens to be a programmer

wischi,

The calculator section is actually pretty important, because it shows how there is no consensus. Sharp is especially interesting with respect to your comment because all scientific Sharp calculators say it’s 1. For all the other brands for hardware calculators there are roughly 50:50 with saying 1 and 9.

So I’m not sure if you are suggesting that thousands of experts and hundreds of engineers at Casio, Texas Instruments, HP and Sharp got it wrong and you got it right?

There really is no agreed upon standard even amongst experts.

kogasa,
@kogasa@programming.dev avatar

Hi, expert here, calculators have nothing to do with it. There’s an agreed upon “Order of Operations” that we teach to kids, and there’s a mutual agreement that it’s only approximately correct. Calculators have to pick an explicit parsing algorithm, humans don’t have to and so they don’t. I don’t look to a dictionary to tell me what I mean when I speak to another human.

fallingcats, (edited )

Thanks for putting my thoughts into words, that’s exactly why I hate math. It was supposed to be the logical one, but since it only needs to be parsed by humans it failed at even that. It’s just conventions upon conventions to the point where it’s notably different from one teacher/professor to the next.

I guess you can tell why I went into comp-sci (and also why I’m struggling there too)

Perfide,

No, those companies aren’t wrong, but they’re not entirely right either. The answer to “6 ÷ 2(1+2)” is 1 on those calculators because that is a badly written equation and you(not literally you, to be clear) should feel bad for writing it, and the calculators can’t handle it with their rigid hardcoded logic. The ones that do give the correct answer of 9 on that equation will get other equations wrong that it shouldn’t be, again because the logic is hardcoded.

That doesn’t change the fact that that equation worked out on paper is absolutely 9 based on modern rules of math. Calculate the parentheses first, you then have 6 ÷ 2(3). We could solve from here, but to make the point extra clear I’m going to actually expand this out to explicit multiplication. “2(3)” is the same as “2 x 3”, so we can rewrite the equation as “6 ÷ 2 x 3”. All operators now inarguably have equal precedence, which means the only factor left in which order to do the operations is left to right, and thus division first. The answer can only be 9.

MeetInPotatoes,

If you’d ever taken any advanced math, you’d see that the answer is 1 all day. The implicit multiplication is done before the division because anyone taking advanced math would see 2(1+2) as a term that must be resolved first. The answer still lies in the ambiguity of the way the problem is written though. If the author used fractions instead of that stupid division symbol, there would be no ambiguity. It’s either 6/2 x 3 = 9 or [6/(2x3)] = 1. Comment formatting aside, if someone put 6 in the numerator, and then did or did NOT put all the rest in the denominator underneath a horizontal bar, it would be obvious.

TL;DR It’s still a formatting issue, but 9 is definitely not the clear and only answer.

CrushKillDestroySwag, to memes in 6÷2(1+2)

Very cool article on an aspect of math that I’ve never thought too deeply about before 👍

wren, to memes in 6÷2(1+2)
@wren@sopuli.xyz avatar

Great read! Easy for everyone to understand, but also thorough. I loved the breakdown into the calculators functionality

wischi,

Thank you for taking the time reading it.

Alcatorda, to memes in 6÷2(1+2)

Hi! Nice blog post. Since you asked for feedback I’ll point out the one thing I didn’t really understand. You explain the difference between the calculators by showing excerpts from the manuals and you highlight that in the first manual, implicit multiplication is prioritised. But the text you underlined only refers to implicit multiplication involving special expressions(?) like pi, e, sqrt or log, and nothing about “regular” implicit multiplication like 2(1+3). So while your photos of the calculator results are great proof that the two models use a different order of operations, to me the manuals were a bit confusing since they did not actually seem to prove your point for the example math problems you are discussing. Or maybe I missed something?

wischi,

You are right the manual isn’t very clear here. My guess is that parentheses are also considered Type B functions. I actually chose those calculators because I have them here and can test things and because they split the implicit multiplication priority. Most other calculators just state “implicit multiplication” and that’s it.

My guess is that the list of Type B functions is not complete but implicit multiplication with parentheses should be considered important enough for it to be documented.

Pulptastic,

Negative reviews for the calculator that does OOO wrong.

comrade_pibb, to memes in 6÷2(1+2)
@comrade_pibb@hexbear.net avatar

Hey this is interesting, thanks for sharing!

brisk, to memes in 6÷2(1+2)

My only complaint is the suggestion that engineers like to be clear. My undergrad classes included far too many things like 2 cos 2 x sin y

fallingcats,

I’d say engineers like to be exact, but they like being lazy even more

CallumWells, to memes in 6÷2(1+2)

I love that the calculators showing different answers are both from the same manufacturer XD

wischi, (edited )

In the blog post there are even more. Texas Instruments, HP and Canon also have calculators, and some of them show 9 and some 1.

Brak, (edited ) to memes in 6÷2(1+2)
@Brak@hexbear.net avatar

i didn’t fully understand the article, but it was really interesting reading summaries & side discussions in the comments here!

i enjoy content like this that demonstrates how math is at its heart a useful tool for conceptualizing things vs some kind of immutable force.

InquisitiveApathy, to memes in 6÷2(1+2)

I always hate any viral math post for the simple reason that it gives me PTSD flashbacks to my Real Analysis classes.

The blog post is fine, but could definitely be condensed quite a bit across the board and still effectively make the same points would be my only critique.

At it core Mathematics is the language and practices used in order to communicate numbers to one another and it’s always nice to have someone reasonably argue that any ambiguity of communication means that you’re not communicating effectively.

pomodoro_longbreak, to memes in 6÷2(1+2)
@pomodoro_longbreak@sh.itjust.works avatar

Meanwhile programmers will be like, fools, clearly 2(n) is a function 😏

fallingcats,

I don’t know a single language that lets you use a name starting with a number for anything off the top of my head

deadbeef79000,

Probably Haskell.

Lilac,

Kinda. You can’t define a name, but you can get the compiler to interpret literals as a function. If you have a Num instance for (Integer -> Integer) where,

fromInteger i = x -> x * i

the compiler can interpret integer literals as functions like so

x = 2(5) :: Integer

Pacmanlives, (edited ) to programmer_humor in Manager: This task only takes 30 minutes. Why did it take you the whole day?

git commit -m “changed somethings “

git push origin master

jelloeater85,
@jelloeater85@lemmy.world avatar

Do you always have to do origin master? I’ve seen it where sometimes just git push works and other times not.

Meowoem,

I think it depends what branch your local version of the repo is set to. If you’re already in master then it’ll push there, if you’re in a testing branch then you can push it straight to master instead by telling it to

jelloeater85,
@jelloeater85@lemmy.world avatar

I just meant it not auto creating a new matching named branch.

zcoyle,

where it Just Works, the branch is set up to track a remote branch

git-scm.com/book/…/Git-Branching-Remote-Branches

Valmond,

push origin your/branch

Pushes, you guessed it, your/branch!

Head is usually your checked out working branch if you’re not in a headless state, right?

sloppy_diffuser,
adrian783,

uh in any actual company you almost never push to origin master. so I think it’s a joke.

Valmond, (edited )

Depends on the configuration right?

You can work on your branch and then push that to integration for example.

I mean you’re not working on your local master/main branch right?

MajorHavoc,

Not with that attitude! /s

jelloeater85,
@jelloeater85@lemmy.world avatar

Force push Fridays!

TheUncannyObserver,

That’s part of the joke, I think. If it’s a repo more than just you use, you would almost never push directly to the main branch.

MajorHavoc,

You forgot this –force flag.

Valmond,

I’m too lazy, I use -f

ethd, to memes in 6÷2(1+2)

I don’t have much to say on this, other than that I appreciate how well-written this deep dive is and I appreciate you for writing it. People get so polarized with these viral math problems and it baffles me.

paul, to programmer_humor in Manager: This task only takes 30 minutes. Why did it take you the whole day?

do git commit -v and then just summarize the diff you have in your editor in a human readable form.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #