Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: any number raised to zero power should be positive  one
Date: Mon, 30 Mar 2009 01:47:01 +0000 (UTC)
Organization: Battelle Energy Alliance (INL)
Lines: 19
Message-ID: <gqp8al$9km$1@fred.mathworks.com>
References: <gqp6o6$3vv$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1238377621 9878 172.30.248.37 (30 Mar 2009 01:47:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 30 Mar 2009 01:47:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 688530
Xref: news.mathworks.com comp.soft-sys.matlab:528564

"Aaron Friedman" <aaron-friedman@att.net> wrote in message <gqp6o6$3vv$1@fred.mathworks.com>...
> I am new to MatLab. I inputted a very basic equation:
> 
> (-1)^0   (I also tried (-1).^0 )
> 
> I got -1. That's an incorrect answer. Anything raised to zero power is 1 not -1.
> I also tried -12^0 and got -1. Should be 1. 12 ^ 0 is 1 which is OK.
> 
> Anyone know what's happening?


Simply by what you wrote, I am going to guess that you didn't always place parenthesis when you actually entered the calculation into Matlab.  This has everything to do with operator precedence.

>> (-1)^0
ans =
     1
>> (-12)^0
ans =
     1