[OT] (Cos x)^x



#2

Getting my students ready for their calculus Final I had them differentiate y = (cos x)^x to find the slope when x=0. We then graphed the original function and analyzed all its behaviors (though not using calculus). Most calculators and computers had a difficult time producing an adequate graph of this. A good little exercise with a few suprises.


#3

Hi, Chuck --

This isn't really OT.

I believe that you'd posted earlier this year about other math functions/calculations such as i^i.

(cos x)x produces no real-valued result for non-integer values of x that give negative cosines (if I stated that right), which may account for the difficulty in computer plotting. I should try that on Matlab for practice; I haven't used it in a long while.

For those who are interested, the derivative is

(cos x)x [ln(cos x) - x tan x]

(Very minor programming "challenge": Calculate the derivative function assuming a stack loaded with x (as with SOLVE or INTEG), without executing "cos x" twice and without using a storage register.)

-- KS


Edited: 1 Dec 2007, 4:00 p.m. after one or more responses were posted


#4

Hi Karl. It's actually defined when negative, as long as the values aren't complex. Also, it resembles secant for x<0. The spikes and "U"'s get narrower for large x's. Crazy function. Here's what I get with Mathematica.

CHUCK

Edited: 1 Dec 2007, 10:08 a.m.


#5

Hi, Chuck --

Thank you for the plot, which would be laborious to produce using an HP-15C and graph paper...

Quote:
It's actually defined when negative, as long as the values aren't complex.

The function is defined continuously in the real domain for positive or negative x as long as "cos x" is positive. If "cos x" is negative, then only integer values of x can produce a real-valued result.

Quote:
Also, it resembles secant for x<0.

Since cosine is "even", [cos x = cos(-x)], for negative x we can write

(cos x)x = 1 / [(cos |x|)|x|

Of course, sec x = 1 / cos x.

Quote:
The spikes and "U"'s get narrower for large x's.

As expected, since larger exponents "reduce" smaller arguments. That is, xa < x for x < 1 and a > 1.

I understand the solid lines of the plot, where the function has a real-valued result, but the dotted parts (e.g., between pi/2 < x < 3*pi/2) don't seem to represent Re[f(x)].

-- KS

Edited: 1 Dec 2007, 3:35 p.m.


#6

The places where (Cos x)^x is negative is where the interesting pieces are. For my mathematica plot, I used a step size of 1/35 to "see" those parts. Depending on the numerator, the results will be either positive or negative (skipping over all of the complex results. For example

F(71/35) = -0.190819

F(72/35) = 0.209171

and since 71/35 < 2.04 < 72/35

F(2.04) = .1965 + .0248i

Wherever F(X) is negative, the function will be everywhere discontinuous (however, infinite positive values, infinite negative, and infinite complex.)

If you graph the function on the TI-84 and use "Zoom Decimal" you can get a fairly decent graph of this behavior.

CHUCK

Edited: 1 Dec 2007, 8:47 p.m.


#7

Chuck --

I'm beginning to understand the discontinuous portion of the plots.

Quote:
The places where (Cos x)^x is negative is where the interesting pieces are.

The only negative real-valued results, it seems to me, are those for which (cos x) is negative, and x is an odd integer. E.g.,
f(3) = -0.970277.

The two data points you listed (71/35 and 72/35) have only complex-valued function results. The magntitudes of those complex-valued solutions are equal to the values you listed. I'm not sure what determines why f(71/35) would be negative.

-- KS


Edited: 2 Dec 2007, 5:08 p.m.

#8

Quote:
The function is defined continuously in the real domain for positive or negative x as long as "cos x" is positive. If "cos x" is negative, then only integer values of x can produce a real-valued result.

Not only for real values, a^(-p/q)=1/a^(p/q) has also a real value for negative a (and integer p and q). Depending on odd or even p, the result is negative or positive. And since rational numbers are dense in the real space (and there are infinitely many of them in every interval), you see two branches whereever (cos q) is negative. Since computers don't know real real numbers...


Stefan


#9

Aha! Thank you, Stefan, for clearing that up. Yes, I should have evaluated the powers (71, 72) and root (35) separately, using the HP-32SII for example. I wasn't seeing the true point of the rational input arguments, believing it to be just discretization for plotting. Also, I trust the HP-15C and HP-42S best for calculations involving complex numbers -- accuracy, completeness, and rigor. However, they don't have the root function.

Still, the function is not strictly continuous for arguments producing negative (cos x), as not all numbers are rational.

-- KS


#10

Quote:
Still, the function is not strictly continuous for arguments producing negative (cos x), as not all numbers are rational.

Yes, I think you can't get more discontinuous. In every (however small) interval, you have infinitely (but still countable) many jumps, and in between are uncountable many points with no (real) function value at all.

Stefan

#11

Chuck,

What exactly did you tell Mathematica to get that plot?

I have been unable to get Gnuplot, Sage, or the 50g to get the same results. All produce a plot of just the continuous real parts.

If I change the function to (cos(x)^(x*35))^(1/35) and use a loop from -10 to 10 step 1/35 as you suggest I get the same plot as above but only for y > 0.

The principal root of cos(even/35)^even)^1/35 is real, but the principal root of cos(odd/35)^odd)^1/35 is complex. This explains my plot, but not yours.

To add to my confusion the 50g returns a real root for even or odd, yet does not produce the same plot. I find it interesting that the 50g returns -.19081 (a real) for (cos(71/35)^71)^(1/35), yet a complex for (-8)^(1/3). The principal root for cos(71/35)^71)^(1/35) should be 0.1901+ 0.0171i.

I understand why the 83+ was able to plot it, it only returns real roots.

Edited: 12 Dec 2007, 4:52 p.m.

#12

As far as I remember:

(COS x)^x=EXP(x LN COS x)

In a more general case: a^x=EXP(x LN a)

usually showed to be a useful transformation.


#13

Quote:
(COS x)^x=EXP(x LN COS x)

Indeed, that's the first step in finding the derivative. Then, the "chain rule" and derivative of a product function.

-- KS


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP-35s Cos[x] and Tan[x] bugs resolved? Thomas Windisch 2 636 10-31-2013, 01:12 PM
Last Post: Dieter
  HP 15C LE COS key troy 6 803 09-18-2011, 12:05 PM
Last Post: From Hong Kong
  where is 35s cos bug Andrew Nikitin 3 563 10-06-2008, 01:41 AM
Last Post: Karl Schneider
  alternative cos(x) and tan(x) [HP-33S] Gerson W. Barbosa 7 863 07-27-2007, 02:22 PM
Last Post: Gerson W. Barbosa
  asin(acos(atan(tan(cos(sin(7)))))) Valentin Albillo 6 790 02-14-2005, 07:04 AM
Last Post: Ralph
  Is it possible to Plot a SIN or COS Graph in a 19Bii? Marc 0 314 12-03-2003, 07:13 PM
Last Post: Marc

Forum Jump: