help-octave
[Top][All Lists]

## Re: plotting even function

 From: Mike Miller Subject: Re: plotting even function Date: Sun, 20 Mar 2005 11:47:06 -0600 (CST)

```On Sun, 20 Mar 2005, Geraint Paul Bevan wrote:

```
```-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John B. Thoo wrote:

```
```Also, why is  (x^(1/3))^2  not even?  If  f(x) = (x^(1/3))^2,  then isn't
f(-x) = ((-x)^(1/3))^2 = (- x^(1/3))^2 = (x^(1/3))^2 = f(x)
```
```

```
It is not true to say that (-x)^(1/3) is the same as -(x^(1/3)). That is one possibility but there are two more. If n is an integer, x^n has a unique value but x^(1/n) has n possible values i.e. the square root x^(1/2) has two possible values, the cube root x^(1/3) has three possible values, etc.
```
```
Consider that (-x)^(1/n) can be re-written as ((-1)*(+x))^(1/n) which is ((-1)^(1/n))*((+x)^(1/n))
```
For symmetry about the y-axis, you therefore require that:
(-1)^(1/n) = -1.

However, for n=3, y=(-1)^(1/n) has three solutions:
y = -1
y = 0.5+i*sqrt(3)/2
y = 0.5-i*sqrt(3)/2

```
You obviously want to use the first of these solutions to get symmetry about the y-axis but Octave doesn't know that unless you tell it.
```

```
I am not a mathematician, but I believe that you are missing something. The equation y^3 + 1 = 0 has three solutions, as noted above. The equation y^3 - 1 = 0 also has three solutions:
```
y = 1
y = -0.5-i*sqrt(3)/2
y = -0.5+i*sqrt(3)/2

```
How does Octave "know what we want" (1) in the latter case, but it does not know what we want (-1) in the former case? I think the answer has to do with numerical analysis. The binary representation of 1/3 is never exactly 1/3, but it is only at the exact value of 1/3 that (-1)^(1/3) equals -1. This is not a problem for (+1)^(1/3).
```
```
For (-1)^(333/1000), Octave gives a very similar answer to what it gives for (-1)^(1/3), which seems appropriate. Octave doesn't seem to know or care that there are 1000 possible solutions in the complex plane!
```
Mike

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```