1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Order of Operations Conventions

Discussion in 'Mathematics and Physics' started by jpanhalt, Feb 21, 2016.

  1. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,888
    Likes:
    500
    Location:
    Cleveland, OH, USA
    This thread has been split off from the following thread:
    http://www.electro-tech-online.com/threads/how-do-i-in-latex.147332/


    As I recall, -2^2 = -4 by today's conventions. You seem to be missing a parenthesis or two. ;) So, perhaps to be consistent, the roots should be 2 and (-2). I hope that seminal thread has not been lost. I learned a lot from it.

    John
     
    Last edited by a moderator: Feb 24, 2016
  2. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    Hmm, fair point I suppose, though generally I think [​IMG] implies (+x) and (-x). You really only need the parentheses if you are going the other way around, squaring the value.
     
  3. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,888
    Likes:
    500
    Location:
    Cleveland, OH, USA
    That is what Papabravo and I both thought, and it was was taught that way at least through the 1970's. Don't know when the change occurred. But, you have to roll with the punches, so long as they are consistent. Frankly,
    never caused a problem until some pedagogue decided it did.

    Not really. If you don't happen to know the alternate code for ±, then you have to write +2 and -2. The parentheses are not implied in the strictest sense. One must be consistent. Now, one might accept (±2), but that is not what you wrote. Don't get me wrong. I think the change is silly.

    John
     
    Last edited: Feb 21, 2016
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)

    [​IMG] equals -4 due to PEMDAS. Exponents come first, addition/subtraction/negation last. That's why I said it's important to use parentheses when you're going the other way around. When you're squaring a negative value the parentheses are absolutely necessary. But when you're taking the square root you do not need parentheses, the answer is simply ±x
     
  6. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,702
    Likes:
    426
    Location:
    SCOTLAND
    Today your told to drop parenthesis where you can, not too sure of the reasoning for this. Thanks for all the heads up i will have a try .
     
  7. djsfantasi

    djsfantasi Member

    Joined:
    Mar 15, 2011
    Messages:
    161
    Likes:
    21
    Location:
    Metro Boston
    There are different conventions regarding unary operations. In particular written mathematics convention is that -2^2=-4. However, in coding, the unary operator has precedence over the binary (2 operands, not base2) operators. Hence -2^2=(-2)^2.
     
    • Informative Informative x 1
  8. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,011
    Likes:
    316
    Location:
    Brisbane Australia
    ONLINE
    Minus 2 squared has always, and always will be, 4. End of.

    Mike.
     
  9. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    Only if "minus 2" is defined as "-2" with parentheses. Once again, use the order of operations (PEMDAS).
     
  10. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,011
    Likes:
    316
    Location:
    Brisbane Australia
    ONLINE
    Minus 2 times minus 2 is 4. Simples.

    Mike.
    P.S. stick it in your calculator and see what it thinks.
     
  11. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,702
    Likes:
    426
    Location:
    SCOTLAND
    both mine say 4 although one dosnt like me starting with a -2 !!!! I will try on the graph calculator as well it would be interesting to see if ANY come up with a different answer as most are now VEPRAM or equivalent
     
  12. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,702
    Likes:
    426
    Location:
    SCOTLAND
    Graph says 4. EXCEL on the other hand says -4!! So does Matlab, so as AUS Dave would say 'A trap for young players!'.
    Interesting stuff!
     
  13. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,910
    Likes:
    1,095
    matt:

    Usually you can do a quote and get back the Latex. On this thread, there's too much of mix of pics and real Latex and I tried it on a few posts in this thread and got image results.
     
  14. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,011
    Likes:
    316
    Location:
    Brisbane Australia
    ONLINE
    Excel (2013) says 4, I put in =-2^2.

    Mike.
     
  15. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,702
    Likes:
    426
    Location:
    SCOTLAND
    I did it wrong then Pommie, I put -2+-2= doing what you did gave me 4 in both Matlab and excel as well, sorry for the mess up everyone
     
  16. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    I think you mean -2*-2?
     
  17. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,888
    Likes:
    500
    Location:
    Cleveland, OH, USA
    I may have confused Pommie with Papabravo in the much earlier thread I recollected. If I did, please accept my apology. Anyway, I couldn't find that thread. At the time, I made some comment to the effect that negative numbers might be considered as entities themselves, rather than as "-1 x number." My concern was that application of PEMDAS in that way effectively eliminates "negative" numbers. In other words, I support the view that we have "negative numbers," and we have negation as an operator.

    Yesterday, I did find a discussion from Drexel University that I had previously missed on the very point of PEMDAS as applied to negative numbers. My reading of that essay is that the matter is not completely settled (http://mathforum.org/library/drmath/view/61633.html ).

    Can someone here provide a more current and definitive statement on the subject?

    John
     
  18. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,702
    Likes:
    426
    Location:
    SCOTLAND
    No I meant -4 Matt :S
     
  19. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    I have always seen -x treated as 0-x, in which case negation is a form of subtraction and thus is completed last. I haven't looked for any definitive articles on the subject though.
     
  20. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    The gentleman who wrote in the link John posted seems to agree with me in a different post:

    http://mathforum.org/library/drmath/view/53194.html

    Also, regarding Excel, notice the last paragraph on the page:

    Microsoft understands that their "order of operations" is not standard, but still refuses to change it. For that reason I don't put much trust in what is returned from Excel.
     
  21. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,702
    Likes:
    426
    Location:
    SCOTLAND
    Considering excel is supposed to be 'THE' spreadsheet, why would they do something that stupid??? That is totally bonkers. I wonder if open office blindly followed them
     
    • Agree Agree x 1

Share This Page