Wikipedia:Reference desk/Archives/Mathematics/2009 May 9

= May 9 =

Gradient of linear graph
given that a and b are negative, find the gradient of the straight line intersecting the graph of y=x^3+4x at (1,a) and (b,0). —Preceding unsigned comment added by Invisiblebug590 (talk • contribs) 02:37, 9 May 2009 (UTC)
 * The point intersecting the graph of y=x^3+4x with the line x=1 is at (1,a)=(1,5). a=5 is not negative. The point intersecting the graph of y=x^3+4x with the line y=0 is at (b,0)=(0,0). b=0 is not negative either. The gradient, meaning the slope, of the straight line is 5. Bo Jacoby (talk) 07:56, 9 May 2009 (UTC).
 * Will you rephrase the question in more detail? (your question is clear enough but stated this way looks to much like homework, which is a major taboo for people here, me included. General hint: state your question so as to show more understanding and more personal interest about it. Or wait for somebody who is above the taboo!). --pma (talk) 08:05, 9 May 2009 (UTC)


 * Go to here and type y=x^3+4x; into the function box. setting x from -3 to 3 and y from -10 to 10 works well.  Notice that there is only one point on the function where x=1 and only one point where y=0.  now on a second line type y=5x;.  See that this second line interests the first function at those two points.  Also a, and b are not negative. Jon513 (talk) 14:23, 10 May 2009 (UTC)

okay, is THIS confidence?
I buy a die that is supposed to favor 6's: so I roll it ten times and get eight 6's.

After getting this result I now want to know how confident I am that it's not just a normal die. So I try a simulation of ten rolls of a normal die, and run this a million times, finding that in 28 of them this happened naturally.

subtracting the twenty-eight, i get... 999972 / 1000000 = 99.9972% of the cases this did not happen.

So do I now have 99.99% confidence that the dice are not normal dice?

Or am I still misusing the word confidence... 79.122.54.77 (talk) 09:53, 9 May 2009 (UTC)


 * p.s. please don't mention prior probability or I swear I'll jump out the window! just ignore it, please please please.


 * Yes. With a fair die you would only expect to see 8 or more sixes from 10 throws about 1 time in 51,000, or about 20 times in a million tries. So you can be 99.99% confident that your die is not fair. Gandalf61 (talk) 10:47, 9 May 2009 (UTC)


 * Yes, but you didn't need to roll the normal die since, by definition, a normal die gets a 6 1/6 of the time, so you already know the probability. You only need to run a control test when you don't know the probability in advance. --Tango (talk) 13:17, 9 May 2009 (UTC)


 * Now you've gotten at the essence of the problem. The real reason for the million rolls is that the behavior the dice are supposed to have are much more complicated than a simple percentage favoring of one number, and so the chances of this happening randomly are hard for me to calculate!  But my suspicion is that this complicated "behavior" is one that normal dice would follow just as well as the "loaded" dice will....  So my proposed methodology is to write down the rules that are "supposed" to be followed over n throws, then see what happens in a million runs of n throws of a normal die (via simulation) and then say, if 98% of them don't follow that rule, and the test dice, once I actually throw them n times, do follow the rule, then they are "loaded"!  Is this methodology a correct one?  I'll leave it up to your imagination what kinds of complicated behavior the loaded dice are supposed to have... 94.27.136.54 (talk) 15:51, 9 May 2009 (UTC)
 * An fair die has very simple behaviour - each roll is independent of all the others and has an equal chance of landing on each number. You can calculate the odds of any particular combination of events pretty easily, there is no need to actually roll the a die. --Tango (talk) 15:59, 9 May 2009 (UTC)

Knowing the probability, $$\scriptstyle P$$, that tossing the die shows a 6, you can compute the distribution of the number, $$\scriptstyle i$$, of 6's you get when tossing the die  $$\scriptstyle n$$ times. It is the binomial distribution. The formula for the mean value ± the standard deviation of $$\scriptstyle i$$ is
 * $$i\approx n\cdot P \pm \sqrt{n\cdot P\cdot(1-P)}$$.

This is deduction. This is not the situation you are considering.

Knowing $$\scriptstyle i$$ and $$\scriptstyle n$$ you can compute the likelihood that $$\scriptstyle p<P<p+dp$$. It is the beta distribution. The formula for the mean value ± the standard deviation of $$\scriptstyle P$$ is
 * $$P\approx \frac{i+1}{n+2} \pm \sqrt{\frac{1}{n+3}\cdot\frac{i+1}{n+2}\cdot\left(1-\frac{i+1}{n+2}\right)}$$.

This is induction. This is the situation you are considering.

When $$\scriptstyle i=8$$ and $$\scriptstyle n=10$$  you get
 * $$P\approx \frac 9{12}\pm\sqrt{\frac{1}{13}\cdot\frac{9}{12}\cdot\frac{3}{12}}=0.75\pm 0.12 .$$

The value P = 1/6 = 0.17 of a fair die is (0.75-0.17)/0.12 = 4.8 standard deviations away from the mean value. That gives better that 99.999% confidence. (See normal distribution, which is a reasonable approximation to the beta distribution in this case). Bo Jacoby (talk) 20:31, 9 May 2009 (UTC). (Last section corrected Bo Jacoby (talk) 06:15, 10 May 2009 (UTC))

$$\scriptstyle n=i=0$$ gives the prior estimate
 * $$P\approx \frac 1{2}\pm\sqrt{\frac{1}{3}\cdot\frac{1}{2}\cdot\frac{1}{2}}=0.50\pm 0.29 .$$

so jump out the window! Bo Jacoby (talk) 06:40, 10 May 2009 (UTC).


 * But does that prior make sense? It doesn't seem to. You wouldn't bet me even money that a given die would turn up a six on the next roll if you hadn't tested it first. If the die had 100 sides that formula would still give you P = 0.50 ± 0.29 for rolling a 100, or for rolling a 37.


 * Judging from an earlier thread I think the original poster's self-defenestration threat is now void, so let me talk more about prior probability. Despite the name, you don't have to pick a prior probability prior to doing your calculation. Bayes' theorem says
 * $$P(\text{fair} | i \text{ sixes out of } n) = 1 \Big/ \bigg( 1 + \frac{P(i \text{ sixes out of } n | \text{loaded})}{P(i \text{ sixes out of } n | \text{fair})} \frac{P(\text{loaded})}{P(\text{fair})} \bigg)$$
 * where P(A|B) means "the probability of A given B". P(i sixes out of n | fair) is $$(\tfrac16)^i (\tfrac56)^{n-i} \tbinom{n}{i}$$. It's harder to give a value for P(i sixes out of n | loaded) because we don't necessarily know what kinds of loaded dice there are in the world, and it's hard to decide on a value for P(fair), i.e. how likely we think it is we have a fair die in the first place. (Note P(loaded) = 1 − P(fair).) But that's okay, because most choices don't affect the probability much. 1/(1+x) is roughly 0 if x >> 1 and roughly 1 if x ≈ 0, so you will be reasonably certain that the die is loaded if
 * $$\frac{P(\text{fair})}{P(\text{loaded})} \ll \frac{P(i \text{ sixes out of } n | \text{loaded})}{P(i \text{ sixes out of } n | \text{fair})}$$
 * and reasonably certain that it's fair if it's >> instead. As an example, pretend that all unfair dice in the world have a 50–50 chance of rolling a six; then with i=8 and n=10 the right hand side of that inequality is about 2400. So, unless you started out more than 99% confident the die is fair, those ten rolls are going to leave you more than 96% confident that it's loaded. A more complex model of unfair dice would be better, but the only important thing is that you get large ratios on the right hand side—in other words, that your two theories (fair and loaded) make substantially different predictions for the experiment. The more trials you perform the more the fair and loaded predictions will be different, so the less your prior will matter. A strong enough prior can always dominate (for example, if you'd previously thrown the die 1000 times, the last 10 don't matter so much), but any given prior will eventually become irrelevant as n increases. All of that makes sense. The beta distribution, on the other hand, doesn't make sense to me because it invents a prior out of nowhere, and the prior is always 1/2, which isn't generally what people would choose for, say, the chance of rolling a six. Not that it matters after you've done enough trials, but still. -- BenRG (talk) 14:19, 11 May 2009 (UTC)

Assuming that there is no a priori clue as to if the die is fair or heavily loaded, then there are two outcomes: 6, and not 6. The knowledge that there are 6 (or 100) outcomes only modifies the prior likelihood function if we do assume some fairness, which we don't. So the prior likelihood that the probability, P, is in the interval p<P<p+dp is L(p)&middot;dp = 1&middot;dp for 0 < p < 1 and L(p)&middot;dp = 0 elsewhere. This uniform beta distribution has mean value equal to 0.50 and standard deviation equal to 0.29, reflecting the fact that all we know about the value of P is that 0 ≤ P ≤ 1. We do not assume that P = 0.50. We do not assume anything about P except that 0 ≤ P ≤ 1 because we have no reason to make any prior assumption. Now let's roll the die once and let it show 6. Then n = i = 1 and P ≈ 0.67 ± 0.24. We got a tiny bit of information regarding P. The fair value of P, which is 0.17, is 2 standard deviations below the mean. That is not highly significant. If the second roll also show 6 we get n = i = 2 and P ≈ 0.75 ± 0.19. The fair value of P is now (75-17)/19 = 3 standard deviations below the mean. We suspect the die to be loaded. If the third roll also show 6 we get n = i = 3 and P ≈ 0.80 ± 0.16. The fair value of P is now (80-17)/16 = 3.9 standard deviations below the mean.

If you have reasons to assume that the die is fair, perhaps because you have tossed it before, then you have another prior likelihood function. You may have tossed it 10 times and obtained the six outcome 2 times. Then your 'prior' situation is n = 10, i = 2 and P ≈ 0.25 ± 0.12, and your 'posterior' situation is   n = 13, i = 5 and P ≈ 0.40 ± 0.12. In that case the fair value of P is (40-17)/12 = 1.9 standard deviations below the mean and there is no reason to assume that the die is loaded. Bo Jacoby (talk) 16:45, 11 May 2009 (UTC).


 * You don't need to have tossed it previously to have a prior probability in favour of it being fair - just looking at it and seeing that it has 6 sides which all look the same would suggest the chance of getting a 6 is about 1/6 (unless you have a reason to believe any particular number if more likely than any other, you should assume otherwise). It is only when you don't even know what a die is that you would set the prior probability as 50/50 in favour of getting a six. --Tango (talk) 16:53, 11 May 2009 (UTC)

The OP wrote: "I buy a die that is supposed to favor 6's". So there is no prior information favouring fairness. And then: "so I roll it ten times and get eight 6's." So he wants to investigate the behavior of the die without making prior assumptions. Note that I do not 'set the prior probability as 50/50 in favour of getting a six'. This is a misunderstanding. I do not know the prior probability for getting a six, and so I allow it to assume any value between 0 and 1 with uniform likelihood. The posterior probability assumes values between 0 and 1 with non-uniform likelihood. Bo Jacoby (talk) 17:05, 11 May 2009 (UTC).

Logistic equation vs logistic map
Hi there - I was wondering where the difference arises in the behaviour or the logistic map and the logistic equation - in the discrete case of the difference equation, we get instability and periodic oscillation of order 2,4,etc... for r>3, but there is no such counterpart in the differential equation - the point '0' remains unstable in both cases, but the other equilibrium point is always stable for the differential equation - why is this? Where does the difference occur?

Thanks, Otherlobby17 (talk) 14:37, 9 May 2009 (UTC)


 * Well, let me first try to elude your question with another one: why should they be the same? Discrete and continuous dynamical systems have similar theories, but certainly not the same. Let us consider the most simple case: xn+1=axn versus x'=ax: a simple characterization of stability (in various senses) is available in both cases, but of course it does not give the same condition in terms of a.--pma (talk) 19:24, 9 May 2009 (UTC)


 * A fair point, but with the discrete difference equation we're talking about considering xn across some small finite time interval 'dt' say - why is it that the instability vanishes in the limit as dt -> 0? Naturally I'm not saying they certainly -should- be the same, because clearly limiting processes will often screw things up, '1/x' being strictly positive an obvious example. Rather, what I'm saying is, is there an explicit justification which can be given for the disappearance of the instability? Regardless of how differently things may behave when taking a limit, there can usually be given some level of justification for why they are different: is there no such sensible justification with the logistic map? Chaotic or not, it doesn't seem a complicated enough system that the reason for this would be so inexplicable, but I can't think of how to justify it myself. Otherlobby17 (talk) 21:11, 9 May 2009 (UTC)


 * Let's linearize f(x)=rx(1-x) in the equilibrium points, both for the continuous and for the discrete system (here r is a real positive parameter). The differential equation x'=f(x) has equilibria x=0 and x=1, the two zeros of f. We have f'(0)=r>0 and f'(1)=-r<0, so 0 is unstable (asymptotically in Lyapunov sense) and 1 is stable, as you said. The iteration xn+1=f(xn) has equilibria x=0 and x=1-1/r, the two fixed points of f. We have f'(1-1/r)=2-r , so (leaving alone the limit cases of the parameter, that may require more a delicate analysis) 0 is stable if r<1 and unstable if r>1, while 1-1/r is stable if 1<r<3, and unstable if r<1 or if 3<r. RMK: In both cases, of course, what allows the comparison with the linearized system is the Hartman-Grobman theorem theorem for discrete and for continuous dynamical systems.
 * I think that you also have in mind to approximate a differential equation x'=f(x) with a discrete difference equation: in this case, the behavior of the approximating discrete systems would be much closer to the continuous system --but the discrete equation would not be xn+1=f(xn). For instance if you consider the discretization corresponding to unit time increments, that is  xn+1=xn + f(xn), you can check that in fact it has more similarity with the ODE (equilibrium points and their stability are the same, for all r>0). --pma (talk) 06:36, 10 May 2009 (UTC)

MLS Matrix transformation
My problem is as follows: I have a collection of vectors Q = {q1,q2,...,qn} and a second collection of corresponding vectors R = {r1,... rm} (same dimensionality). These vectors represent homogenous coordinates. I would now like to find the transformation matrix A, which minimizes ||ri - A * qi||^2 summed over all vector pairs (i = 1 through m). I get the feeling that this is a straightforward problem, analogous to linear least squares in one dimension, but I can't find anything straightforward, dealing with this directly. I'd love to hunker down and delve into the matter, but as always, I don't have a great deal of time.

So my questions are, is there a closed-form solution (or some way to get an approximation without searching), and could you give me a basic walkthrough of a steps required to find a solution, with the terminologyand phrases to help me google the details. If should also mention that this is part of a computer program, rather than say, a proof. Thank you. risk (talk) 18:42, 9 May 2009 (UTC)
 * Does n=m? Algebraist 18:58, 9 May 2009 (UTC)
 * Yes, in fact, I meant to use the same letter on both, sorry about that. So each q has an associated r, and the 'ideal' solution would give Aq = r for all points. risk (talk) 19:12, 9 May 2009 (UTC)
 * I found the following paper on the subject: Least-Squares Estimation of Transformation Parameters Between Two Point Patterns. This certainly provides enough of an answer for me. As for terminology, they call it "...the least-squares problem of the similarity transformation parameter estimation."
 * Thanks to anyone who may have mulled the problem over. risk (talk) 12:46, 10 May 2009 (UTC)