The Museum of HP Calculators

HP Forum Archive 19

[ Return to Index | Top of Index ]

Cosine for fun
Message #1 Posted by Chuck on 4 Dec 2009, 12:35 a.m.

A fellow colleague of mine asked her calculus class what the graph of y=Cos(x)^Cos(x) might look like (for real valued results). A TI84 didn't show any of the "interesting" part. A TI89 showed a little of it. With Mathematica I was able to show "almost all" of it (with some effort), but unfortunately I haven't tried it on an HP yet (I'll have to dig out my HP50 from storage this weekend).

What was interesting is that for expressions like (-1/3)^(-1/3) [hint] the TI84 gave the real valued root, but the Casio fx9860g gave the first complex valued root, agreeing with Mathematica (which is why it took some effort with Mathematica to graph the real parts).

For a "fun" weekend time waster see if you can get a "mostly complete" graph from 0 to 2pi.

Edit: don't trust Wolfram Alpha entirely on this one.

Edited: 4 Dec 2009, 12:40 a.m.

      
Re: Cosine for fun
Message #2 Posted by Bart (UK) on 4 Dec 2009, 5:56 a.m.,
in response to message #1 by Chuck

If it's plotting the real values of the results of Y=Cos(x)^Cos(x) for x=0 to 2pi, then on the 48G:
PLOT menu:
Equation = 'RE(Cos(x)^Cos(x))' edit#2: should read EQ: 'Y=RE(Cos(x)^Cos(x))' [does not seem to make a difference though]
Independent variable = X
X-scale =0, 360
Y-scale automatic
Output graph:
click here.

Edit: the above was in DEG mode, similar results are obtained in RAD mode for X=0 to 6.2832 (2pi).

If the absolute value of the eqution is used ('Y=ABS(Cos(x)^Cos(x)'), the following is obtained:
ABS(Cos(x)^Cos(x).

Edited: 4 Dec 2009, 8:10 a.m. after one or more responses were posted

            
Re: Cosine for fun
Message #3 Posted by Marcelo Vanti (Brasil) on 4 Dec 2009, 7:53 a.m.,
in response to message #2 by Bart (UK)

Hello, I don't know why my hp 50g can't plot the middle part of the graph.I used the same settings that Bart. The table function results in indefinite values for the corresponding x, but if I evaluate the function in the stack it gives the correct result. So I had to plot the following program: << x cos dup ^ RE >>. That's works.

                  
Re: Cosine for fun
Message #4 Posted by Marcelo Vanti (Brasil) on 4 Dec 2009, 8:16 a.m.,
in response to message #3 by Marcelo Vanti (Brasil)

Hello again ,
Finally, I did the plot using on the Plot Setup of the 50g
EQ: << RE(cos(x)^cos(x))>>.
But, if I try without the markers program, then it doesn't work.
Anybody know why?
Marcelo

            
Re: Cosine for fun
Message #5 Posted by Chuck on 4 Dec 2009, 7:30 p.m.,
in response to message #2 by Bart (UK)

The interesting part is where pi/2 < cos(x) < 3pi/2 because here the values of cos(x) are negative (between -1 and 0), causing negative numbers to be raised to negative number.

This can cause complex or imaginary results: such as (-.5)^(-.5) = -1.414i, which can not be graphed on the real coordinates system (don't just graph the real part of the solution)

....or negative results such as (-1/3)^(-1/3) = -1.4422
....or positive results such as (-2/3)^(-2/3) = 1.3104

It all depends on the numerator and denominator being odd or even, and the irrationality of the numerator and denominator.

So, depending on the value of cos(x) in this region the graph should bounce from positive and negatives, but not be connected anywhere due to the complex results.

The trick was to get a graph to show this behavior. Some calculators will only show the complex values (or roots), and others give the real valued roots.

For instance, the value of (-2/3)^(-2/3) will either be real or complex depending on the calculator or math software: Hp's and TI's give the real root, while Mathematica and the Casio Fx9860g will only give the complex root.

The trick was to find the values of x that produces real roots (both positive and negative). After some trial and error, this is what I came up with:

The middle portion is the non continuous positive-negative-complex behavior. It should be filled-in completely, but I only used fractions as large as -38/39 (i.e. (-38/39)^(-38/39) which gives a positive value) and this will occur for radians of about 2.91 and 3.368, hence the large gap. Had I used values closer to 1, i.e., 257/259 the gap would have been smaller.

Anyway, fun problem, but I think I spent way to much time kicking it around. :)

Have great weekend.

CHUCK

Edited: 4 Dec 2009, 7:52 p.m.

      
Re: Cosine for fun
Message #6 Posted by Dave Britten on 4 Dec 2009, 2:09 p.m.,
in response to message #1 by Chuck

Here's a screen grab of three superimposed graphs:

RE(COS(X)^COS(X))
IM(COS(X)^COS(X))
ABS(COX(X)^COS(X))


XRNG: (0, 2*PI), YRNG: (-2, 2)

And here's a graph of RE(SIN(X)^COS(X)), which happens to be discontinuous at x=PI:


XRNG: (0, 2*PI), YRNG: (-2, 2)

            
Re: Cosine for fun
Message #7 Posted by Chuck on 4 Dec 2009, 7:39 p.m.,
in response to message #6 by Dave Britten

Dave, your graphs are similar to what Wolfram|Alpha gives: individual graphs of the real part a the first root, or the imaginary part of the first root. However, I'm looking for the graph for just the entire real roots, not just the real portion.

That is...there are three cube roots of (-3) or three values (-1/3)^(-1/3). Two are complex, one is real: graph the real one. The problem is, some CAS give only the first complex value making graphing the real root impossible (and other values have no real root). I hope I make sense. :(


[ Return to Index | Top of Index ]

Go back to the main exhibit hall