#4 Order of operations violation

closed
nobody
None
5
2006-12-03
2006-08-03
Anonymous
No

I believe the following expression:

ar

is interpreted as a * r. This is good. However, the
following expression:

ar^m

is apparently interpreted as (a * r)^m rather than a *
r^m. Given that exponents take precedence in order of
operations, isn't the latter preferable?

I was playing around with geometric series equation and
having a lot of trouble until I figured out that this
was the root cause.

Discussion

  • James Aamodt Hart

    Logged In: YES
    user_id=779719
    Originator: NO

    ar should be interpreted as single variable with the name "ar", just like the expression pi will represent the variable "pi" rather than p*i. To get multiplication, you have to use either a space between the variables or a '*'.

     
  • James Aamodt Hart

    • status: open --> closed
     

Log in to post a comment.