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.
[OT] (Cos x)^x

11302007, 04:11 PM
12012007, 12:47 AM
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 realvalued result for noninteger 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
12012007, 04:17 AM
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.
12012007, 08:54 AM
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.
12012007, 01:48 PM
Quote: Indeed, that's the first step in finding the derivative. Then, the "chain rule" and derivative of a product function.  KS
12012007, 02:19 PM
Hi, Chuck  Thank you for the plot, which would be laborious to produce using an HP15C and graph paper...
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 realvalued result.
Quote: 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: As expected, since larger exponents "reduce" smaller arguments. That is, x^{a} < x for x < 1 and a > 1. I understand the solid lines of the plot, where the function has a realvalued 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.
12012007, 08:45 PM
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 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 TI84 and use "Zoom Decimal" you can get a fairly decent graph of this behavior.
CHUCK
Edited: 1 Dec 2007, 8:47 p.m.
12022007, 03:23 AM
Chuck  I'm beginning to understand the discontinuous portion of the plots.
Quote:
The only negative realvalued results, it seems to me, are those for which (cos x) is negative, and x is an odd integer. E.g., The two data points you listed (71/35 and 72/35) have only complexvalued function results. The magntitudes of those complexvalued 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.
12032007, 01:39 PM
Quote: 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...
12042007, 12:13 AM
Aha! Thank you, Stefan, for clearing that up. Yes, I should have evaluated the powers (71, 72) and root (35) separately, using the HP32SII 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 HP15C and HP42S 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
12042007, 03:51 AM
Quote: 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
12122007, 04:50 PM
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. 
« Next Oldest  Next Newest »

Possibly Related Threads…  
Thread  Author  Replies  Views  Last Post  
HP35s Cos[x] and Tan[x] bugs resolved?  Thomas Windisch  2  1,490 
10312013, 01:12 PM Last Post: Dieter 

HP 15C LE COS key  troy  6  1,716 
09182011, 12:05 PM Last Post: From Hong Kong 

where is 35s cos bug  Andrew Nikitin  3  1,221 
10062008, 01:41 AM Last Post: Karl Schneider 

alternative cos(x) and tan(x) [HP33S]  Gerson W. Barbosa  7  2,122 
07272007, 02:22 PM Last Post: Gerson W. Barbosa 

asin(acos(atan(tan(cos(sin(7))))))  Valentin Albillo  6  1,804 
02142005, 07:04 AM Last Post: Ralph 

Is it possible to Plot a SIN or COS Graph in a 19Bii?  Marc  0  637 
12032003, 07:13 PM Last Post: Marc 