Wikipedia:Reference desk/Archives/Mathematics/2007 April 17

From Wikipedia, the free encyclopedia
Mathematics desk
< April 16 << Mar | April | May >> April 18 >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


April 17[edit]

Best Approximation[edit]

I'm trying to solve a bit of a puzzle. I think I've got it right, but I'm not sure. The question is, given two bounds (for instance .0001 and .0002), can you find the fraction of smallest denominator that falls between those bounds? Faster than exhaustive search, of course. I think it could be done with Farey fractions, keeping track of only three at a time - (a,b,c). Starting out with a=0/1 and c=1/0, in each step you'd calculate b by adding the numerators and denominators. If b was above the range, set c to b, if below, set a to b, and repeat. The first b to be within the range is the answer. Is that right? Black Carrot 00:04, 17 April 2007 (UTC)[reply]

I don't think anything so complex is needed. The greater bound (.0002) = 1/5000. That's the smallest possible denominator. --JayHenry 00:22, 17 April 2007 (UTC)[reply]
While a unit fraction is that best choice for the particular bounds given, it isn't necessarily always the best choice. For the bounds 0.65-0.70, for example, 2/3 is the fraction with the lowest denominator. I believe he wants a general solution method which applies to all bounds. StuRat 00:38, 17 April 2007 (UTC)[reply]
Funny, I was thinking about exactly the same problem a couple of days ago. I tried to make the definitions a bit more rigorous by stating the problem as "Given an open subinterval (a,b) in [0,1], find the rational number p/q in (a,b) that minimises q." Sadly, while I can state the problem in fancy language, I don't know how to solve it either. Confusing Manifestation 01:39, 17 April 2007 (UTC)[reply]
And I wanted to find good fractional approximations of pi, but wrote a computer program to do it "the hard way", which, being a computer programmer and not a mathematician, I found to be the easy way. I believe I increased the denominator by 1 in each step, then found the real number that would be needed as a numerator to get exactly pi, then rounded that to the nearest integer, then divided that by the denominator to find how close the result was to pi. Each time I found a fraction that was a closer approximation of pi than the previous result, I printed it out. The whole program was probably only about 20 lines. This program could easily be modified to fit the current problem. StuRat 02:05, 17 April 2007 (UTC)[reply]
The simplest (not necessarily the fastest) method might be as follows. 1. Calculate the interval length d=ba. If it is a closed interval then there is at least one integer q such that q/d belongs to [a, b]. You can find it by dividing a/d and rounding up, or dividing b/d and rounding down. If your interval is open, the guaranteed denominator would be d=ba+1. 2. Search all natural values from initial d down to 1 and repeat same calculations - for each d* check if ceiling(a/d*) ≤ floor(b/d*), and remember the last (smallest) value that satisfies the equality. That would be your denominator. --CiaPan 05:55, 17 April 2007 (UTC)[reply]
See the article on continued fractions, the section on best rational approximations. (StuRat, there is a discussion specifically about π.) For an interval [a,b], write the continued fraction for each end, then compare. To use the [0.65,0.70] example, the continued fractions are [0;1,1,1,6] and [0;1,2,3]. Take [0;1,2], and we automagically get 23. To quote Bill Gosper (see here):
  • "Write as continued fractions the two endpoints of the interval in question, stopping at least one term beyond the one where they first disagree, except that if one of them terminates before disagreeing, suffix to it a term of ∞. Set aside whatever initial sequence of terms they have in common. These terms will be the initial ones of the simplest included rational, as well as all of the other numbers in the interval. Now we need only find the simplest rational in an interval whose endpoints have continued fractions which start with different terms. (If we have set aside all of the terms of one endpoint, we are left with an explicit ∞.) The only way this new interval can fail to contain ∞ or at least one integer is if the upper endpoint is itself an exact integer, but is excluded by virtue of being the tail of an endpoint which was excluded in the original problem. It must also be the case that the lower endpoint has an initial term 1 less than the upper one. The easiest thing to do in this case is to rewrite the single term which is the upper endpoint as the previous integer followed by a 1, e.g., 3 1 instead of 4. Then we again have two continued fractions which start with the same term, and can proceed with the recipe."
(I have taken the liberty of replacing "oo" with "∞".) Or to quote HAKMEM Item 101C:
  • "Express the endpoints as continued fractions. Find the first term where they differ and add 1 to the lesser term, unless it's last. Discard the terms to the right. What's left is the continued fraction for the "smallest" rational in the interval. (If one fraction terminates but matches the other as far as it goes, append an infinity and proceed as above.)"
Apparently the marvelous properties of continued fractions have not been conveyed to a large enough audience. Read enough Gosper and you may become a fan. --KSmrqT 06:47, 17 April 2007 (UTC)[reply]

Nifty. So, I was wrong? Will it not work? Black Carrot 08:11, 17 April 2007 (UTC)[reply]

Black Carrot, I think your method is fine. Essentially, you are navigating the Stern-Brocot tree. You will reach the same result as the Gosper method described above. There are close links between the Stern-Brocot tree, Farey sequences and continued fraction expansions. Gandalf61 08:38, 17 April 2007 (UTC)[reply]
It is fine for positive numbers; for 0 there is a problem if you are using closed intervals. Also, if the lower bound x of the interval is large, you get many iterations (try x = 1000000). If you set the initial numerator of fraction a to floor(x)−1, you avoid both issues. The value of x should be more than −1, though, and for example the interval [1/1000001, 1/1000000] still requires many iterations. The Gosper method has none of these problems.  --LambiamTalk 10:37, 17 April 2007 (UTC)[reply]

That's a good point. Thank you very much. Black Carrot 03:55, 18 April 2007 (UTC)[reply]

Americans can't count[edit]

CNN says "Gunman massacres 32 at two Virginia Tech sites"

Yahoo News says "Gunman kill 32 brings death toll to 33"

BBC News says "Survivors of campus shootings in Virginia that left 33 dead."

CBC says "At least 33 people are dead."

ABC says "Gunman kill 32 before turning the weapon on himself."

So how many people did the gunman kill? Perhaps the gunman is a non-human space alien because how can he kill 32 and yet bring the death toll to 33. 202.168.50.40 05:28, 17 April 2007 (UTC)[reply]

He killed himself, so he's the 33rd. So, 32 were murdered, but 33 died, since one was a suicide. StuRat 05:37, 17 April 2007 (UTC)[reply]
BBC... America? All those figures say he killed 32 others, btw. --Wirbelwindヴィルヴェルヴィント (talk) 06:32, 17 April 2007 (UTC)[reply]
CBC... American? –Pomte 06:42, 17 April 2007 (UTC
ABC... American? 10:55, 17 April 2007 (UTC)
ABC also stands for American Broadcast Corporation, and is one of the major US networks. You are right about the BBC and CBC.-Czmtzc 11:59, 17 April 2007 (UTC)[reply]
You can't take a joke, can you? —The preceding unsigned comment was added by 129.78.208.4 (talk) 22:49, 17 April 2007 (UTC).[reply]
That was a joke? Black Carrot 03:54, 18 April 2007 (UTC)[reply]
Did you follow the link?

Rolling Standard Deviation[edit]

I am trying to do a small research on stock market volatility. I would be obliged if someone could help me understand "12 month rolling standard deviation" and how to calculate it. Can anyone suggest me a link where I can learn easily how to calculate rolling standard deviation.--202.52.231.226 06:18, 17 April 2007 (UTC)[reply]

I'll assume that by rolling you mean the same as moving in "moving average". The usual estimators m and s for the population standard deviation of a sample X of size N are given by
Omitting the subscripts to the summations, all of which let x range over X, the second sum can be rewritten as:
So the mean and standard deviation may be estimated by
What you need to do to get this rolling – after the first 12 months – is to get these two summations rolling. Define
in which the data values are indexed by the month. Then
 --LambiamTalk 08:26, 17 April 2007 (UTC)[reply]

Generalizing Hoelder's inequality[edit]

Hi, studying for one of those pesky qualifying examinations again. (This time it's in Analysis.) I have a hard time playing with the exponents in order to get full usefulness out of Hoelder's inequality, so I was hoping you can help me with this problem. I have seen generalizations of Hoelder's inequality in the past that use k functions, but the proofs confuse me. Suppose I just want to prove it for 3 functions. (The question is for a general measure space, so we don't use anything particular to Lebesgue measure on the real line.) That is,

Suppose and , with 1/p + 1/q + 1/r = 1. Show that and that

I'm also allowed to use the "regular" Hoelder inequality, so I suppose that I want to show something to the effect of , where , but this is where I'm stuck. Again, I'm not clever enough to play with the exponents properly.

So, if anyone out there can give me some good hints, or tell me exactly what's going on, that would be great. (This isn't homework, this is just regular studying for a qualifying exam.) Hints are greatly appreciated over straight up solutions, but I'm almost dying over here. Thanks in advance! –King Bee (τγ) 16:38, 17 April 2007 (UTC)[reply]

Well, there aren't really so many options. You want to prove when Start with the left hand side and try and fix it so you get some of the terms on the right hand side. E.g. write and try and use regular Hölder to get the term involving h on the rhs. Does that help? Stefán 17:02, 17 April 2007 (UTC)[reply]
Indeed, that's what I want to do. To do so, I need to have , where p' is as described above. Any hints towards getting that done? –King Bee (τγ) 17:19, 17 April 2007 (UTC)[reply]
You now have to attack where . Perhaps it is better to write that as . This suggests using Hölder again but now with and as your powers. Does that look more appealing? Stefán 18:11, 17 April 2007 (UTC)[reply]
I'm with you; that's what I want to do. I suppose in order to pull that off, I need to show that and first (the result would follow soon after). Again, this is precisely where my issue lies. I simply cannot figure out how to play with the exponents in any meaningful way. Let me show you the types of things that I'm playing with, and you can tell me where I'm going wrong, or try to direct me toward something I'm missing.
...and I'm pretty much at a loss at that point. Do I want and instead? Thanks for your patience and your help so far. –King Bee (τγ) 20:35, 17 April 2007 (UTC)[reply]
The integral you are working with is . This is an integral of a product of two things, and . What happens if you use Hölder on the integral of this product with exponents and ? If you prefer to write it using norms, I am suggesting the following: . Stefán 21:03, 17 April 2007 (UTC)[reply]
Ahh! So, and ! I think this is making more sense. Let me get a coffee and then get back to you. –King Bee (τγ) 12:23, 18 April 2007 (UTC)[reply]
  • (resetting indent) Here's the argument, as I see it. Let r' be as above and first note that since as . Similarly, . Next, since we can use the standard Hölder to note that (so ) and that . Taking the th root of both sides, we achive . Abusing Hölder again, this time with r' and r, and and , we note that , so and
, as desired. Commentary. I don't see any holes here, do you? This is great! Stefán, you lovable scamp, I could kiss you! It wasn't playing with exponents that was my problem, it was realizing which functions lived in which L space. Beautiful!–King Bee (τγ) 13:41, 18 April 2007 (UTC)[reply]
Nope, there are no holes in this. Good job, it was my pleasure to help. Stefán 15:33, 18 April 2007 (UTC)[reply]
Our article Hölder's inequality contains a proof that, it appears to me, is readily extended to this generalization.  --LambiamTalk 07:32, 18 April 2007 (UTC)[reply]
I know. Should you really have to use Young's inequality to prove Hölder? I'm looking for a different proof. –King Bee (τγ) 12:23, 18 April 2007 (UTC)[reply]