Having trouble dealing with exponents with infix and postfix.

Posted on 2011-05-04
Last Modified: 2012-05-11
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:

But what about for exponents?
does this go from right to left?
If so is this the only step thats different with exponents?
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...
Question by:Eindoofus
    LVL 31

    Expert Comment

    I use left to right associativity for exponents:
    ((3^2)^1) = 9

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

    Author Comment

    This follow is from:

    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?

    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.

    Author Comment

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

    With the following:
    Is there anyway to get 19 out of that? The only thing I can pull from that is 49.
    LVL 31

    Expert Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Title # Comments Views Activity
    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 ( 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 …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now