Solved

# Having trouble dealing with exponents with infix and postfix.

Posted on 2011-05-04
1,629 Views
So I understand that converting something like:
4 + 2 * 8 / 6 + 2
goes from left to right, so to get the postfix you throw parentheses in it based around the precedence from left to right:
( ( 4 + ( ( 2 * 8 ) / 6 ) ) + 2 )
then you get the postfix by going left to right and pulling the numbers and operators based on the right parentheses:
428*6/+2+

3^2^1
does this go from right to left?
(3^(2^1))
If so is this the only step thats different with exponents?
Postfix?:
321^^
Then would you evaluate this the same you would with any postfix?

Then does the following evaluate to 49? For some reason I have 19 in my notes...
6342^*+5-
0
Question by:Eindoofus

LVL 31

Expert Comment

I use left to right associativity for exponents:
http://www.mathgoodies.com/lessons/vol7/operations_exponents.html
3^2^1
((3^2)^1) = 9

63(42^)*+5- = 63 16*+5- = 49
0

Author Comment

http://en.wikipedia.org/wiki/Order_of_operations

Calculators may associate exponents to the left or to the right depending on the model. For example, the expression a ^ b ^ c on the TI-92 and TI-30XII (both Texas Instruments calculators) associates two different ways:
The TI-92 associates to the right, that is
a ^ b ^ c = a ^ (b ^ c) =
whereas, the TI-30XII associates to the left, that is
a ^ b ^ c = (a ^ b) ^ c = (ab)c.

I could have sworn that in my class the professor said it was right to left. I don't understand how something like this has no definitive rule in mathematics?

0

LVL 31

Accepted Solution

There are different standards in different countries. And Microsoft Windows XP calculator still says that  4+3*2 = 14, whereas from algebra throughout college, the answer has been 10.

Look up in your textbook what standard you are using.
0

Author Comment

So I take it that the standard only matters when going from infix to postfix?

With the following:
6342^*+5-
Is there anyway to get 19 out of that? The only thing I can pull from that is 49.
0

LVL 31

Expert Comment

Sorry, I haven't been able to come up with 19 yet.
0

## Featured Post

### Suggested Solutions

isEverywhere  challenge 19 47
tripleUp challenge 7 53
withoutTen challenge 14 67
Homework Math Question 1 37
The Fluent Interface Design Pattern You can use the Fluent Interface (http://en.wikipedia.org/wiki/Fluent_interface) design pattern to make your PHP code easier to read and maintain.  "Fluent Interface" is an object-oriented design pattern that r…
Introduction Many of the most common information processing tasks require sorting data sets.  For example, you may want to find the largest or smallest value in a collection.  Or you may want to order the data set in numeric or alphabetical order. …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …