Wikipedia:Reference desk/Archives/Mathematics/2010 March 21

= March 21 =

Finding the nth term of a sequence given a bunch of terms (statistics question)
Is there a technique which allows you to find the nth term, or an approximation of the nth term, of a sequence, given a bunch of terms, or approximations thereof, in that sequence? The technique must give a good approximation regardless of the function for the nth term (i.e. not linear regression, which is completely unusable for the more complex sequences).

For instance, the first 5 terms of a sequence are 2, 5, 10, 17, 26 - Find the nth term, or an approximation thereof (this is {n2+1} btw).--220.253.247.165 (talk) 06:27, 21 March 2010 (UTC)


 * There can't be any general method to do that, but the OEIS is an online database of a lot of interesting sequences, so you can enter your terms into it and it will tell you what sequences match. Your example is . 66.127.52.47 (talk) 09:14, 21 March 2010 (UTC)


 * (ec) See extrapolation. If you know the terms exactly, and you have reason to believe it's a polynomial sequence, you can use finite difference methods to find a formula. For an introduction to one such method, see Finding a formula for a sequence of numbers. This method won't work if the sequence isn't given by a polynomial, if you don't have enough terms (you need at least one more term than the degree of the polynomial), or if the terms aren't known exactly.
 * Of course you should recognize that any attempt at extrapolation from a limited number of data points may produce a totally incorrect or unrealistic formula, even if it matches the given numbers exactly. Also, there is not a unique formula for a finite sequence of numbers. Any finite sequence can be extended to a "formulaic" infinite sequence of numbers in infinitely many ways. For example, $$n^2+1$$ is not the only formula that gives 2, 5, 10, 17, 26, …; another formula that gives a sequence that starts the same way is
 * $$n^5-15n^4+85n^3-224n^2+274n-119$$.
 * —Bkell (talk) 09:16, 21 March 2010 (UTC)

Arc length extension
What would the extension of the arc length formula to three dimensions (giving the area of a region of a surface) look like? 149.169.212.68 (talk) 09:25, 21 March 2010 (UTC)
 * See Surface area. For a function $$f(x,y)$$ this becomes $$\iint\sqrt{1+f_x^2+f_y^2}\,dx\,dy$$. -- Meni Rosenfeld (talk) 10:14, 21 March 2010 (UTC)

Probability question
Three distinct vertices are chosen at random form the vertices of a given regular polygon of (2n+1) sides. Let all such choices are equally likely and the probability that the centre of the given polygon lies in the interior of the triangle determined by these three chosen random points is 5/14.

Q. No. 1	The number of diagonals of the polygon is equal to		(a) 14		(b) 18		(c) 20		(d) 27

Q. No. 2	The number of points of intersection of the diagonals lying exactly inside the polygon is equal to 		(a) 70		(b) 35		(c) 126 	(d) 96

Q. No. 3	There vertices of the polygon are chosen at random. The probability that these vertices from an isosceles triangle is 		(a) 1/3		(b) 3/7		(c) 3/28	(d) None of these —Preceding unsigned comment added by Prathamesh D T (talk • contribs) 13:10, 21 March 2010 (UTC)


 * This is an obvious homework Q. While we don't just do your homework for you, if you show us your work or at least tell us what approach you'd take, we can tell you if that's right or not. StuRat (talk) 13:59, 21 March 2010 (UTC)

I don't necessarily mind seeing a homework question here, but why doesn't the poster ask us his own questions about it rather than just doing stenography? Michael Hardy (talk) 23:11, 21 March 2010 (UTC)

how to copy the equations and all mathaematical terms from wikipedia to MS Word?
I need your kind help to copy the equatons & any other maths terms from wikipedia to word document —Preceding unsigned comment added by 117.197.184.148 (talk) 13:18, 21 March 2010 (UTC)


 * It depends on the level of math-awareness of your browser. The source of in image is TeX math code, the result is (for me) an inline Portable Network Graphics image. You should be able to just drag that out of the rendered wikipage and into your document (or into some folder, and then use "Insert->Image" in Word). Alternatively, you can recreate the formulas in Word's formula editor. Typesetting will suck, but rendering of the typeset formula will be better. Or you can use a small helper program (I use LaTeXiT on the Mac, but there are similar tools for Windows, I've been told) to handle the source code. Of course, doing anything complex (like writing a text) in Word is painful, and writing a text with serious maths in it is unbearable. It pays to learn LaTeX to escape this pain... --Stephan Schulz (talk) 13:39, 21 March 2010 (UTC)


 * If all else fails, you can copy the image. This will leave you with a bitmap of the formula, instead of the formula itself.  The advantage is that it's quick, easy, and accurate.  The disadvantage is that it can't easily be edited (other than for aspect ratio and scale).  Under Firefox, I right click on the formula, select "Copy Image", go to Word, and do an Edit + Paste.  StuRat (talk) 13:51, 21 March 2010 (UTC)

Formula to undistort the image from a shiny sphere
There images are examples: http://www.flickr.com/photos/ch4os1337/400399785/ http://www.flickr.com/photos/stuart100/3096435218/ http://www.flickr.com/photos/mag3737/2229618975/ What fomula could I use to undistort/distort the image so that it looked like a reflection from a flat mirror rather than a spherical one? Thanks. 84.13.41.17 (talk) 15:25, 21 March 2010 (UTC)


 * See map projection - you have quite a lot of choice! 94.168.184.16 (talk) 16:55, 21 March 2010 (UTC)

I don't think that is the answer - map projection is about representing the surface of a sphere as a flat surface. This is about undoing the transformation that a convex mirror makes to what it reflects. 92.29.149.119 (talk) 20:06, 21 March 2010 (UTC)


 * It is described for a very different context, but I think this is relevant as it describes the reflection of a point in a sphere. Integrating over for all the points in the objective plane, you should get the shape of the image plane, the relationship between the two should allow you to flatten out your images (with a fair bit of grunt work). —Preceding unsigned comment added by 92.22.125.66 (talk) 21:27, 21 March 2010 (UTC)


 * I do think you will run into a problem of having around 180° visible on the surface of the sphere, which can't be flattened out without major distortions or rips, just like the spherical map projection problem. Perhaps it could be changed into a VR model where you rotate the camera to look around (this would be like you were in the center of the sphere looking out), although the resolution of the image would go down near the edges. StuRat (talk) 00:48, 22 March 2010 (UTC)


 * Some pixels in the transformed image will be stretched bigger than they were in the original image, but there should not be any rips. 84.13.47.185 (talk) 15:58, 22 March 2010 (UTC)


 * That would be distortions. Those can be minimized by strategically adding rips. StuRat (talk) 17:36, 22 March 2010 (UTC)


 * You seem stuck on the idea that its like a map projection, which it is not, but more analogous to the distortion you get with a lens. 78.149.193.98 (talk) 20:41, 22 March 2010 (UTC)


 * If you had a hemispherical lens, then yes. In fact, that's the very lens used to generate the type of VR models I mentioned, such as are sometimes used to show real estate on the Internet.  I'm agreeing with 94.168.184.16 that the problem is very similar to the map projection problem. StuRat (talk) 01:10, 23 March 2010 (UTC)
 * Never get a job in an opticians, it wouldnt suit you. 92.29.120.231 (talk) 15:09, 23 March 2010 (UTC)

The grunt work for me would include several years of studying maths unfortunately, as I stopped studying it when I was 16. This applet illustrates the problem http://www.phys.ufl.edu/~phy3054/light/mirror/applets/convmir/Welcome.html - you see from the top of the red line, and the problem is to transform the image into what you would see from the top of the blue line. If that link does not work, use this and click Convex Mirrors: http://www.phys.ufl.edu/~phy3054/light/mirror/applets/Welcome.html 92.29.149.119 (talk) 21:49, 21 March 2010 (UTC)


 * It's not years of math, just some high school geometry. The ray tracing article might help. 66.127.52.47 (talk) 04:08, 22 March 2010 (UTC)

Maybe someone could help me figure out a formula for transforming the geometry given in the applet above. I would not be able to understand or implement matrix methods. Thanks 84.13.47.185 (talk) 15:58, 22 March 2010 (UTC)


 * Well, there's two distinct problems, as I see it:


 * 1) Items toward the edge of the sphere (as viewed by us) appear smaller than in real life. This is fairly easy to fix, just by mapping onto a larger circle.  Those pixels in the center map 1-to-1, while those near the edge are stretched radially to more than 1 pixel per original pixel.  Note that the resolution will go down near the edges, using this method.  I think the number of pixels to map to would be 1/cosΘ, where Θ = angle from the center.  So, if we went to 80.4° on all sides of the sphere, that would mean we would stretch those pixels by 1/cos(80.4°) or to 6 pixels each.


 * 2) The angle at which the reflected items are viewed varies by location on the sphere. So, from our POV we are seeing the side view of the items near the edge of the sphere.  This is a more difficult problem to fix, and what makes this like the spherical map projection problem.  The options for handling such a problem are:


 * a) Leave this distortion in. Using smaller squares cut from the sphere will help to limit the distortion, just like small maps limit the distortion due to the spherical shape of the Earth.


 * b) Use a VR (virtual reality) model to actually allow you to view a 3D image. That is, you rotate around to see the entire view.  This would be as if you were inside the sphere looking out.


 * c) Project onto a hemispherical screen. Obviously an expensive option.  StuRat (talk) 01:26, 23 March 2010 (UTC)


 * To show what I mean by a VR model, lets imagine we've stretched out the pixels radially as I described in step 1. Here's a view of the circle that results, with a different character representing each block of pixels:

abc defghij mnopqrstu wxyz12345 67890ABCD EFGHIJK LMO
 * Initially, let's say you display this block of pixels, in the center, to the user:

opqrs yz123 890AB
 * Now they can hit the arrow keys to rotate around. If they pick the right arrow, you would pan to the right, like so:

pqrst z1234 90ABC
 * If they hit the right arrow key again, they'd get this:

qrstu 12345         0ABCD
 * If they tried to rotate further to the right, it would tell them they're at the edge. The reason to display small blocks of pixels instead of the entire image at once, is that the change in angle (distortion) isn't nearly as apparent when viewed in small chunks.  StuRat (talk) 01:43, 23 March 2010 (UTC)

Why would the user want to "rotate around"???? I think you and SteveBaker are stuck in a serious misunderstanding or misconception of the problem. The original image is a set of values with X,Y co-ordinates. The task is to find a formula which maps these coordinates to new X,Y coordinates in another image. The formula will come from the geometry involved. If you refer to the applet diagram above, your eye is at the top of the red line looking towards the sphere. Unfortunately the diagram lacks a vertical line segment between the red eye position and the sphere to represent the image plane. It also lacks another vertical line segment between the blue eye and the inner surface of the sphere to represent the undistorted image plane. But imagining those two things in place, then the task is to calculate a formula which, from the x,y coordinate on the left image plane of a ray-line going through it, gives you the x,y of the ray-line on the right image plane. Obviously, this formula would be undefined for any area outside the shiny sphere. Distorting the pixels is trivial - just imagine them as little squares or oblongs and apply the formula to the coordinates of their corners. 92.29.120.231 (talk) 15:05, 23 March 2010 (UTC)


 * The reason you'd want to rotate around is explained in my number 2 point above. In the first pic provided by the original poster, you can clearly see the tinsel reflected in the sphere, but we don't see the front side of the tinsel reflected there, we see the bottom of the tinsel (near the top of the sphere).  There's no transformation that will change this bottom view of the tinsel into a front view, we simply can't tell what the front of the tinsel looks like, from the image in the sphere.  So, then, showing the bottom view of the tinsel in the same pic as the reflected view of the person is going to be very disorienting to the eye.  We need to limit the amount of this distortion by only showing small portions of the pic at a time.  This is exactly the same issue with world maps.  You can't show the entire Earth, or even a hemisphere, in a single rectangular map without introducing massive distortions.  However, small enough portions of the Earth can be shown with much less distortion. StuRat (talk) 15:53, 23 March 2010 (UTC)

Your problem is that you insist upon seeing this as if the shiny sphere was an orange with the image tattood onto the orange skin, which you think you have to peel off and flatten out. Yet the shiny sphere is more like a lens - the image is not on the surface of it, but is a reflection of the scene. Remember that curved mirrors are used in place of lenses in large telescopes, although concave rather than convex. It rather like arguing with someone from the Flat Earth Society - they've got an answer for every objection. 78.149.133.100 (talk) 20:35, 23 March 2010 (UTC)


 * Exactly what part don't you understand ? Let's start with OP's first pic, with the reflections near the top of the sphere showing a different angle of the tinsel than the center shows of the reflected person.  Can you see that or not ?  If you can't see that, do you imagine it's reflecting the bottom view of the person, or the front view of the tinsel ? StuRat (talk) 20:47, 23 March 2010 (UTC)

Surely its obvious that were are looking at a spherical mirror, and hence the angle of the mirror will vary across its surface. The formula has to take account of the varying angle. Why get so excited at such an elementary and obvious consideration? 78.149.133.100 (talk) 22:24, 23 March 2010 (UTC)


 * So, you agree that we are looking at different sides of each object, depending on which side of the sphere they are located, right ? Well, the goal is to make it look like a reflection from a flat mirror, which would show us the same side of every object.  There is no mathematical transformation that will do that, since there is missing info.  For example, if there's an apple above the sphere, you'd only see the bottom of the apple reflected in the sphere.  So, then, how do you show the front of the apple, as you would see in a flat mirror ?  You wouldn't know if there's a leaf attached or not.


 * The best you can do is to show a series of approximately flat views, one showing the bottom of objects above the sphere, one showing the tops of items below the mirror, etc. Do you get it yet ?  StuRat (talk) 02:47, 24 March 2010 (UTC)

I don't know what you mean by "looking at different sides of each object...sphere they are located". Why do you think I expect to see the front of the apple you describe?

If I spent enough time on it I'm sure I could calculate the correct formula. As someone wrote it is high-school geometry, tracing one of the ray-lines in the ray diagram in the applet linked to above. Extending it from one dimension to the two dimensionms of the image would be a bit more tricky. The diameter of the sphere and the distance to the sphere would have to be estimated. The part of the original image that was not the shiny sphere would of course be discarded. 78.146.216.129 (talk) 16:59, 24 March 2010 (UTC)


 * The original question was "What formula could I use to undistort/distort the image so that it looked like a reflection from a flat mirror rather than a spherical one?". If we had the apple both in front of a flat mirror and above a spherical mirror, we would see different sides of the apple in both.  Here's a side view diagram:

F |           , <-- Leaf. L |           O  <-- Apple. A |          / T |         / |     ... /           \ Apple reflection off M |   .......          / spherical mirror. (> Viewer.  I |   .........                                   R |   ......... < Spherical mirror.   R |   .........   O |    .......   R |      ...


 * In the flat mirror, we would see the reflection of the front of the apple, including the leaf. In the spherical mirror, we would see the bottom of the apple.  Look at the leaf.  You can't see that from the spherical mirror, because the body of the apple blocks it from view.  It is not, however, blocked from the view of the flat mirror.  So, what transformation could you possibly perform on the spherical image, lacking the leaf, so that it would match the planar mirror, with the leaf ?  StuRat (talk) 17:56, 24 March 2010 (UTC)

The undistorted view would be like looking out from the sphere, no mirror to be seen. 92.26.160.21 (talk) 20:33, 24 March 2010 (UTC)