Wikipedia:Reference desk/Archives/Mathematics/2013 March 6

= March 6 =

Gamma ~= 1 / √3
Is there any particular reason for why $$\gamma \approx \frac{1}{\sqrt3}$$, or is it merely a simple coincidence ? — 79.113.237.34 (talk) 00:59, 6 March 2013 (UTC)
 * Probably a coincidence 130.76.64.120 (talk) 01:58, 6 March 2013 (UTC)
 * Follows from Gaussian quadrature approximation of gamma, using two-point quadrature on each of the intervals [n,n+1]. Note that you get the easier approximation of gamma as 1/2 by using the trapezoid approximation instead.  So it's not surprising GQ gives a better (irrational) approximation that is also fairly simple and involves the square root of 3....   Sławomir Biały  (talk) 02:07, 6 March 2013 (UTC)
 * Thanks ! :-) — 79.113.237.34 (talk) 03:52, 6 March 2013 (UTC)

A strange relationship to seeing in art drawing
Talking to my art class about the simple method of using a pencil to "sight" at arm's length, a figure for proportions in order to put it on the page. There must be a formula to explain why this can be done and is a pretty good guide. You hold the pencil out against the subject, say his or her head, and put the thumbnail at that point. You check how many times, say it goes into the body length. Then, closer, on your drawing, you check the headlength in the same way, and divide it into the body length to make corrections. I'm not asking about how the division happens, but how it's translated so simply from a full human figure into the sketch you're making. If this isn't math, please recommend a ref desk that could handle it. Thanks in advance, Manytexts (talk) 02:23, 6 March 2013 (UTC)


 * Yes, it's math/optics. See vanishing point and perspective drawing. StuRat (talk) 02:35, 6 March 2013 (UTC)


 * Ah. Though I went to these articles & almost all the "see also" related ones, I am left no wiser. Too techie for me, Manytexts (talk) 06:20, 6 March 2013 (UTC)


 * Are you a student or the teacher ? If you are a student, you might benefit from learning the basics of perspective.  Try making a picture of a room, using one point perspective.  Here's a video to guide you through it: .  They used a computer, but you can do the same thing with paper, pencil, and a ruler. StuRat (talk) 06:37, 6 March 2013 (UTC)


 * Note that a person standing won't be distorted noticeably in a perspective view (unless the "eye point" is really close). That is, their head is the same size in proportion to their legs, as it is in real life.  This would be different if they were lying down, with either their head or feet near us.  One interesting detail from the world of art, is that Michelangelo's David is actually sculpted with perspective in mind.  That is, the feet are actually proportionally smaller, since the viewer will presumably be closer to those than the head, and the feet would seem huge otherwise. StuRat (talk) 06:56, 6 March 2013 (UTC)


 * I can personally vouch for the above. --   Jack of Oz   [Talk]  08:40, 9 March 2013 (UTC)


 * If I understand the question correctly, the answer is just the fact that things that are proportional to each other remain in the same proportion as they get bigger or smaller. For example, if a painting contains two objects, one of which is twice as large as the other, then those two objects will have the same proportion between them (2:1) in any print of the painting, regardless of the size of the print. The absolute sizes of the two objects may differ (the objects in the painting will be tiny on a postcard and huge on a billboard, for example), but the proportion between them will stay the same.
 * When you realistically paint a scene from real life, your painting may be larger than the real-life scene, or it might be smaller, but your aim is to keep all of the proportions correct. The pencil-measuring technique is simply calculating proportions to ensure that they match the scene. (I don't think it has anything to do with vanishing points or perspective.) —Bkell (talk) 16:54, 6 March 2013 (UTC)


 * That's it! that's the thing I needed put so clearly. I'm the teacher but it's not easy to translate something you take for granted to a group who are learning, to keep it simple & on topic. Thank you so much for the elegant reply. Thanks StuRat for trying. Manytexts (talk) 08:02, 9 March 2013 (UTC) (yes it is resolved)


 * OK, I'll mark it resolved. StuRat (talk) 08:16, 9 March 2013 (UTC)

Calculating RGB values for images
I came across a specific problem I don't know how to solve. I want to create a game using the M.U.G.E.N. engine. For that, I need to create images to later be used as sprites to be used in-game. In order to create those images, I need to first define the colors to be used for those sprites. Those colors are RGB colors representing a palette to be used for those sprites. I can use exactly 256 colors for this palette. I know that I already need three specific colors: (255, 60, 255), (0, 0, 0) and (255, 255, 255). I want the other colors to be equally distributed in my color model. That is, I want to define the remaining 253 colors in a way such that I increment the RGB parameters one-by-one by a constant value. Now my question is, how do I calculate the constant c with which I have increment x, y, z in the RGB triple (x, y, z) such that I come from (0, 0, 0) to (255, 255, 255) in 253 steps? (Note that it doesn't matter for me that I probably don't hit (255, 60, 255) and (255, 255, 255) exactly, as they are already defined). I hope the problem description is understandable, if something is unclear, I will try to clarify. --  Toshio   Yamaguchi  14:03, 6 March 2013 (UTC)

To clarify: the steps would be (0, 0, 0) (0+c, 0, 0) (0, 0+c, 0) (0, 0, 0+c) (0+2c, 0, 0) (0, 0+2c, 0) (0, 0, 0+2c) (0+c, 0+2c, 0) (0+c, 0, 0+2c) (0+c, 0+c, 0) (0+c, 0+c, 0+c) (0+2c, 0, 0+c) (0+2c, 0+c, 0) etc --  Toshio   Yamaguchi  14:26, 6 March 2013 (UTC)


 * First, I'm going to ignore the fact that you've predefined three colors; you'll see why at the end. What you want to do, conceptually, is to define $$\sqrt[3]{256}$$ equally spaced points along each of the three dimensions (the red dimension, the green dimension, and the blue dimension), so that when you take all possible combinations you get $$(\sqrt[3]{256})^3=256$$ colors. Of course, there's a problem here, because $$\sqrt[3]{256}$$ isn't an integer; it's about 6.35. You have a hard limit of 256 colors, so you can't round that number up to 7 (because 73 = 343). So you need to round it down to 6. Now, 6 equally spaced points along a dimension that goes from 0 to 255 should include the 0 point and then 5 more points that end with 255: so these points need to be placed at multiples of 255/5 = 51. So that's the value of c you're looking for.
 * This defines only 63 = 216 colors, which leaves room for 40 other colors of whatever you'd like. You've predefined three colors, but two of those—(0,0,0) and (255,255,255)—are already included in the 216. So add (255,60,255) to the 216 defined by the multiples of c, and then do whatever you like with the remaining 39 colors. (See also Web-safe color.)
 * If you really want to define all 256 colors and have them be "as equally spread out as possible" in the color space, there are several ways to do that, but they won't give you a perfectly spaced out set of colors like you ask for. —Bkell (talk) 16:36, 6 March 2013 (UTC)


 * Agreed, but note that the red, green, and blue increments don't need to be identical. You could use 7 R, 6 G, and 6 B, for example, for 252 total colors.  This would give you (0,0,0), (255,255,255) and (255,51,255).  That last one isn't quite (255,60,255), so you could pick one or the other, depending on whether that exact color is more important, or having the colors around it be evenly spaced.  I wouldn't recommend using both, though, as they would be difficult to distinguish.  If you stick with (255,60,255), then I suggest redistributing the remaining red spacing, as 0, 60, 115, 166, 213, 255.  Also note that evenly spaced numerically doesn't always mean evenly spaced visually.  Unfortunately, this may vary by display device and settings, though, so evenly spacing them numerically is the best we can do. StuRat (talk) 17:27, 6 March 2013 (UTC)


 * If you're going to use differing increments for the three colors, I would suggest adding the "extra" precision to the green channel (so 6 points along each of the red and blue dimensions and 7 points along green). This is because the human eye is more sensitive to green than to red or blue. This same compromise is commonly made with 16-bit color, which often uses 5 bits each for the red and blue components and 6 bits for green. —Bkell (talk) 17:11, 6 March 2013 (UTC)


 * However, that makes the closest color to (255,60,255) become (255,43,255), which is even worse spacing. StuRat (talk) 17:34, 6 March 2013 (UTC)


 * So? Just add in (255,60,255) if you need it. You have four extra colors, after all. —Bkell (talk) 18:17, 6 March 2013 (UTC)


 * Yes, but it won't be evenly spaced from (255,0,255), (255,43,255) and (255,85,255), (255,128,255), ..., which was also a goal. StuRat (talk) 18:34, 6 March 2013 (UTC)


 * No, reread the original question. We are supposing that three colors, including (255,60,255), have already been assigned, and the question asks how to evenly distribute the remaining colors. Quote: "Note that it doesn't matter for me that I probably don't hit (255, 60, 255) and (255, 255, 255) exactly [with the remaining 253 colors], as they are already defined." —Bkell (talk) 19:32, 6 March 2013 (UTC)


 * Yes, evenly distribute the remaining colors around those already assigned. In a worst case scenario, what would be the point in having colors (255,60,255) and (255,61,255) ?  They realize they aren't likely to hit it exactly, but would still presumably like to be close.  StuRat (talk) 20:20, 6 March 2013 (UTC)


 * First, the question asks for an even distribution of 253 colors throughout the color space. It does not condition this distribution on the values of the colors that have already been assigned. It specifically asks for a scheme in which the remaining 253 colors are equally spaced in each of the three dimensions; there is no part of that that takes into account the three predefined colors, and the question specifically says those colors don't matter in the distribution of the remaining 253.
 * Second, why does it matter if you have two colors that are close together? You're going to have 256 colors in your palette anyway, whether you use them all or not. So why not evenly distribute 216 or 252 colors, and then add in the other colors that you've decided you definitely need? Alternatively, you could fix three colors and then, taking those colors into account, use a complicated heuristic or a force-based algorithm or solve a linear program or use a color quantization algorithm or something in an attempt to optimally distribute the other 253 colors throughout the color space, but that isn't what the original question asks for. That's why I said, "If you really want to define all 256 colors and have them be 'as equally spread out as possible' in the color space, there are several ways to do that, but they won't give you a perfectly spaced out set of colors like you ask for." —Bkell (talk) 20:31, 6 March 2013 (UTC)


 * Well, we disagree on what the OP wants, so we need them to clarify it for us. StuRat (talk) 20:54, 6 March 2013 (UTC)


 * Wow, first of all, thanks for the lot of input. Yes, as Bkell notes, the distribution of the 253 colors is in no way dependent on the three colors already defined (as such, those three colors can actually be ignored for this problem, I just mentioned them in order to present the problem exactly). So what I need is a way to calculate c. It isn't a problem if some of the values come close to the predefined ones, as in this case I can just change them to any arbitrary value that might be useful. But the others should follow the desired distribution, in order to give a harmonic and broad pool of colors. Also it might as well be that some of the colors will be changed from the colors following the distribution if necessary, but I need a rich and harmonic starting point. I think that if I just choose the colors by feeling or something I might get an inbalanced pool of colors which might be very hard to fix later. --  Toshio   Yamaguchi  21:36, 6 March 2013 (UTC)


 * OK, Bkell has your answer then, at 6 possible values for each of red, green, and blue, which makes the value of C = 51. This gives values of 0, 51, 102, 153, 204, and 255 for each color.  Or, if C can be different for the different colors, leave it at 51 for red and blue, and set it to 42.5 for green (remembering to round off the actual values), which gives you 7 possible values: 0, 42, 85, 127, 170, 212, 255.  You get a total of 216 + 3, or 219 colors in the first scheme, and 252 + 3, or 255 colors, under the second scheme.  Can we mark this Q resolved ? StuRat (talk) 22:09, 6 March 2013 (UTC)


 * Yes, this can be marked as resolved. Thanks. --  Toshio   Yamaguchi  23:04, 6 March 2013 (UTC)


 * Will do. Can I ask whether you intend to use the (6,6,6) scheme or (6,7,6) ? StuRat (talk) 23:09, 6 March 2013 (UTC)


 * I think I will use the (6, 6, 6) scheme and adjust that later as necessary. The colors resulting from this might not be the colors I will need exactly, but it provides me with a spectrum I can fiddle with later and I think will be much easier than defining all values from scratch. To give a bit more information, I plan to make a clone of a computer game using the M.U.G.E.N. engine and I need a basic palette for the game sprites. --  Toshio   Yamaguchi  23:26, 6 March 2013 (UTC)


 * One could treat this as a packing problem in a cuboid (whose green edge is longer than its blue edge). —Tamfang (talk) 00:37, 20 December 2013 (UTC)

Errors in measurments and estimations
Hello, I am interested in some biological quantity (let's say the height of penguins). I can measure several independent values (different penguins) $$m_i$$. However, my measurments are imperfect. Each one has its own error (variance) $$e_i$$. This can also be seen as the unknown value $$v_i$$ being drawn from a known distribution $$N(m_i, e_i)$$. Methods described in Weighted_mean can now help me to estimate the distribution of my values $$v_i$$ (distribution of heights among my penguin population) with mean $$M$$ and variance $$V$$.

My question is how exact is this estimate? Ideally I would want a 2x2 covariance matrix on $$M,V$$. I cannot imagine to be the first one with this problem, but I did not find a solution. Do you now a solution or some more search terms?

many thanks, -- 95.208.114.213 (talk) 17:07, 6 March 2013 (UTC)


 * My first thought is to do a parallel weighted mean, using the same weights for each data point, but instead of using the actual data (penguin heights), use the variance at each point, and apply the same weighting factor to that. This should give an upper-bound for the variance, with the law of large numbers bringing it down from there. StuRat (talk) 18:15, 6 March 2013 (UTC)


 * This is probably not exact enough. As each value is extremely difficult to measure, I only have very few of them (usually less than 5). -- 95.208.114.213 (talk) 16:29, 7 March 2013 (UTC) (OP)


 * In that case, my suggestion should be fairly close. It's only with a large numbers of data points that they all "average out", by the law of large numbers.  With 5 or fewer data points, you very well might hit the worst case scenario. StuRat (talk) 03:17, 8 March 2013 (UTC)


 * I generally don't find it useful to think in such abstract terms. Once you figure out what biological question you are trying to answer, it will focus you on the methods appropriate for answering that question. Looie496 (talk) 22:35, 6 March 2013 (UTC)
 * That gives a parsing error for me.-- Gilderien Chat&#124;List of good deeds 22:47, 6 March 2013 (UTC)

Posting here is really slow today
I've been having trouble posting here to the math reference desk for several hours now. I repeatedly get the Wikimedia Foundation error page. I've posted a notice about it at Village pump (technical) if anyone else is experiencing the same thing. —Bkell (talk) 20:14, 6 March 2013 (UTC)


 * Same here, and not just this page. This Q above was posted a dozen times, over a couple hours, because the OP apparently kept getting that error and reposting, even though it really worked.  Most annoyingly, sometimes that error means it failed to make the change, and sometimes it doesn't.  And, if the change was made, it may not show up right away. StuRat (talk) 20:27, 6 March 2013 (UTC)