MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Negation versus Exponential

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27123] Negation versus Exponential
  • From: davidktw at mbox3.singnet.com.sg (David Kwok Tai Wei)
  • Date: Sun, 4 Feb 2001 02:58:58 -0500 (EST)
  • Organization: The Math Forum
  • Sender: owner-wri-mathgroup at wolfram.com

I have a very simple question here

should Negation (~) have a lower precedence than Exponential

becoz if that's the case, ~1^2 should be evaluated as -1 instead of 1.

-1 is incorrect becoz when I calculate ~1^2, I don't use brackets at
all. so why must I explicitly bracket the expression --> (~1)^2, just
to overcome the fault, that negation should be of higher precedence
than exponential.

when dealing with infix expression, computers will usually convert to
postfix expression b4 evaluating them.

hence a^~f will yield the postfix of a^f~, provided negation is of
lower precedence than exponential.

looking at the postfix, if I try to evaluate it using a stack, it will
generate error becoz when I try to evaluate ^ and pop 2 operands from
the stac, only one is available.

On the other hand, if I set negation of higher precedence than
exponential, all such errors will be solved.

So why stick to the old convention where it's wrong. It's such a
shame.

Please reply me by emailing to davidktw at mbox3.singnet.com.sg
thanks


  • Prev by Date: Re: assigning parameters from a matrix
  • Next by Date: Re: Raise lists of a list to powers
  • Previous by thread: Re: matrix inversion
  • Next by thread: Re: Negation versus Exponential