Wikipedia:Reference desk/Archives/Mathematics/2007 December 12

= December 12 =

Entering cosine repeatedly
Why is is that when you enter any number into a calculator and then take the cosine of it repeatedly it, when set on degrees, tends towards about .99984774, or when it is set on radians, towards about .7390851? You can see this happen too if you put a bunch of cosines in front of x in a graphing program. The wave tends towards a line. Imaninjapiratetalk to me 02:18, 12 December 2007 (UTC)


 * You might find it useful to glance at the article on attracting fixed points, especially the diagram Image:Cosine_fixed_point.svg. First of all, the number you mention is a fixed point of the cosine function, that is, cos(0.7390851…) is exactly equal to 0.7390851….  The reason that any number gets closer and closer to 0.7390851… as you keep applying the cosine function depends in part on the fact that the graphs of y = x and y = cos(x) cross at the fixed point with one function increasing and the other decreasing.
 * Speaking a bit more technically, suppose you know that cos(x) = x + h, where h is some small number. Then by the  angle sum identity for cosine,
 * $$\cos(\cos(x)) = \cos(x + h) = \cos(x) \cos(h) - \sin(x) \sin(h).$$
 * But since cos(h) is close to 1 and sin(h) is close to 0 when h is small, it follows that cos(cos(x)) is close to cos(x).   That is, if cos(x) is close to x, then cos(cos(x)) is also close to cos(x).  If you wanted to get really technical, you'd have to put a little more detail into how close "close" is, but I hope the picture I linked to above and this heuristic argument give the basic idea. Michael Slone (talk) 03:18, 12 December 2007 (UTC)


 * Of course, all this is assuming that we take $$\cos x$$ with $$x \in \R$$. The point you mentioned will still be an attracting fixpoint, but it's quite likely that it isn't the only one. You just need to solve $$2z = e^{iz} + e^{-iz}$$, and I can't remember enough complex analysis right now to do that. mattbuck (talk) 03:32, 12 December 2007 (UTC)


 * You're absolutely right. I wrote my response under the assumption that the OP's calculator accepts only real numbers (well, floating-point rationals) as input.  For what it's worth, Maple says that $$2z = e^{iz} + e^{-iz}$$ has a unique solution, but it's been differently truthful before. Michael Slone (talk) 05:06, 12 December 2007 (UTC)


 * Although I'm a little iffy on why y=x crosses at that point also, the more technical explanation makes a lot of sense and is really interesting (I prefer algebra to geometry). Thanks for the response! Imaninjapiratetalk to me 04:29, 12 December 2007 (UTC)


 * You're welcome! By the way, you can use the intermediate value theorem to show that the line crosses the graph of the cosine function somewhere between 0 and 1.  Since x is less than cos(x) when x is 0 but is bigger than cos(x) when x is 1, somewhere in the middle they must have the same value.  The intermediate value theorem doesn't tell you that 0.7390851… is where the graphs cross; it just says that they do cross somewhere between 0 and 1. Michael Slone (talk) 05:06, 12 December 2007 (UTC)

You may be interested in a similar discussion that happened about a year ago here: Reference_desk_archive/Mathematics/2006_September_23. - Rainwarrior (talk) 06:50, 12 December 2007 (UTC)
 * As for the degrees part - if you set your calculator to degrees, pressing "cos" when the current value is x will return $$\cos\left(\frac{x \pi}{180}\right)$$. Considerations similar to above show that the result will tend to the solution of $$\cos\left(\frac{x \pi}{180}\right)=x$$, which happens to be .99984774... (it makes sense, since $$\frac{x \pi}{180}$$ is close to 0, so its cosine should be close to 1). -- Meni Rosenfeld (talk) 09:42, 12 December 2007 (UTC)

Say the number you entered was x. Since you're taking the cosine of it repeatedly, the expression you're getting is:

cos(cos(cos(cos(cos(cos(...))))))))) of a variable x. Let's call this whole expression y. So y = cos(cos(cos(cos(cos(...)))))))

If you look closely, you'll notice that the argument of this expression is the expression itself. So y = cos(y). The solutions to this equation for y are the values you originally gave. —Preceding unsigned comment added by 124.191.113.111 (talk) 12:34, 14 December 2007 (UTC)

BibTeX and Beamer
Hi everyone. I'm giving a talk in a couple days at a colloquium, and I'm using Beamer to set up some slides. However, I also want to use BibTeX so I can give credit where credit is due. The problem is that next to each item in the bibliography, instead of a [1] or a [2] (as appropriate), there is a weird looking icon that looks like a page with one corner folded over.

Inside the actual slides, the correct numbers appear as references, but it's just on the actual references page that they're messed up. Does anyone have any experience with this or has encountered this problem themselves? I can't seem to find a fix on the net. Thanks for your help! –King Bee (&tau; • &gamma;) 13:42, 12 December 2007 (UTC)


 * A workaround, if no one comes up with a fix: edit the .bbl file yourself, and run LaTeX again but without running BibTeX (which would overwrite the file!) again. It should be pretty obvious how to replace the icons with simple numbers (but remember that sometimes you need to put braces around brackets!).  --Tardis (talk) 14:29, 12 December 2007 (UTC)


 * When I look at my .bbl file that is generated, a typical entry looks like this:
 * I don't really see where these icons are coming from. Are you suggesting that I substitute all this stuff in the place of \bibliography{myrefs}? –King Bee (&tau; • &gamma;) 14:43, 12 December 2007 (UTC)
 * UPDATE: If that's what you're suggesting, it doesn't work. I still have the weird icons, no numbers. –King Bee (&tau; • &gamma;) 14:49, 12 December 2007 (UTC)
 * Sorry my suggestion was no good. I wasn't looking at a .bbl when I wrote it, and I thought it was more literal and less command-laden than it is; I meant to replace some obvious icon-generating code with literal   and such, without modifying the .tex file.  --Tardis (talk) 16:27, 12 December 2007 (UTC)
 * Sorry my suggestion was no good. I wasn't looking at a .bbl when I wrote it, and I thought it was more literal and less command-laden than it is; I meant to replace some obvious icon-generating code with literal   and such, without modifying the .tex file.  --Tardis (talk) 16:27, 12 December 2007 (UTC)


 * Problem solved! Beamer's default is to add these wacky icons; you have to add the command \beamertemplatetextbibitems in order to get it to display numbers instead of symbols. Very odd, but problem solved. –King Bee (&tau; • &gamma;) 15:44, 12 December 2007 (UTC)
 * Excellent. In case you need it, though, I think this will, when placed inside the   environment, force the use of sensible labels:

\makeatletter \def\@itemlabel{\@biblabel{\@arabic\c@enumiv}} \makeatother
 * I adapted that from latex.ltx and <tt>article.cls</tt>. --Tardis (talk) 16:27, 12 December 2007 (UTC)


 * Beamer is very user friendly and customizable. Whenever you think beamer is doing something too fancy or not fancy enough, just check the beamer docs.  There is usually some long command name already written that does precisely what you want.  In particular you never need to use tex like \makeatletter or \def. JackSchmidt (talk) 19:05, 12 December 2007 (UTC)