Wikipedia:Reference desk/Archives/Mathematics/2008 July 30

Mathematics desk
< July 29 << Jun | July | Aug >> July 31 >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


July 30 edit

Probability of extraterrestrial intelligent life edit

So I've been idly pondering the likelihood of intelligent extraterrestrial life and I'm wondering about a probability question. I don't have much experience in probability (although plenty in other mathematical areas). Suppose an experiment with desirable outcome (say, the formation of a star with a planet on which an intelligent species evolves), which has an unknown, nonzero but presumably low probability, and furthermore, many, many repeated and (assumedly) independent trials (7.22 x 1022, say). Given that it has occurred at least once, is there any way we can quantify the probability that it occurred only once? Is it possible to quantify the probability of a very unlikely event occuring precisely once in a very large number of trials? Cheers! Maelin (Talk | Contribs) 06:09, 29 July 2008 (UTC)[reply]

If an event has probability p, then the probability of it occuring exactly once in N independent trials is  . For example, if you toss a coin the probability of seeing exactly one heads in 4 tries is 4*(1/2)*(1 - 1/2)^3 = 1/4. For low probability events, such as seeing intelligent life appear,   which means that if it only occured once we would expect  . Dragons flight (talk) 06:42, 29 July 2008 (UTC)[reply]
Hi. See Drake equation for the problem at hand, and Poisson distribution for the statistics of low-p high-N systems (and maybe Stein's method too, if you feel like some rigour). HTH, Robinh (talk) 07:29, 29 July 2008 (UTC)[reply]
But note that if the occurrence of life in each different star system are truly independent events, then the occurrence of life here on Earth tells us absolutely nothing about the probability of life occuring elsewhere in the Universe - otherwise the events would not be independent. Gandalf61 (talk) 09:49, 29 July 2008 (UTC)[reply]
Well, it does tell us that the probability is nonzero (assuming the number of places where intelligent life could evolve is finite). Obligatory link to anthropic principle. « Aaron Rotenberg « Talk « 10:50, 29 July 2008 (UTC)[reply]
Is possible to calculate x and y such that there is a 95% chance than the probability of life arising on a planet is greater (less) than x (y) given we know it's happened once? That might be more useful than just an expected value. --Tango (talk) 18:34, 29 July 2008 (UTC)[reply]
So is there a way of calculating the likelihood that an outcome with unknown probability occurs precisely once in 7 x 1022 trials? Maelin (Talk | Contribs) 01:09, 30 July 2008 (UTC)[reply]
Well, no, since it will be different for different probabilities. --Tango (talk) 03:33, 30 July 2008 (UTC)[reply]

If you suppose one can quantify a) L the number of planets in the universe, and b) P the probability of intelligent life (whatever that is) arising on a planet, then you certainly have the gall to calculate (1 - P)(L - 1) = the probability of life not arising on the (L - 1) planets that are not this one.Cuddlyable3 (talk) 13:42, 31 July 2008 (UTC)[reply]

I suppose you mean (1 - P)(L - 1). For that you also need the gall to assume life arises independently on different planets. Algebraist 13:51, 31 July 2008 (UTC)[reply]

I finally realised that the intuitive feeling I had that some sort of figure was calculable was based on the notion that knowledge of the existence of life on the first planet we examined was evidence to suggest that P couldn't be very low - that is, high values of P suggest other life is probable, and low values of P are themselves unlikely because life arose on Earth. Fortunately, I finally realised that this is anthropic reasoning - since P could just as easily be low as high, and in universes with low P, if intelligent life did arise as a fluke, such reasoning would lead inhabitants to the erroneous conclusion that P on their universe is unlikely to be low, when in fact it's merely they who are unlikely.

This, I guess, spells the death of the "it's such a big universe, it seems unlikely that of all those stars, only ours has life on it" argument for the probable existence of aliens. Thanks to all who helped! Maelin (Talk | Contribs) 12:15, 2 August 2008 (UTC)[reply]

Cardinality edit

Hi. Consider the natural numbers whose factorisation contains, at most, one of each prime. That is, their factorisation is a proper set, not just a bag. The first few of these numbers are 1, 2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 19, 21, 22, 23, 26, 29. I'll call these the unique factor naturals, or uf-nats. Obviously, being a subset of the natural numbers, the set of all uf-nats has cardinality aleph-zero. Now, the set of all primes (call it P) also has cardinality aleph-zero. All uf-nats are a subset of P, and any subset of P must be a uf-nat. So there is a one-to-one correspondence between uf-nats and subsets of P.

The set of all subsets of P (P's power set) is therefore equal to the set of all uf-nats. P's power set has cardinality 2^P = 2^aleph-zero = aleph-one. How is it possible for a set with cardinality aleph-one (P's power set) and aleph-zero (the uf-nats) to be in a one-to-one correspondence? 79.72.192.135 (talk) 12:02, 29 July 2008 (UTC)[reply]

In your mapping, an uf-nat is mapped to a finite subset of P. There are no uf-nats corresponding to infinite subsets of P - for example, there is no uf-nat that corresponds to the set of all primes greater than 2. So the cardinality of the set of all uf-nats does not have to be the same as the cardinality of the power set of P - indeed, as you have shown, it is smaller. Gandalf61 (talk) 12:14, 29 July 2008 (UTC)[reply]
Yes, that would do it, thanks. So there are only countably many finite subsets of a countable set, but uncountably many infinite subsets. It also occurred to me to type that sequence into OEIS; it turns out what I called uf-nats are also called square-free numbers. 79.72.192.135 (talk) 12:22, 29 July 2008 (UTC)[reply]
Darnit, I was just coming here to post the Sloane index and you've beaten me to it! Oh well, it is A005117 if anyone else happened to want to know. --tiny plastic Grey Knight 12:42, 29 July 2008 (UTC)[reply]
Yes, they are called square free and we even have an article on them Square-free integer. --Tango (talk) 18:36, 29 July 2008 (UTC)[reply]

which of non-linearly related variables is distributed normally? edit

In high school, we were taught that "most naturally occurring random variables are distributed normally," by which they meant stuff like height, weight etc. within a given population. Later I found out the connection between this and the Central Limit Theorem. Then something occurred to me: if X is normally distributed, then non-linear transformations of X will not be. The problem is that most naturally occurring random variables can be transformed non-linearly into other fairly natural variables (eg. tree trunk radius into cross-section area), so only a fraction of those can be normal. Another good example is height and weight: these are related non-linearly, although not as closely as radius and area, so they can't both have normal distribution curves within a population, for a given gender (as the Normal distribution article confirms). Is there any general way that you can determine which of two related variables will be normally distributed, and is it possible that both will have a roughly normal, but skewed distribution? 202.89.166.179 (talk) 15:56, 29 July 2008 (UTC)[reply]

Your question has essentially all the ingredients of the answer. You should expect near normal distribution of a variable   if it is a result of many independent or nearly-independent contributions (where no particular few are dominant). Here, "contribution" should be interpreted in the additive sense. So if   is a non-linear function of  , you would still have   as a function of many independent events, but in this case the events would not combine by addition. For example, a somewhat reasonable model for the distribution of the price of a stock at a fixed future time is the exponential of a normal random variable. This is based on the explanation that individual events have multiplicative effects on the stock price, which is the same as an additive effect on the log of the stock price. Oded (talk) 16:18, 29 July 2008 (UTC)[reply]

Thanks for that answer. But is it possible that two variables, related but not linearly, can both have nearly normal distributions, ie. both skewed? 202.89.166.179 (talk) 17:21, 29 July 2008 (UTC)[reply]

That happens a lot, in a way. For example, suppose that   and   is a normal random variable. If   is nearly linear near the mean of  , then   will be nearly normal. This is not quite precise, since I have not said what nearly and near mean, but it is possible to come up with precise versions of this statement. Many useful and naturally occuring functions are smooth, and the smooth functions are close to linear on small scales. Oded (talk) 21:23, 29 July 2008 (UTC)[reply]

Thanks again, :) 202.89.166.179 (talk) 05:05, 2 August 2008 (UTC)[reply]

Does it start with a 1 or a 0? --117.196.136.3 (talk) 16:29, 29 July 2008 (UTC)[reply]

Conventionally it starts with a 0, as in Sloane's OEISA000045. --tiny plastic Grey Knight 16:35, 29 July 2008 (UTC)[reply]
But note that the initial 0 is the 0th term of the sequence. I think everyone agrees that the 1st and 2nd terms are both 1, the only dispute being that some prefer to leave off the 0th term. Algebraist 17:12, 29 July 2008 (UTC)[reply]
Okay, good clarification. :-) For an encore, discuss the difference between a geometer's and topologist's n-sphere in 100 words or less. :-) --tiny plastic Grey Knight 17:22, 29 July 2008 (UTC)[reply]
A topologist's n-sphere is a naked topological space. A geometer's one is equipped with a smooth structure and probably a Riemannian metric. Algebraist 17:29, 29 July 2008 (UTC)[reply]
Related to what Algebraist says, I think the important thing is that the element of index 0 is 0, and the elements of index 1 and 2 are both 1. This results in the nice property that  . This normally means that the sequence starts with a 0 (but can actually extended infinitely both forwards and backwards), unless you're one of the lots of people who believe natural numbers start with 1, in which case the sequence starts with two 1s. – b_jonas 16:29, 31 July 2008 (UTC)[reply]

Tall tree heights edit

How do you determine the height fo a tall tree without climbing up with a tape measure —Preceding unsigned comment added by 79.64.140.117 (talk) 20:36, 29 July 2008 (UTC)[reply]

Cut it down! No actually, this might not be the best idea. Let's see... Maybe you can use some geometry and the fact that light travels in straight lines? Oded (talk) 21:27, 29 July 2008 (UTC)[reply]
Or a rangefinder and the Pythagorean theorem. But without fancy tools I’d probably go with measuring the shadow, finding the angle of the sun, and using similar triangles. GromXXVII (talk) 21:39, 29 July 2008 (UTC)[reply]
Gah, ya beat me to it, Grom. Yes, measure the shadow, and then take the measurement of the shadow of a meterstick, and see how many of the meterstick-shadows fit in the tree-shadow. Or something like that. That doesn't count for the roots, though. But I don't think that matters. Excuse my rambling. IceUnshattered (talk) 22:53, 29 July 2008 (UTC)[reply]
Usually in a forest you cannot discern the shadow of a tree. Oded (talk) 23:26, 29 July 2008 (UTC)[reply]
Measure a known distance from the trunk with a tape measure. Stand at that distance and get some kind of rod and line it up from your eye to the top of the tree. Measure the angle from the rod to the horizontal (a string with a weight on the end hanging from the rod to give you a vertical can help) and then use basic trig to calculate the height - remember to add the distance from the ground to your eyes to the final result. --Tango (talk) 01:13, 30 July 2008 (UTC)[reply]
Climb up with a stone and a stop watch. Drop the stone from the top of the tree and measure the time it takes to hit the ground. Use Newton's second law to compute height. Density of branches has pros and cons. Tlepp (talk) 10:55, 30 July 2008 (UTC)[reply]
Wait until a bird lands on top of the tree. Measure the angular size of the bird. Shoot the bird. Measure the bird. Do the calculation. McKay (talk) 11:05, 30 July 2008 (UTC)[reply]
(This method requires a set of bathroom scales). Weigh yourself at the bottom of the tree (call this  ), then climb it and weigh yourself at the top (calling this  ) (this method also requires good balance). If you know that the radius of the Earth at the tree's location is  , then the height of the tree is just  . --tiny plastic Grey Knight 13:12, 30 July 2008 (UTC) more seriously, User:Tango's answer seems best[reply]
First, acquire a barometer. Then use one of the methods listed in the barometer question article. Gandalf61 (talk) 13:16, 30 July 2008 (UTC)[reply]
I find the tree's custodian and offer to exchange the barometer for telling me the height of the tree. --Random832 (contribs) 13:29, 30 July 2008 (UTC)[reply]
I don't know if a dryad would be interested in having a barometer, but I suppose it can't hurt to try. --tiny plastic Grey Knight 13:51, 30 July 2008 (UTC)[reply]
Climb up the tree with a piece of string, cut the string to be as long as the tree is high. Climb back down the tree, and measure the string. Philc 0780 13:49, 30 July 2008 (UTC)

On a cloudy day, or if the shadow isn't clear for some other reason, use a slingshot to shoot a stone so that it just makes it over the tree at the top. Time its fall to the ground and you can calculate the height: the horizontal travel won't change the time for the stone to fall to the ground. --Slashme (talk) 13:52, 30 July 2008 (UTC)[reply]

If you can control the initial velocity and angle of the stone, adjust those so the stone just hits the top of the tree, and you can calculate the trajectory, and thus the height of the tree. --Carnildo (talk) 20:37, 30 July 2008 (UTC)[reply]

Come on, people, that's enough. I've given the standard method, the question is answered, let's stop with all the jokes, huh? --Tango (talk) 17:50, 30 July 2008 (UTC)[reply]

What jokes? ō_ō hydnjo talk 23:46, 30 July 2008 (UTC)[reply]
Assume a spherical tree... « Aaron Rotenberg « Talk « 04:45, 31 July 2008 (UTC)[reply]
The real standard method, if the base of the tree is not accessible but everything round about is level, is to take two measurements of the angle to the top of the tree from points a known distance apart in line with the base. If the distance is x and the angles are alpha and beta, then the height is x/(cot beta - cot alpha).…217.43.211.113 (talk) 09:55, 31 July 2008 (UTC)[reply]
To Grey Knight: I recommend measuring a weight with a kitchen scale instead of a bathroom scale becasue bathroom scales are often inaccurate if not placed on a flat horizontal surface (they can give wrong results even on a fluffy carpet), and the treetop doesn't provide for such a surface. – b_jonas 16:23, 31 July 2008 (UTC)[reply]
I hope I'm not messing up a test, but this question is often used to see if people will ask that very important 'why' question when given a task. Dmcq (talk) 20:09, 2 August 2008 (UTC)[reply]
The standard tool used for measuring angles in triangulation is the theodolite, but perhaps a sextant can be used as well. --Bowlhover (talk) 12:01, 3 August 2008 (UTC)[reply]
The article on horizon shows how to calculate the height of a tree by walking away from it till the tip just disappears. Just measure how far you walk and how high you are. It has a helpful picture as well as the formula. Dmcq (talk) 19:14, 3 August 2008 (UTC)[reply]

Finding all roots to a 4th degree polynomial edit

The first of many such questions goes like this:

Given: f(x)=x^4-3x^3+2x^2-7x-11 Find all roots to the nearest .001

I tried to separate the groups with parenthesis, so, (x^4-3x^3)+(2x^2-7x)-11. But I didn't think this works when there's an x^0 in the equation. So I moved the 11 to the other side, (assuming f(x) was equal to zero) and tried to factor out from what was left. But I couldn't factor. The next thing I thought was matrices, so I plugged them into a 5X1 Matrix and hit "rref(". But the response was merely the matrix I sent in. I've heard there's a long way, but I can't remember it. Could somebody help? --Ye Olde Luke (talk) 03:04, 30 July 2008 (UTC)[reply]

There are several ways of approaching this, but one way might be to iteratively use Newton's method. By hand, that would be considered a "long way", though. Baccyak4H (Yak!) 03:27, 30 July 2008 (UTC)[reply]
Since the question says "to the nearest .001" I expect you are intended to do it numerically. If you're allowed to use a computer (as it seems you are), I suggest plotting a graph (you could plot it by hand if you want, but a computer is far easier!) to find out roughly where the roots are and then try an iterative method to find the roots (rearrange f(x)=0 to x=g(x) and then plug a value of x near the root into the new function, g, and keep doing so until you have a precise enough answer). That's not guaranteed to work (the values of x may get further and further away from the root, rather than closer), but it often does. If it doesn't, you'll need some other numerical method - if you're being asked that kind of question, I imagine you've been taught some. --Tango (talk) 03:31, 30 July 2008 (UTC)[reply]
The general fourth degree polynomial equation is known to be solvable by radicals (i.e., extracting roots, multiplication, division, addition and subtraction) since 1545. See the Timeline of algebra and quartic equation. The solution on that page looks rather complicated. I plugged your equation into Mathematica, and Mathematica spits the four solutions, two real and two complex. For example, one of the real solutions is 3.32901. For the higher degree equations, it has been proved by Galois that generally no solution by radicals is possible. In such cases, one reverts to numerical methods. To use Newton's method effectively, you need to first find a point that is quite close to a solution. This is a nontrivial problem. See, for example the Acta 1989 paper by Doyle and McMullen. Oded (talk) 05:25, 30 July 2008 (UTC)[reply]
In fact, PlanetMath has the quartic formula, http://planetmath.org/encyclopedia/QuarticFormula.html, although for finding the solutions it’s pretty much useless because a method of derivation using the given values would be both involve less computations and be less error prone than plugging everything in. GromXXVII (talk) 10:55, 30 July 2008 (UTC)[reply]
I graphed the equation using my graphing calculator, and 3.3201 apears to be one of the zeroes. The other is somewhere close to -.9121094. I'm sorry, I've been on summer vacation for months, and can barely dreg up what I've already stated. I there any way to clarify the Wikipedia article examples? I vaguely recall learning that the funny thing about Complex numbers is that as solutions they always come in pairs, one negative and one positive. So if I can find one, I can find the other, right? (By the way, you're all getting Reference Desk barnstars for your help)--Ye Olde Luke (talk) 05:45, 30 July 2008 (UTC)[reply]
Regarding the "pairs" of complex solutions, you are thinking of the complex conjugate root theorem, on which we have an article. Which articles do you think have confusing examples? Perhaps those pages can be improved (you could even help if you like!). --tiny plastic Grey Knight 09:17, 30 July 2008 (UTC)[reply]
Here is something that works for this particular equation and does not require any advance math and you can do by hand (if you care to). First, if you evaluate the polynomial at the three points  , you get positive, negative and positive answers, in this order. Therefore, you can use the bisection method to find approximations of two roots, one between 0 and 4, and the other between -1 and 0. (I guess you already did this.) You will need to get these roots with a higher level of accuracy than the target of 0.001, since you will use them to find the others. (I think the answers you wrote are not accurate enough.) So say the root approximations that you found where a and b. Then you divide your original polynomial P by the polynomial  , using polynomial division. If a and b where the exact roots, the division would leave no remainder, and you would get a second degree polynomial. However, since they are not quite the exact root, the division would have a remainder, and you would have
 
where Q is a second degree polynomial that you find, and R is the remainder, which is a linear polynomial. Now, since a and b are approximate roots, the coefficients of R will be rather small in absolute value. Therefore, if you plug into P the roots of Q, you get something close to zero. In other words, the roots of Q are approximations of the roots of P. You find the roots of Q using the quadratic formula, which gives you approximations of all four roots of P. Oded (talk) 15:30, 30 July 2008 (UTC)[reply]
After the polynomial division, I got "x^2-3.9x+3.51+(-26.36x+14.53/x^2+.9-3)" Since you said to find the roots of Q, which I took to be x^2-3.9x+3.51 , I used the quadratic formula, which looked like this:
 
But, when I reduced that, it didn't give me complex answers, it gave me 2.49 and 1.41 . The only thing I didn't do was make my first two answers more exact. Would that really cause the whole problem to turn out incorrectly? --Ye Olde Luke (talk) 18:54, 30 July 2008 (UTC)[reply]
You've done something wrong with the polynomial division. You should end up with the remainder being of the form ax+b, there shouldn't be a 1/x2 term. --Tango (talk) 19:01, 30 July 2008 (UTC)[reply]
I parrot-copied the way the Wikpedia article did it, and their answer looked like that. Did I pick the wrong section of the article to copy? --Ye Olde Luke (talk) 19:05, 30 July 2008 (UTC)[reply]
For one thing, did you multiply out   before dividing? If your approximation is good enough, then the remainder R that you get would have small coefficients. There is something else that might be confusing to you, that I wrote the equation as  , while on that polynomial division article they would write it instead in the form  . If you write out your steps in greater detail, we'd be able to make sure they are ok. By the way, when you wrote above "x^2-3.9x+3.51+(-26.36x+14.53/x^2+.9-3)", did you mean  ?. In any case, the remainder does not look small enough. Oded (talk) 21:01, 30 July 2008 (UTC)[reply]
I think I found your mistake. It occured when you multiplied out  . Presumably, you got  , whereas the correct answer is approximately  . Is that it? Oded (talk) 21:12, 30 July 2008 (UTC)[reply]
You're right. I forgot to add -3.3 to .9 . I'm gonna try the problem again, one minute. --Ye Olde Luke (talk) 00:05, 31 July 2008 (UTC)[reply]
All right, I've completely writen out the steps I took to solve the problem, but to save Reference Desk space, I've completed it at User:Ye Olde Luke/proof. Please check to see if I did all the steps right. --Ye Olde Luke (talk) 01:08, 31 July 2008 (UTC)[reply]
I haven't checked your arithmetic, but the method looks right. Checking the numbers is easy - just plug them into the polynomial and see if you get zero! One thing - you were asked for values accurate to the nearest 0.001, but haven't gone anywhere near that close. --Tango (talk) 01:17, 31 July 2008 (UTC)[reply]
Oops. I fixed that now. --Ye Olde Luke (talk) 01:30, 31 July 2008 (UTC)[reply]
Now, you didn't - you need to use the more precise real values in the calculation of the complex ones (in fact, you should use slightly more precise values in order to account for any multiplication of errors). --Tango (talk) 01:36, 31 July 2008 (UTC)[reply]
(edit conflict) I think you got the long division right. But it seems you made a few errors here and there. At some point you switched the sign of the root near -0.9, and the square root leading to the imaginary part was messed up. Tango is also right. You need more accuracy. Regardless of the target of 0.001, just to feel safe I would not be happy to drop the remainder if its coefficients are larger than 0.1. Once you work more accurately, you can check that you are getting the right answers by plugging in, as Tango suggested. Do you know how to get the first two real roots accurately? Oded (talk) 01:40, 31 July 2008 (UTC)[reply]
On a TI-84 graphing calculator? No. I just zoomed in a whole bunch of times.--Ye Olde Luke (talk) 01:47, 31 July 2008 (UTC)[reply]
That should work pretty well. It's basically an electronic version of the bisection method. That article will explain how to do it by hand. --Tango (talk) 01:56, 31 July 2008 (UTC)[reply]
Oh, okay. I've increased the acurracy to 3.3290176, and -.9112938. I'm going to use the more exact figures to adjust my work. --Ye Olde Luke (talk) 02:37, 31 July 2008 (UTC)[reply]
Darnit. With the more precise numbers, one answer worked out great, leaving a remainder of less than .0002. I made a mistake somewhere with the other. --Ye Olde Luke (talk) 03:10, 31 July 2008 (UTC)[reply]
You have some difficulties with consistency. (I would not hire you to do my taxes. :-) In the third from the top box on the right, you did not carry the -11 down and made an error in the column with the -7 in it. Oded (talk) 04:00, 31 July 2008 (UTC)[reply]
I see what I did wrong! When you add a negative to a negative, it gets further from zero! That was a dumb mistake. All right, I think I've gotten it finished. Both remainder coefficients were well below .1, and Oded or myself have (I think) managed to locate all arithmatic mistakes. Is it correct? --Ye Olde Luke (talk) 06:05, 31 July 2008 (UTC)[reply]
One more small mistake.  . Always plug it in to check. Oded (talk) 06:26, 31 July 2008 (UTC)[reply]
Mistake fixed. Thanks. One last thing: this time, to check, I plugged .291 + 1.882i into the orignal equation to see if it worked. The answer returned was: 6.3257249E-5+8.2283318E-5i . I'm not sure what that means. Did that happen just because my answer is a little approximated? --Ye Olde Luke (talk) 06:50, 31 July 2008 (UTC)[reply]
That's exponential notation for 0.000063257249 + 0.000082283318i, a complex number that's pretty close to zero. Its magnitude (absolute value) is   so you can be pretty confident you've got the right answers. --tcsetattr (talk / contribs) 07:58, 31 July 2008 (UTC)[reply]
Congrat's! You got it. To elaborate on tcsetattr's entry, the E-5 means that you need to multiply the previous number by 10-5. Oded (talk) 15:50, 31 July 2008 (UTC)[reply]
Wow, I actually did it! Thanks Oded, Tango, and everyone else who helped me out! And, as per my promise, everyone who helped me out gets a barnstar! --Ye Olde Luke (talk) 17:11, 31 July 2008 (UTC)[reply]

Using the J (programming language), (which is downloaded for free from www.jsoftware.com), you write

  p. _11 _7 2 _3 1

where the sign p. solves the equation -11-7x+2x^2-3x^3+x^4=0. The answer is

┌─┬────────────────────────────────────────────────┐
│1│3.32901 0.29114j1.8818 0.29114j_1.8818 _0.911294│
└─┴────────────────────────────────────────────────┘

meaning that the four solutions are approximately 3.329, 0.291+1.882i, 0.291-1.882i, and -0.911 . If you want to know what you are doing, study the Durand-Kerner method. Bo Jacoby (talk) 11:23, 1 August 2008 (UTC).[reply]

Adding to a running average edit

I hope someone can help with this, it's a problem I've come up against whilst coding a game, but I think the problem belongs here rather than on the Computing board.

I have access to a number which is a pre-calculated average of a series of other numbers. I do not know what the individual values making up this average are. All I do know is how many values there were. I want to add a new number to this mystery series, and get a new average value. Is this even possible? If not -- how best can I get a reasonable aproximation of what the value would be?

195.195.236.129 (talk) 18:40, 30 July 2008 (UTC)[reply]

Sure. If your old average is A and you had previously n numbers and you get a new number x, then the new average is  . Check it out using the definition of average. Oded (talk) 18:48, 30 July 2008 (UTC)[reply]
It's fairly simple to show why this is true, too. Your running average was found by dividing the running total by the number of values, so you can regain that running total by multiplying the average back by the number of values (so   in Oded's notation). Adding on your new number, your new total is  , and you've got one more value so you find the new average by dividing by   to get   (which is the same formula as above).--PaulTaylor (talk) 19:06, 30 July 2008 (UTC)[reply]
The running average article tells us a more stable formula you shoule use if you don't do calculations with exact numbers: the new average should be computed as  . (I'm not really good in numerical analysis, but I do remember having read this somewhere, probably in Knuth vol 2. There's also a similar formula for computing the population variance incrementally, but I can't tell what it is.) – b_jonas 16:13, 31 July 2008 (UTC)[reply]