1/xy
Moderators: phlip, Moderators General, Prelates
1/xy
I couldn't decide whether to ask this in coding or computer science, so I put it here. Should multiplication ever have implied precedence over division? And how come http://www.wolframalpha.com/input/?i=1%2Fnx%2C1%2F2x?
Opharmia Blog:Why I would opt for a classical economy
Re: 1/xy
Infix notation is stupid to begin with –it only really works for commutative associative operators. Polish or graph notation FTW!
Maybe, just maybe, polish notation could even accelerate the understanding of solving algebraic equations.
Clearly, variables tucked together take precedence over division or constant fractions take precedence over everything. It makes perfect sense.
Maybe, just maybe, polish notation could even accelerate the understanding of solving algebraic equations.
quantropy wrote:And how come http://www.wolframalpha.com/input/?i=1%2Fnx%2C1%2F2x?
Clearly, variables tucked together take precedence over division or constant fractions take precedence over everything. It makes perfect sense.
Re: 1/xy
I think there is a clear answer  (1/x)*y  but I also think that anyone who seriously writes 1/xy in the first place should be banished from ever writing anything mathematical again.
 doogly
 Dr. The Juggernaut of Touching Himself
 Posts: 5418
 Joined: Mon Oct 23, 2006 2:31 am UTC
 Location: Lexington, MA
 Contact:
Re: 1/xy
But I feel like a bait and switch happened here. I voted to parse 1/xy as 1/(xy), which I stand by, but then the link complains that 1/2x is parsed as (1/2)x. And I stand by that too. Of course mathematically there shouldn't be a difference, but this is about notation, and how to make due with limited formatting options.
I would rather write \frac{1}{2}gt^2, but I will make due with other environments with 1/2gt^2 (or 1/2 gt^2, with a lil extra space there) in favor of (gt^2)/2.
I would rather write \frac{1}{2}gt^2, but I will make due with other environments with 1/2gt^2 (or 1/2 gt^2, with a lil extra space there) in favor of (gt^2)/2.
LE4dGOLEM: What's a Doug?
Noc: A larval Doogly. They grow the tail and stinger upon reaching adulthood.
Keep waggling your butt brows Brothers.
Or; Is that your eye butthairs?
Noc: A larval Doogly. They grow the tail and stinger upon reaching adulthood.
Keep waggling your butt brows Brothers.
Or; Is that your eye butthairs?
Re: 1/xy
But the other part of notation is to have predictable rules that lead to everyone having the same unambiguous interpretation. I agree that 1/xy seems like it should be 1/(xy), but I kind of doubt that you can pick a (i) clear (ii) simple (iii) predictable and (iv) unambiguous rule that interprets 1/xy that way but that wouldn't lead to other, bigger problems with other expressions.doogly wrote:Of course mathematically there shouldn't be a difference, but this is about notation, and how to make due with limited formatting options.
For example, suppose 1/xy is 1/(xy) and 1/2x is (1/2)x. What's 1/2(x+y), or 1/x(y+z)? 1/(x+y)2, or 1/(y+z)x. I don't even know if I can tell you what I meant, and I wrote those expressions.
So there's a conflict. The only reasonable rule IMO leads to (1/x)*y, but if you look at it in isolation, 1/xy looks like it should be 1/(xy). So that means that you shouldn't write 1/xy in the first place. This is a mathematical analogue to the distinction in programming between a program "having no obvious errors" and a program "obviously having no errors."
The only thing that I can think might work is implied multiplication  xy instead of x*y  having its own precedence level. But that seems very silly and errorprone, and leads to 1/2x being 1/(2x) anyway.
Re: 1/xy
EvanED wrote:But the other part of notation is to have predictable rules that lead to everyone having the same unambiguous interpretation. I agree that 1/xy seems like it should be 1/(xy), but I kind of doubt that you can pick a (i) clear (ii) simple (iii) predictable and (iv) unambiguous rule that interprets 1/xy that way but that wouldn't lead to other, bigger problems with other expressions.doogly wrote:Of course mathematically there shouldn't be a difference, but this is about notation, and how to make due with limited formatting options.
I'd argue that you don't need strict rules for small expressions in context. There's three things emphasised, but the third one is probably the most important: 1/2x, 1/xy and 1/2gt^2 are illdefined without context (especially since not everyone agrees that multiplication and division have the same precedence and go lefttoright), so the context should point out which relation is linearly or inversely proportional. In the case of 1/2gt^2 it is implied that it's * * g / 1 2 ^ t 2 because it looks like the formula for gravitational acceleration.
Re: 1/xy
EvanED wrote:But the other part of notation is to have predictable rules that lead to everyone having the same unambiguous interpretation. I agree that 1/xy seems like it should be 1/(xy), but I kind of doubt that you can pick a (i) clear (ii) simple (iii) predictable and (iv) unambiguous rule that interprets 1/xy that way but that wouldn't lead to other, bigger problems with other expressions.
Under strict interpretations I would parse 1/xy as a syntax error. If I'm going to assign it a value then I have to interpret what you meant, and that may lead to inconsistent results.

 Posts: 13
 Joined: Wed Oct 29, 2014 6:20 pm UTC
Re: 1/xy
dalcde wrote:Flumble wrote:Infix notation is stupid to begin with –it only really works for commutative associative operators. Polish or graph notation FTW!
Subtraction?
1  2  3  1 can be parenthetized in many different ways and thus is ambiguous, unless you first do all negations and then do additions, as in 1 + (1) + (3) + (1), which is what most people would expect as a result. But then it does work strictly because of associativity.
Now, commutativity I disagree with, it has nothing to do with that and infix notation handles associative noncommutative products perfectly, see matrix notation. For linear algebra algebraic notation is way, way cleaner than RPN, because RPN is terrible at handling operators that act on operators.
For nonassociative operators like cross products, RPN starts being really nice. For things that are completely nonassociative, RPN is awesome.
I mean, try looking at this article on quandles, and translating the axioms into RPN. It's a lot nicer!
https://en.wikipedia.org/wiki/Racks_and_quandles
(Though twodimensional notations can be even better.)
 somitomi
 Posts: 619
 Joined: Fri Nov 06, 2015 11:21 pm UTC
 Location: can be found in Hungary
 Contact:
Re: 1/xy
And that's why I hate that slanted nonsense. It's a really nice example of the horizontal division bar being so much better.
If I'm really pressed to interpret it, it'd be 1/(xy), because anyone writing y/x as (1/x)y clearly deserves some kind of punishment for it, but otherwise I'd recommend using bracket everywhere. Altough if I were to write a program that has some mathematical formula as input, the only way to enter any form of divison would be the aforementioned horizontal divison bar (I can't for the life of me find an English word for it).
If I'm really pressed to interpret it, it'd be 1/(xy), because anyone writing y/x as (1/x)y clearly deserves some kind of punishment for it, but otherwise I'd recommend using bracket everywhere. Altough if I were to write a program that has some mathematical formula as input, the only way to enter any form of divison would be the aforementioned horizontal divison bar (I can't for the life of me find an English word for it).
—◯◯
Re: 1/xy
As EvanED points out, we do need to have a strict rule, and the rule being different for literals and variables is definitely confusing. Either they have the same precedence, or different. And having another rule for implied multiplication also sounds like a terrible idea.
The way things are, they clearly have the same precedence. So 1/xy clearly does mean (1/x)*y. Whether it should mean that is a different matter, and I'm inclined to say that it would be better the other way.
I would argue that they do have different precedence in one case, though, which is for units. If I write that 1 H = 1 N/Am, no one could reasonably interpret that as (N/A)*m.
I also think that prefix or postfix notation is neat in many ways. Although I'm not a fan of calling them "Polish" and "reverse Polish". Sounds kind of like an insult, a bit like "it's all Greek to me". I know that's not the historical reason, but still. "Prefix" and "postfix" are definitely better terms  shorter, clearer, more consistent.
The way things are, they clearly have the same precedence. So 1/xy clearly does mean (1/x)*y. Whether it should mean that is a different matter, and I'm inclined to say that it would be better the other way.
I would argue that they do have different precedence in one case, though, which is for units. If I write that 1 H = 1 N/Am, no one could reasonably interpret that as (N/A)*m.
I also think that prefix or postfix notation is neat in many ways. Although I'm not a fan of calling them "Polish" and "reverse Polish". Sounds kind of like an insult, a bit like "it's all Greek to me". I know that's not the historical reason, but still. "Prefix" and "postfix" are definitely better terms  shorter, clearer, more consistent.

 Posts: 224
 Joined: Tue Jun 17, 2008 11:04 pm UTC
Re: 1/xy
I also tend to be a fan of "infix division has strictly lower precedence than multiplication" rather than having equal precedence. I think it's a better convention, and I use it a lot when scribbling to myself on paper or doing backoftheenvelope math. It even fits that acronym that people learn (or at least that I heard) in grade school: PEMD(AS). The M and the D are in the right order for it to still work.
Who is online
Users browsing this forum: Exabot [Bot] and 5 guests