LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 1996, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 30 Apr 1996 20:51:22 +0100
Reply-To:     John Whittington <johnw@MAG-NET.CO.UK>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         John Whittington <johnw@MAG-NET.CO.UK>
Subject:      Exponentiation of Negative Numbers

More mathematics than SAS, but .....

It seems as if SAS operates a blanket refusal to raise negative numbers to non-integer powers, even in those situations (e.g. when the exponent is the reciprocal of an odd integer) when it is a valid operation which should be able to yield a real (i.e. non-'imaginery') solution, e.g.:

x = (-32) ** 0.2 ; which should evaluate to -2

This is a mild nuisance, but one can hard-code a workaround very easily.

In other situations (i.e. exponents which are NOT the reciprocals of odd integers), I can certainly understand the problem. Are there any mathematicians out there who can tell me what, if anything, is the meaning of a negative number raised to such a power? With positive numbers, one can conceptualise non-integral powers in terms of logarithms - but life is not so easy when the numbers are negative; one can, I suppose, try to think in terms of the absolute value of the answer being the same as it would be for the corresponding positive number, but what then would be its sign? I suspect that is far too simplistic, and that the answer is in fact a complex number.

The point behind this is that it is clearly possible to have an algorithm coded in SAS such that, with certain data, attempts would be made to raise a negative number to a non integral power. My question is - Is this *always* going to represent an error condition - mathematically as well as in the eyes of SAS?

In passing, for anyone who is not aware, I might remind that the syntax:

x = (-32) ** 5 ; is necessary because (unlike some other languages), SAS interprets:

x = -32 ** 5 ; as meaning x = - (32 ** 5) ;

John

----------------------------------------------------------- Dr John Whittington, Voice: +44 1296 730225 Mediscience Services Fax: +44 1296 738893 Twyford Manor, Twyford, E-mail: johnw@mag-net.co.uk Buckingham MK18 4EL, UK CompuServe: 100517,3677 -----------------------------------------------------------


Back to: Top of message | Previous page | Main SAS-L page