How do I count thee? Let me count the ways?

How easily can you be identified on the Internet?

How easily can you be identified on the Internet? Suppose you finish your meal at a restaurant, you are about to pay the check, and t...

Showing posts with label PEMDAS. Show all posts
Showing posts with label PEMDAS. Show all posts

Friday, April 7, 2023

A more interesting pictorial numerical puzzle

I am getting tired of these little pictorial numerical puzzles with the four equations, like one where three chickens equals 60, one chicken plus two plates of two eggs per plate equals 26, and so on, until the final equation is to evaluate some mathematical expression involving chickens, eggs, and bananas.

The solution generally requires that you remember the PEMDAS (in the US, or BODMAS elsewhere) rules for order of operations especially that multiplication takes precedence over addition, and also that you carefully count the number of eggs and number of bananas. I get 36.

OK, let me try to create a more interesting pictorial puzzle.

Mathematicians agree on the PEMDAS rules, although there are many situations that PEMDAS doesn't handle. Perhaps the most common is the unary minus operator as in -32. It is unary because unlike subtraction that has two operands, the unary operator only has one. I think mathematicians would like to see the unary operator as changing the sign of the argument, so that -32 equals -9, although some software, most notably Excel, merrily calculate this as +9.

I don't believe there is a single authority for all the order of operations cases. For example, Excel, Google Search, and Wolfram Alpha do not always agree. I bet there are some pretty smart people in those companies.

Nowadays I am doing my fun calculations in the R computer language, so for the remainder of this post I will require R as the authority.

So here is my attempt at a more interesting problem, but remember, you have to use the order of operation precedence rules of R: (Let me add the link to the first item: https://www.facebook.com/watch/?v=10158293605695705 )

Do you want to try it before I reveal the R code?



The R code is:

apple <- 1
banana <- 2
kiwi <- 3
lemon <- 4
peach <- banana + lemon
pear <- banana^banana^kiwi     # 2^(2^3) = 256
pineapple <- (pear - banana) %% kiwi^2 * lemon     # (254 %% 9) * 4 = 2 * 4 = 8
strawberry <- pineapple / peach * peach     # 8; no obelus in R
kiwi <- c(lemon, pineapple, strawberry)
watermelon <- kiwi[kiwi == lemon | kiwi == pineapple & kiwi == strawberry]
# watermelon <- (lemon V pineapple ∧ strawberry)     # 4 V (8 & 8) = 4, 8

The ordering rules of R include:

  • Modular arithmetic is at the same level as multiplication:     a mod b * c is     (a mod b) *c
  • The obelus does not appear in R but is just a division symbol:     a ÷ b * c = (a / b) * c
  • Repeated exponentiation goes right to left: a ^ b ^ c = a^(b^c); lots of disagreement outside R on this one
  • Logical AND preceds logical OR

Friday, February 15, 2013

Let's stop making excuses for Aunt Sally


Let's stop making excuses for dear Aunt Sally. You know who I mean: Please Excuse My Dear Aunt Sally. Many students can still remember the mnemonic PEMDAS for the rules of order of operations, but PEMDAS omits or confuses some situations. Most prominently, even my current college algebra textbook does not make it clear that in the M and D of PEMDAS multiplication and division are of equal priority, so a division is performed before a multiplication if the division appears to the left of the multiplication.

I like to invite my students to use all their calculators on expressions like 300 - 200/50*10 to see which calculators obey the rules of operations and which do not. I am always surprised when students first turn to the calculator on their cell phone to answer this.

PEMDAS doesn't address fraction bars, nor that with multiple grouping symbols you start with the innermost grouping symbols first. And I suppose it's too much to expect that PEMDAS address that in -32 the negation precedes the exponentiation; by the way, Excel disagrees with this.

Speaking of exponentiation, what do you do with x y z ? Exponentiation is not associative. Johnny Lott in A Problem Solving Approach to Mathematics says exponentiation is done in order from right to left (page 276), although Excel disagrees with this one too.

So there's more to the rules of order of operation than PEMDAS. But if you are getting a little tired of Aunt Sally, why not switch to Please Email My Dad A Shark, by the authors of xkcd.com

Anyone have any good ideas on teaching order of operations?

GFU2TT2BG3ZC