On Wed, 12 Aug 2020, Alecos Papadopoulos wrote:
Let X be a series of negative numbers. Then the command
series Y = X^(1/3)
(or any other "1/oddnumber" fractional power)
returns a "Warning: pow: Domain error" message, overwrites series "Y"
and
returns a "no valid values" if one attempts to view the series.
Why is this happening, considering that X^(1/3) is a real number even if X is
a negative number?
Are you sure of your ground here, Alecos?
We use the C library's pow() function for this job, and here's an
extract from the manual page for pow(), which conforms to the C99
standard:
<quote>
double pow(double x, double y);
RETURN VALUE
On success returns the value of x to the power of y.
If x is a finite value less than 0, and y is a finite
noninteger, a domain error occurs, and a NaN is returned.
</quote>
For reference here's what happens in R:
<input>
x <- -3
y <- 1.0/3
x^y
</input>
<output>
x <- -3
y <- 1.0/3
x^y
[1] NaN
</output>
and in octave:
<input>
x = -3
y = 1.0/3
x^y
</input>
<output>
x = -3
y = 0.33333
ans = 0.72112 + 1.24902i
</output>
Allin