help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plotting even function


From: John B. Thoo
Subject: Re: plotting even function
Date: Sat, 19 Mar 2005 23:19:21 -0800

First, thanks to Steve T, Henry M, Geraint B, and Thomas S for their replies.

Thomas, your plotting example

octave:5> y = 3/4*((2*x).^2).^(1/3)+1/2;
octave:6> plot(x,y)

gives what I expected.

I learnt something tonight. When I teach (high school) algebra, I tell my students that for rational m/n in lowest terms,

  a^(m/n) = (a^m)^(1/n) = ( a^(1/n) )^m

as long as a^(1/n) is real. And, for n odd, there is no reason at this level to think that a^(1/n) is not real.

In my example, 2/3 is clearly(?) a rational exponent with n=3 odd, so I never expected that Octave would treat a^(1/3) as complex. Certainly food for thought for me.

So, thanks again to all for your help.

Oh, in case you're interested in how this came up for me, I was plotting normals to the curve y = x^2,

> x = -1:0.04:1;  t = -1:1:1;
> for i = 1:51
> plot (t, -t ./ (2 * x (i)) + (1 + 2 * x (i).^2) ./ 2, "-b")
> endfor

and the envelope of the normals (the evolute of the parabola?) is given by the curve I had asked about,

  y = (3/4) (2x)^(2/3) + 1/2.

Anyhow, thanks again.

---John.


On Mar 19, 2005, at 12:48 PM, Thomas Shores wrote:

Umm... make that
y = 3/4*((2*x)^2)^(1/3) + 1/2

So add to my last plotting suggestions

octave:5> y = 3/4*((2*x).^2).^(1/3)+1/2;
octave:6> plot(x,y)

Tom Shores

On Saturday 19 March 2005 08:36 pm, Thomas Shores wrote:
Hmmm...
Well, actually the function really *is* even if you think of
it this way:

y  = 3/4*((2*x)^2)^3 + 1/2

Here's the problem: how do you know that the exponent is a
rational fraction, so that you can reinterpret it?  Octave
rightfully doesn't.  It evidently uses complex analysis to
find non-integral powers.  Try this

octave:16> x = (-1)^(1/3)
x = 0.50000 + 0.86603i
octave:17> x^3
ans = -1.0000e+00 + 3.6370e-16i

So octave calculates a complex third root of unity, rather
than the real root x = -1 that might spring to mind.  Makes
sense, since you can generate the other roots from the
complex primitive root of unity.

Tom Shores

On Sunday 20 March 2005 01:20 am, Geraint Paul Bevan wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John B. Thoo wrote:
| Hi.  I hope that I'm not embarrassing myself by asking
| the following.
|
| I believe that
|
|        3       2/3    1
|   y = --- (2 x)    + ---
|        4              2
|
| is an even function, yet
|
| x = -1:0.04:1;
| plot (x, 0.75 * (2 .* x).^(2 / 3) + 0.5)
|
| is not symmetrical about the y-axis.  What is wrong with
| my thinking?
|
| TIA.
| ---John.

x^(2/3) is not an even function,

octave:1> [ (+8)^(2/3) ; (-8)^(2/3) ]
ans =

~    4.0000 + 0.0000i
~   -2.0000 + 3.4641i

so nor is the function which you are plotting.

- --
Geraint Bevan
http://homepage.ntlworld.com/geraint.bevan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iEYEARECAAYFAkI8z/sACgkQcXV3N50QmNOi1QCdEvZ44CO0bbl0h+TQvgF
pD 9uy YQgAn2a4A1x4m7ZdST8vG9IBRgBu1lCW
=7F+W
-----END PGP SIGNATURE-----



-----------------------------------------------------------
-- 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
-----------------------------------------------------------
--

-------------------------------------------------------------
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
-------------------------------------------------------------




-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]