Wikipedia:Reference desk/Archives/Mathematics/2008 January 13

= January 13 =

Bayes question
I'm trying to classify images appearing in HTML into photographs / non-photographs.

Two possible indicators (among many others) I can use are whether the image tag has an alt attribute and whether the image has a title attribute set.

In my data set I've found that about 90% of photographs have an alt attribute set; and about 60% of non-photographs have an alt attribute set. Also, about 20% of photographs have a title attribute set; and about 5% of non-photographs have a title attribute set.

How can I calculate the probability of an image being either photograph or non-photograph for every possible (true/false) configuration of the two input variables?

I think that this is just Bayesian conversion of Pr(H|D) to Pr(D|H), but I've not found a simple explanation of how to do that with more than one input variable. (And yes, let's assume that the title/alt attribute presences are independent).

--Clairvoyant walrus2 (talk) 00:16, 13 January 2008 (UTC)


 * You will need a prior to do anything Bayesian. In other words you need to know the probability of your images being photos/non-photos in the absence of alt/title evidence. And rather than assuming independence, why not just gather data on the prevalence of each of the four combined possibilities? Algebraist 00:27, 13 January 2008 (UTC)


 * I can get priors easily enough... why not get all 4 possibilities? There aren't really just two input variables, I just described it that way for simplicity, there are actually a couple dozen. --Clairvoyant walrus2 (talk) 02:37, 13 January 2008 (UTC)


 * How'd you end up with the name "Clairvoyant walrus2"? Was "Clairvoyant walrus" already taken? Anyway, the usual Bayesian rule says that $$P(A|B) = \frac{P(B|A) P(A)}{P(B|A) P(A) + P(B|\bar{A}) P(\bar{A})}$$. Substitute $$B = C \wedge D$$ and use independence of $$C$$ and $$D$$ (which means that $$P(C \wedge D|K) = P(C|K) P(D|K)$$) to get $$P(A|C,D) = \frac{P(C|A) P(D|A) P(A)}{P(C|A) P(D|A) P(A) + P(C|\bar{A}) P(D|\bar{A}) P(\bar{A})}$$. Now you can replace $$A$$ with "x is a photo" and $$C$$ with "x (does / does not) have an alt attribute" and $$D$$ with "x (does / does not) have a title attribute". -- BenRG (talk) 08:07, 13 January 2008 (UTC)


 * Reference desk/Archives/Mathematics/2007 December 14 indicates that Clairvoyant walrus is the same as Clairvoyant walrus2. The latter account was created the day after the last edit by the former. Maybe due to a forgotten password? PrimeHunter (talk) 08:38, 13 January 2008 (UTC)

Ok, I see now. Thanks. The answer had been staring me in the face. I implemented it in my application and it works well. --Clairvoyant walrus2 (talk) 04:17, 14 January 2008 (UTC)

Standard deviation and confidiance interfulls
When doing questions for an exam and comparing them with a friend we realise that we had different formulas for standard deviation and thus were getting different answers.

mine was
 * $$\sigma = \sqrt{\frac{\sum_{i=1}^N (x_i - \overline{x})^2}{N} }.$$

where as his was


 * $$\sigma = \sqrt{\frac{\sum_{i=1}^N (x_i - \overline{x})^2}{N-1} }.$$

both of us had found different books showing each, which one is correct. The question was to find the confidence interval. —Preceding unsigned comment added by 136.206.1.17 (talk) 11:10, 13 January 2008 (UTC)
 * The former is the correct way to calculate the standard deviation of a given population. The latter is the unbiased ("best" in some way) way to estimate the standard deviation of a population given only a sample of it. You may need one or the other depending on the circumstances - I don't think "confidence intervals" gives enough context. -- Meni Rosenfeld (talk) 13:12, 13 January 2008 (UTC)
 * Are you sure that the latter is unbiased, Meni? If I understand our article correctly, its square is an unbiased estimator of the variance. However, the formula given needs a slight correction to get an unbiased estimate of the standard deviation. --NorwegianBluetalk 18:34, 13 January 2008 (UTC)
 * You are of course correct. -- Meni Rosenfeld (talk) 18:52, 13 January 2008 (UTC)

Cyclic pentagon
As part of the solution of a newspaper puzzle, I have 10 sets of 5 distinct internal angles of a cyclic pentagon. In each case, the angles could be put into 12 distinguishable sequences of occurrence round the pentagon (e.g. ABCDE, BCDEA, AEDCB are non-distinguishable in the sense of giving the same figure, turning over if necessary). My question is twofold:

1) Can any sequence of 5 positive numbers summing to 540° be drawn as a cyclic pentagon with internal angles in that order, and if so, how? 2) Can it be established without drawing whether or not the centre of the circumscribing circle is inside the pentagon?

For example, one of my sets is (171°,161°,131°,44°,33°). Having to assess 120 pentagons seems wildly excessive for the purposes of the puzzle. 86.152.78.37 (talk) 16:34, 13 January 2008 (UTC)
 * Denoting by O the center of the circle, $$\alpha = \angle COD$$ and so on, you have the following equations:
 * $$\left(\begin{array}{ccccc}1&1&0&0&1\\1&1&1&0&0\\0&1&1&1&0\\0&0&1&1&1\\1&0&0&1&1\end{array}\right)\left(\begin{array}{c}\alpha\\\beta\\\gamma\\\delta\\\epsilon\end{array}\right)=\left(\begin{array}{c}2A\\2B\\2C\\2D\\2E\end{array}\right)$$
 * For which the solution is:
 * $$\left(\begin{array}{c}\alpha\\\beta\\\gamma\\\delta\\\epsilon\end{array}\right)=\frac23\left(\begin{array}{rrrrr}-1&2&-1&-1&2\\2&-1&2&-1&-1\\-1&2&-1&2&-1\\-1&-1&2&-1&2\\2&-1&-1&2&-1\end{array}\right)\left(\begin{array}{c}A\\B\\C\\D\\E\end{array}\right)$$
 * I think a sufficient and necessary condition to being a legal pentagon is that all of those internal angles are positive. Therefore, a solution does not always exist, but you can easily find when it does. Also, once you have calculated the internal angles it is trivial to construct the pentagon. I also think that the centre of the circumscribing circle is inside outside the pentagon iff one of the internal angles is greater than 180°, which is also easy to check. -- Meni Rosenfeld (talk) 18:24, 13 January 2008 (UTC)
 * Assuming my geometry is correct, our silicon masters are more than willing to provide solutions to the problem. For the set you give there is no legal permutation. -- Meni Rosenfeld (talk) 18:32, 13 January 2008 (UTC)


 * Thanks. I understood as soon as I realised that your "internal angles" are at the centre, whereas mine are at the vertices. I think too that you mean that the centre of the circle is outside the pentagon iff one of α etc exceeds 180°.


 * I don't recall coming across anything like this before, but I'd have thought that the condition for a pentagon (and hexagon, ...) to be cyclic would be of interest, as an extension to all triangles being cyclic and quadrilaterals only if opposite angles sum to 180°. 86.152.78.37 (talk) 23:49, 13 January 2008 (UTC)
 * The difference originates from the fact that for an odd number of sides, the system of equations is regular, thus there is always a "solution". However, if the numerical solution includes negatives, it means that the polygon intersects itself. For the triangle, it is so simple it can never intersect itself, so there is always a legal solution. For a pentagon, you still can always find a cyclic one, but it might intersect itself. The condition that it doesn't intersect itself manifests as a bunch of inequalities. For an even number of sides, such as a square, the system is singular, and thus the vertex angles must satisfy some condition (in this case, $$A+C=B+D$$) if you want any sort of solution. -- Meni Rosenfeld (talk) 10:09, 14 January 2008 (UTC)

Proving Limits
Imagine I evaluate following expression$$ \lim_{x\rightarrow 3} \frac{x^3 + 3x^2 - 9x -27}{x^3-9x} $$ and get 2 as its limit. I factored both the numerator and the denominator as much as I could and that's the result I got. What I would like to know is prove it indeed is 2. I suppose I could check with a graphic calculator, but I would like to be able to do it using Heine's method. It needn't be the above expression, that was just an example. Any limit will do it, just in case someone thinks I am here just to have my homework solved for me. That's not the case. Thank you very much in advance. -- Ishikawa Minoru (talk) 17:46, 13 January 2008 (UTC)
 * I have not heard of Heine's method, but L'Hôpital's rule can be useful here.
 * The way to prove a limit depends on what you are allowed to use. If you want to go all the way back to the &delta;-&epsilon; definition, it should go as follows: Let &epsilon;>0. Calculate $$\left|\frac{x^3 + 3x^2 - 9x -27}{x^3-9x}-2\right| = \left|\frac{3-x}x\right| = \frac{|x-3|}{|x|}$$ (valid for $$x \neq 0,3$$). Now you need to find some $$\delta>0$$ such that if $$|x-3|<\delta$$ then $$\frac{|x-3|}{|x|}<\epsilon$$. Can you do it? -- Meni Rosenfeld (talk) 17:58, 13 January 2008 (UTC)
 * It would be a mistake to use L'Hopital's rule in this problem in certain contexts. For one thing, you may be finding limits in order to prove facts about derivatives, and then using derivatives in L'Hopital's rule.  The fact that you get 0 when you plug in x = 3 tells you that (x &minus; 3) is a factor, so you get
 * $$ \lim_{x\to 3} \frac{(x-3)(\text{something})}{(x-3)(\text{something})} $$
 * and just use long division to find the two "somethings". You use the word "prove", which suggests either you don't want only to evaluate the limit, or you don't realize what the correct way of using that word is.   Maybe I'll say more later if you clarify further. Michael Hardy (talk) 00:12, 14 January 2008 (UTC)
 * I find it unlikely that this particular problem is related to the evaluation of a derivative. Again, it all depends on what is allowed to be used, we certainly want to avoid any circularities. That said, I am personally more comfortable with taking derivatives for L'hopital's than with polynomial long division for factoring. -- Meni Rosenfeld (talk) 09:14, 14 January 2008 (UTC)
 * Assuming you're allowed basic properties of limits, factorising is useful:
 * $$\frac{x^3 + 3x^2 - 9x -27}{x^3-9x}=\frac{(x-3)(x^2+6x+9)}{(x-3)(x^2+3x)}=\frac{x^2+6x+9}{x^2+3x}$$
 * Algebraist 18:29, 13 January 2008 (UTC)
 * ...and that equals $$=\frac{x^2+6x+9}{x^2+3x}=\frac{(x+3)^2}{x(x+3)}=\frac{x+3}x=1+\frac 3x$$ CiaPan (talk) 06:32, 16 January 2008 (UTC)

Jiang Chun-Xuan
Can someone at this desk take a look at the above article. It was created by a newbie and needs cleanup but I don't know enough to do it myself. Theresa Knott | The otter sank 18:03, 13 January 2008 (UTC)

MATH QUESTION ON SPECIAL RIGHT TRIANGLES AND HOW TO CALCULATE THEIR AREA'S
Math question on special right triangles and how to calculate their area's Now then, isn't that easier on the eyes? ;-)

Okay, for Geometry we have this problem to do and I completly forgot how to do it. It has something to do with a special right triangle and calculating it's area. I don't wanna know just the answer but how to get to it. The question is a diagram of a 45-45-90 triangle and the 'taller' side is 73. The hypotenuse and base are unlabeled. The right angle is where the 'taller' side and bottom base meet. —Preceding unsigned comment added by 80.148.25.183 (talk) 19:34, 13 January 2008 (UTC)


 * If it's a 45-45-90 triangle, then there's a very specific relationship between the length of one leg and another. What is it? Gscshoyru (talk) 19:37, 13 January 2008 (UTC)


 * Look here if you need more help. hydnjo talk 01:14, 14 January 2008 (UTC)


 * Have you looked at Special_right_triangles ? --YbborTalk 01:43, 14 January 2008 (UTC)


 * Yes, that's much better! hydnjo talk 01:56, 14 January 2008 (UTC)