Wikipedia:Reference desk/Archives/Mathematics/2012 December 30
Mathematics desk | ||
---|---|---|
< December 29 | << Nov | December | Jan >> | December 31 > |
Welcome to the Wikipedia Mathematics Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
December 30
[edit]Confirm an Answer
[edit]Hi all. Just did a question and I'd appreciate it if someone could tell me if I'm correct.
I need to find all solutions to the simultaneous equations
I find the solution set to be given by
provided that
and either
or
and no solutions otherwise, where m and n are real numbers.
Is this correct? Thanks. meromorphic [talk to me] 14:18, 30 December 2012 (UTC)
- No. If you have two equations in three variables, the solution will be a one-dimensional curve. Your expression gives a two-dimensional surface. Looie496 (talk) 16:01, 30 December 2012 (UTC)
- OK, how about instead, I talk through the process I used to solve it and someone tell me where I went wrong?
- We set the two equations equal to one another and move everything to the LHS, giving
- We then say
- and
- The first of these two equations can be solved immediately and gives us a condition on m. The second can be treated as an equation in y and so we may, again, use the quadratic formula to solve this.
- We will then have y in terms of z, and we may use the discriminant of this to give us a condition on z in terms of m, which, yet again, we will find solutions to using the quadratic formula and which will give us another condition on m.
- We can then let z be equal to some real number, say n, and then give the solution in terms of n and m, along with the appropriate conditions.
- Where did I go wrong? Thanks. meromorphic [talk to me] 16:19, 30 December 2012 (UTC)
- (edit conflict) You should solve the linear equation for one of the variables, say z, in terms of the others, then substitute that expression for z into the other equation, obtaining an equation that is quadratic in terms of x and y. Then solve for x in terms of y and plug back into the provisional solution of the linear equation, to get z in terms of y. Then the solution for x, y, z is in terms of y (one-dimensional as Looie points out), and you can figure out what the range restrictions on y are. Duoduoduo (talk) 16:27, 30 December 2012 (UTC)
- To the extent that I understand your attempt, here's where I think it went wrong. After you equated sides of the original equations, I think you henceforth proceeded as if your resulting equation was the only equation that you had to satisfy. But really there were still two equations: they could be viewed as your new equation plus one of the original equations, or as your new equation plus the other original equation. Duoduoduo (talk) 16:35, 30 December 2012 (UTC)
- (edit conflict) You should solve the linear equation for one of the variables, say z, in terms of the others, then substitute that expression for z into the other equation, obtaining an equation that is quadratic in terms of x and y. Then solve for x in terms of y and plug back into the provisional solution of the linear equation, to get z in terms of y. Then the solution for x, y, z is in terms of y (one-dimensional as Looie points out), and you can figure out what the range restrictions on y are. Duoduoduo (talk) 16:27, 30 December 2012 (UTC)
The problem symmetrical in x and y, so if you know the sum S=x+y and the product P=xy then you can find x and y by solving the quadratic equation x2-Sx+P=0. Following Duoduoduo's fine advice of eliminating z you end up with the equation P=12S-78. Bo Jacoby (talk) 05:17, 31 December 2012 (UTC).
Calculating an ellipse after rotating a circle
[edit]I'm doing some graphic design wherein I am rotating rings. Say that I have a circle of radius 1 residing in the plane described by . There are three ways that I can rotate it around the origin: around the x-axis, around the y-axis, and around the z-axis. The degrees of rotation for each will respectively be , , and in degrees. From these, how can I calculate the transformed/rotated circle's appearance's parameters described by the implicit elliptical equation? --— Melab±1 ☎
- You haven't stated the orientation in which you're looking at it. Are we viewing the XY plane straight on, with the Z axis coming out of the screen ? If so, a rotation of a circle in the XY plane centered at (0,0), around Z won't be visible. StuRat (talk) 21:56, 30 December 2012 (UTC)
- Yes, the z-axis is coming out of the screen and the xy-plane is being viewed head on. Isn't the same thing? --— Melab±1 ☎ 01:14, 31 December 2012 (UTC)
- Well, Z = 0 is the XY plane, but that doesn't describe how we are viewing the XY plane. StuRat (talk) 01:50, 31 December 2012 (UTC)
- OK, assuming this is an orthographic view (not perspective) of the XY plane, when rotating a circle centered at the origin:
- 1) About the x-axis alone, the x-width won't change. The y-width will vary according to the cosine of the angle of rotation.
- 2) About the y-axis alone, the y-width won't change. The x-width will vary according to the cosine of the angle of rotation.
- 3) About the z-axis alone, there will be no change in either the x-width or y-width.
- 4) About some combo of the 3 axes: I'd think you'd determine and combine the x-width and y-width, as above, then rotate the resulting ellipse by the angle of rotation about the z-axis. However, that would mean a rotation of 90 degrees about the x-axis and 90 about the y-axis would result in a point display, and that's not right, so there must be more to it. The problem is that rotation about the 3 axes isn't independent, making it considerably more complex. StuRat (talk) 01:59, 31 December 2012 (UTC)
- Yes, it is orthographic. --— Melab±1 ☎ 21:10, 31 December 2012 (UTC)
- And do you intend to rotate about all 3 axes simultaneously ? StuRat (talk) 21:12, 31 December 2012 (UTC)
- Stu, I think it would be a worthwhile addition to the article ellipse to express the eccentricity of the ellipse resulting from your point (1) above ("About the x-axis alone, the x-width won't change. The y-width will vary according to the cosine of the angle of rotation" as a function of the angle of rotation. Do you know (and have a reference for) that formula? Duoduoduo (talk) 22:33, 31 December 2012 (UTC)
- No, just went off my memory, but I imagine it can be proven geometrically (just draw a side view of the circle at rotation A, with a triangle drawn in):
Z ^ + | /| | / | |/A | X---+--> Y /|<->|<------Projection on XY plane: Semi-minor axis of ellipse is of length Rcos(A). / / <---- Circle of radius R rotated about X-axis by angle A.
- I might rotate about all three axes depending on specific instances. Adobe Illustrator's "Extrude and Bevel" function works like that. Melab±1 ☎ 21:25, 1 January 2013 (UTC)
- I'm sure it's possible to come up with an equation that can model any rotation of a circle and projection onto a plane as as ellipse, but it's probably quite a complex formula, as rotations about the 3 axes are not completely independent. What I would do instead, is first create some finite number of points along the original circle, then rotate each point about each of the 3 axes, in turn, since this is far simpler mathematically. If you use enough points, the result should be visually indistinguishable from an ellipse. Also note that the order in which you rotate the points about each axis might produce a different result.
- You might also consider using spherical coordinates, as this will make the rotations far simpler, although you'll need to convert back to Cartesian/rectangular (X,Y,Z) coords to display it (unless you happen to have access to functions which display points in spherical coords, and then they do that conversion for you). See Spherical_coordinates#Cartesian_coordinates for the conversion math.
- If you'd like, I can write some code using either of these two approaches (it would be Fortran, but I'm sure you can rewrite it in whatever language you'd prefer). StuRat (talk) 04:30, 2 January 2013 (UTC)
Bayesian induction
[edit]Hi, Suppose you have biased dice of unknown probabilities with n sides. Suppose you have rolled the dice several times, and you assume some prior on the probabilities such as the Dirichlet distribution. How do you calculate the new probabilities associated with each side of the dice?--AnalysisAlgebra (talk) 23:29, 30 December 2012 (UTC)
- I'm not quite following. At some point, you will be reasonably sure that the distribution you assumed is either correct or wrong, in which case the distribution will simply be the number of times each number hit divided by the total number of rolls. Are you asking about when we can reasonably determine that the assumed distribution is correct or incorrect ? StuRat (talk) 01:48, 31 December 2012 (UTC)
- See Bayesian inference. It's not all or nothing, you start with a prior distribution and as new data arrives you update it to obtain a posterior distribution. -- Meni Rosenfeld (talk) 05:43, 31 December 2012 (UTC)
- The number of outcomes for each side is added to the parameter of the prior Dirichlet distribution in order to obtain the parameter of the posterior Dirichlet distribution. Bo Jacoby (talk) 05:00, 31 December 2012 (UTC).
- The Dirichlet distribution is a conjugate prior for the multinomial distribution (a generalization of the beta distribution which is a conjugate prior for the binomial distribution, good for coins). Which means that if your prior is Dirichlet, your posterior will be Dirichlet too, which is convenient. In this case, the Dirichlet distribution has parameters indicating the "effective" number of rolls which resulted in each value. When you observe a roll you simply add 1 to the parameter corresponding to the result.
- But there's no law saying your prior must be Dirichlet. In most generality, you simply apply Bayes' law - if the prior distribution for the probability vector is P, then your posterior after observing the result is
- .
- Note that there is some subtlety with respect to the exclusion of a multinomial coefficient; you didn't observe just the number of times each result came up, you observed the actual sequence of results. But you summarize the relevant information with the vector of counts. -- Meni Rosenfeld (talk) 05:43, 31 December 2012 (UTC)
- The PDF may not be very enlightening. What you need is an estimate for the unknown probability vector, that is: the mean value ± the standard deviation of the relevant Dirichlet distribution. The mean value is not simply the number of times each number hit divided by the total number of rolls. It is (the number of times each number hit plus one) divided by (the total number of rolls plus the number of sides). The Dirichlet distribution is a limiting case for the induction distribution, see Talk:Statistical inference#deduction and induction and prediction. Bo Jacoby (talk) 11:11, 31 December 2012 (UTC).
- That's assuming the prior is uniform. If the prior is arbitrary Dirichlet with parameters , the posterior mean for is (which reduces to uniform for ).
- And more generally, the posterior mean is whatever the mean is for the posterior distribution as calculated above. -- Meni Rosenfeld (talk) 14:01, 31 December 2012 (UTC)
- Meni, we have had this discussion before. The maximum entropy prior distribution should be assumed unless there is a reason why some outcome should be less credible than another. Happy new year! Bo Jacoby (talk) 16:37, 31 December 2012 (UTC).
- Yes, we have, many, many times. The uniform prior simply isn't suitable for a real die, where we have the knowledge that physical, ostensibly symmetric dice tend to have roughly equal probabilities for the results (as opposed to uniform distribution which has much higher variance). And of course, in the general case we may have additional knowledge about the die - the OP didn't specify that he has no such knowledge.
- In the simpler coin case, a uniform prior means that among all coins that we encounter, 10% of them are loaded such that the probability for heads is higher than 90%. This is wrong.
- Happy new year. -- Meni Rosenfeld (talk) 19:36, 31 December 2012 (UTC)
- The OP did say the die was biased, but yes biasing it 90% to one number and going in for money would get them caught and beaten up in no time flat. Sometimes some of the constraints aren't easily measurable and yet should still be included so one does have to apply a bit of finger in the air rather than discarding one's common sense in applying maximum entropy. Dmcq (talk) 11:05, 1 January 2013 (UTC)
- When the OP says: "Suppose you have biased dice of unknown probabilities" we cannot rely on our general knowledge that dice are not biased. The Dirichlet distribution for alpha=(1,1,1,1,1,1) does not mean that 10% of the dice are loaded such that the probability for one outcome is higher than 90%. Not assuming the maximum entropy prior distribution leads to computational complications but not to better results. It is not helpful. Bo Jacoby (talk) 12:20, 1 January 2013 (UTC).
- I have clearly specified that the 10%/90% example was for the simpler case of the coin. Since we disagree on something so fundamental, there's no point obfuscating it by sticking to the much more complicated case of a die with multiple results.
- For a coin, this is exactly what it means - that among the coins that we use this prior for, we expect 10% of them to have >90% probability of heads.
- In this case the OP specified he somehow knows the die/coin is biased. What if you're just given a coin and don't know if it's biased or not? Will you still use the uniform prior?
- As Dmcq points out (which I thought to mention explicitly but passed since it's too obvious), even coins which are purposefully biased aren't likely to diverge significantly from 50%/50%, to avoid suspicion. And someone with actual domain knowledge on biased coins will be capable of specifying a much more accurate prior.
- The calculations for beta/Dirichlet are simple even if we assume a prior from this family which is not uniform. Since these are fairly general, you can to a good approximation encode your prior as a distribution from these families. In any case, approximating for the cause of simpler calculations is sensible, but using something which isn't near reality isn't.
- Can you put your money where your math is? Let's say we hang out, and the first time we encounter a coin, we take it, and toss if 5 times. If it's 5 heads you win, otherwise I win. I say your probability of winning is close to 1/32 because the probabilities are likely to be close to 50%/50%, you say it's 1/6 because the probabilities are uniform. Will you take a bet at 14:1 odds (you get x14 as much for winning as me)? I would. -- Meni Rosenfeld (talk) 16:30, 1 January 2013 (UTC)
Tossing a fair coin 5 times is like sampling 5 beads from an urn with many white and equally many black beads. Estimate 2.50±1.12 white beads and 2.50±1.12 black beads using these formulas.
5000 5000 deduce 5 NB. tossing a fair coin 5 times 2.5 2.5 1.11781 1.11781
Tossing an unfair coin 5 times is like estimating the number of white and black beads in an urn containing 5 beads.
0 0 predict 5 NB. tossing an unfair coin 5 times 2.5 2.5 1.70783 1.70783
Estimation is 2.50±1.71 white and 2.50±1.71 black beads.
If the 6 possibilities (0 1 2 3 4 5 white beads) are not equally likely, then we do have some prior knowledge that some possibilities are less likely than others. So, assuming that we have been given no prior knowledge regarding how many of the 5 beads are white, then the 6 possibilities are a priori equally likely. When beads are picked one by one the bayesian estimate becomes increasingly precise.
0 0 predict 1 0.5 0.5 0.5 0.5 1 0 predict 1 0.666667 0.333333 0.471405 0.471405 2 0 predict 1 0.75 0.25 0.433013 0.433013 3 0 predict 1 0.8 0.2 0.4 0.4 4 0 predict 1 0.833333 0.166667 0.372678 0.372678
The dirichlet (or beta) distributions of probabilities for dice (or coins) are limiting cases of predicting the colors of beads in the urn.
dirichlet=: 10000%~ predict&10000 NB. 10000 is some big number dirichlet 0 0 NB. prior estimate of coin probabilities 0.5 0.5 0.288704 0.288704 dirichlet 0 0 0 0 0 0 NB. prior estimate of die probabilities 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 0.140901 0.140901 0.140901 0.140901 0.140901 0.140901 dirichlet 5 0 NB. posterior estimate of coin probabilities 0.857143 0.142857 0.123761 0.123761 dirichlet 0 3 4 0 7 2 NB. posterior estimate of die probabilities 0.0454545 0.181818 0.227273 0.0454545 0.363636 0.136364 0.0434811 0.0805113 0.0874782 0.0434811 0.100415 0.0716355
This answers the OP's question. Bo Jacoby (talk) 07:15, 2 January 2013 (UTC).
- Again, you are assuming we know less than we actually do, and if done in practice this will lead to bad results.
- You're falling into the same trap as the frequentist in this xkcd comic. "Sun going nova" and "sun not going nova" do not have a priori equal probabilities because we have knowledge that the sun going nova isn't likely in the foreseeable future. Likewise, we have some knowledge about the behavior of coins/dice which means that the density isn't uniform over all probability vectors. -- Meni Rosenfeld (talk) 20:00, 2 January 2013 (UTC)
Thank you for your interest. You may have some knowledge about the behavior of coins/dice due to divine revelation, but I don't. As a scientist I rely on observation. I was only told that there were n sides on the die, and that I could not rely on it being fair. I cannot a priori rule out any possibility. If I throw the n=6 - die 10 times, and it shows 6 dots every time, then I estimate the probability vector (6, 6, 6, 6, 6, 70) ± (6, 6, 6, 6, 6, 11) per cent.
dirichlet 0 0 0 0 0 10 NB. estimate of probability vector 0.0625 0.0625 0.0625 0.0625 0.0625 0.6875 0.0587555 0.0587555 0.0587555 0.0587555 0.0587555 0.112508
Is this a bad result? What is your result?
The probability that the sun went nova tonight, considering that it didn't go nova in a billion nights, is 1 ppb, give or take 32 ppm.
0 1e9 predict 1 1e_9 1 3.16228e_5 3.16228e_5
Bo Jacoby (talk) 08:50, 3 January 2013 (UTC).
- I haven't seen the die, so I don't have a result. You're talking about solving an abstract die problem, I'm talking about generalizing the process of solving a problem with an actual die. (That's one part of the answer, the second part is that I could formulate my prior for all dice, which I would use for a die about which I know nothing other than that it is a die, and figure out the posterior after some rolls, but I'm too lazy for this).
- "Bad" is relative, the exact measure of badness will depend on the problem.
- I think the process you use to decide which information to take into account (as in the nova case) is arbitrary. -- Meni Rosenfeld (talk) 22:07, 5 January 2013 (UTC)