Wikipedia:Reference desk/Archives/Mathematics/2006 October 5

Constructing an sequence/equation to fit a sent of given arbitary numbers
I have series of five two-digit numbers that were selected at random. What is the easiest way to find an equation so that each of the numbers is a solution. Relatedly-- what is the easiest way to find a function that would define the sequence of those numbers (so that first few numbers in the sequence are those given?

Why do you ask? well. Lost is an amazing tv show, and I thought it would be most fun to use an equation in my class that is linked to The Numbers uses on Lost. I've done this by hand at some point in the past, but the precise method escapes me. I've got a computer program that can do it, but the round-off errors cause me to get results that are "close, but not exact".

--Alecmconroy 09:29, 5 October 2006 (UTC)


 * You'll need at least a 5th-degree polynomial for that. Take a look at polynomial interpolation. ☢  Ҡ i∊ ff   ⌇  ↯  10:56, 5 October 2006 (UTC)


 * If A, B, C, D and E are five numbers, the equation (x–A)(x–B)(x–C)(x–D)(x–E) = 0 has solution set {A,B,C,D,E}. --Lambiam Talk  16:49, 5 October 2006 (UTC)


 * Define f(n) by

(E-4D+6C-4B+A)*n*(n-1)*(n-2)*(n-3)/24 + (D-3C+3B-A)*n*(n-1)*(n-2)/6 + (C-2B+A)*n*(n-1)/2 + (B-A)*n + A


 * Then f(0) = A, f(1) = B, f(2) = C, f(3) = D, f(4) = E, and f(5) gives the next number in the sequence. -- Four Dog Night 22:42, 5 October 2006 (UTC)


 * I done this months ago. Basically what you are looking for is an equation that:
 * f(0)=A
 * f(1)=B
 * f(2)=C
 * f(3)=D
 * f(4)=E


 * I'll see if I can dig up the equations.

Here it is
 * 1) !/usr/bin/python

from simplematrix import *

seq=[ 4, 8 , 15 , 16 , 23 , 42 ]

list=[] for x in range(len(seq)): list.append((x,seq[x])) print list

lenseq=len(list) print "lenseq=",lenseq

mlist=[] for datum in list: (x,y)=datum row=[] for p in range(lenseq): row.append(x**p) row.append(y) mlist.append(row) A=matrix(mlist) A.display B=A.copy B.gauss print "B=" B.display C=B.last_Vvec print "C=" C.display

$$f(x)=y=a_0 + a_1 \times x + a_2 \times x^2 + a_3 \times x^3 + a_4 \times x^4 $$

solving

$$\begin{bmatrix} 1 & x_0 & x_0^2 & x_0^3 & x_0^4 \\ 1 & x_1 & x_1^2 & x_1^3 & x_1^4 \\ 1 & x_2 & x_2^2 & x_2^3 & x_2^4 \\ 1 & x_3 & x_3^2 & x_3^3 & x_3^4 \\ 1 & x_4 & x_4^2 & x_4^3 & x_4^4 \\ \end{bmatrix}

\begin{bmatrix}a_0 \\ a_1 \\ a_2 \\ a_3 \\ a_4 \end{bmatrix}

=

\begin{bmatrix}y_0 \\ y_1 \\ y_2 \\ y_3 \\ y_4 \end{bmatrix}

$$
 * where
 * $$x_0 = 0 \,$$ and $$y_0 = A \,$$
 * $$x_1 = 1 \,$$ and $$y_1 = B \,$$
 * $$x_2 = 2 \,$$ and $$y_2 = C \,$$
 * $$x_3 = 3 \,$$ and $$y_3 = D \,$$
 * $$x_4 = 4 \,$$ and $$y_4 = E \,$$

Solving the equation using Computer Algebra System is a nightmare a0 = y0

25*y0  y4   4*y3 a1 = (4*y1) - (3*y2) - - - -- + 12    4     3

35*y0  13*y1   19*y2   11*y4   7*y3 a2 = - - - + - + - - 24      3       4      24      3

3*y1           7*y3   5*y0   y4    a3 =  - (2*y2) +  -  - -- 2              6      12    4

(y0 + y4 - (4*(y1 + y3)) + (6*y2)) a4 = -- 24


 * 202.168.50.40 23:07, 5 October 2006 (UTC)

Given a finite set $$S\subset\mathbb{C}$$ and a function $$\hat{f}:S\to\mathbb{C}$$ you can get a polynomial of degree at most $$\left| S\right|-1$$ that assumes those values:
 * $$f(z)=\sum_{a\in S}\hat{f}(a)\prod_{\begin{matrix}\scriptstyle b\in S\\\scriptstyle b\ne a\end{matrix}}\frac{z-b}{a-b}$$

Can you believe that Wikipedia-TeX doesn't support friggin' \substack? A damn shame. One minute to compose a flippant response, ten to try to get the formula to look OK and the spacing is still crap. It doesn't even support \lvert and \rvert. –Joke 02:05, 6 October 2006 (UTC)


 * There is no special about polynomials, you can also solve this using this non-polynomial equation.


 * $$f(x)=y=a_0 + a_1 \times 2^x + a_2 \times 3^x + a_3 \times 5^x + a_4 \times 7^x $$


 * solving


 * $$\begin{bmatrix} 1 & 2^{x_0} & 3^{x_0} & 5^{x_0} & 7^{x_0} \\

1 & 2^{x_1} & 3^{x_1} & 5^{x_1} & 7^{x_1} \\ 1 & 2^{x_2} & 3^{x_2} & 5^{x_2} & 7^{x_2} \\ 1 & 2^{x_3} & 3^{x_3} & 5^{x_3} & 7^{x_3} \\ 1 & 2^{x_4} & 3^{x_4} & 5^{x_4} & 7^{x_4} \\ \end{bmatrix}

\begin{bmatrix}a_0 \\ a_1 \\ a_2 \\ a_3 \\ a_4 \end{bmatrix}

=

\begin{bmatrix}y_0 \\ y_1 \\ y_2 \\ y_3 \\ y_4 \end{bmatrix}

$$

Thanks and another related question!
Wow! thanks for the excellent answers. Based on your advice, I've constructed the answer to the two questions I posed earlier, given my specific set of arbitrary numbers: 4,8,15,16,23,42. If you watch the show Lost that is all the rage, these numbers are supposed to have deep spiritual significance to Life, The Universe, and Everything (the sixth one in particular).

For anyone interested, the equation that has those six numbers as a solution was:
 * $$x^6 - 108x^5 + 4405x^4 - 87270x^3 + 881464x^2 - 4239552x + 7418880=0 $$

That was simple enough, and I can't believe I missed how to construct it.

The second question, however, has proven more elusive. I found a correct formula that will define the sequence in question:
 * $$S(n)=(1/40)(2400 - 4896n + 3670n^2 - 1175n^3 + 170n^4 - 9n^5) $$

Everything looks good, until I try to extrapolate out what the "next" numbers in the sequence are. The seventh number should be 46-- so far so good. The eighth number, however, is -52, and successive numbers after that shoot off to negative infinity. So, it seems I've encountered another example where math and computers have given me exactly what I asked for-- but not what I actually wanted. Therefore, let me reformulate the question:

How do I find a formula for a strictly increasing sequence of arbitrary natural numbers?

I have an answer if I'm willing to let myself use recursive definitions and the absolute value function, but, it's sort of a cop-out, because we're going to use piece-wise definition, I might as well just define a piecewise function that gives me the sequence, rather than going through a bunch of magic to make it look like it's a single equation, when really, there are piecewise functions hidden in the absolute value signs.

Any suggestionf for how I could accomplish this new goal? --Alecmconroy 10:52, 7 October 2006 (UTC)


 * Try


 * $$S(n) + (n-1)(n-2)(n-3)(n-4)(n-5)(n-6)f(n)$$


 * where f is some random function (the constant 1, for example). Fredrik Johansson 11:42, 7 October 2006 (UTC)


 * That would buy me strictly increasing, but I still have the problem of ensuring positive integer solutions. And of course, it'd be nice if I could find a fifth order polynomial that could do this.  --Alecmconroy 12:48, 7 October 2006 (UTC)


 * I see you're putting this on Lostpedia. Fine, but what really is the point? There are many interpolating polynomials/functions based on arbitrary data (like Fredrik says, you can choose "some random function" to do the job for you), and unless you make this more specific (which you can't, since you're only given the six Lost numbers), it's not going to "mean" very much.
 * Coincidentally, if you haven't been following the Lost Experience game, go watch the Sri Lanka video (find it on Lostpedia), it gives a canon explanation for what exactly these numbers are for. Dysprosia 11:49, 7 October 2006 (UTC)


 * Dysprosia, you make a good point. Over the time I was working on this problem, I did on occasion ask myself "Why am I doing this again???".  Theere are a couple answers here.  The first is that, at this point, it really has nothing to do wth Lost anymore.  When I first heard the numbers, I wondered if there was some important pattern to them, as did everyone.  But by now, I think everyknow knows the essentially just made them up.  But, between seeing the numbers and having that realization, I got the question "How do I find equations for arbitrary sequences of numbers) in my head, and once I realized I didn't know the answer, it drove me crazy trying to find it.


 * The second answer, which is much more trivial, is that there is one tiny small possibility that this could have some bearing on the actual show Lost. They've got lot of years ahead of them yet, and they'll need to fill it up with a lot of mythology.  If at some point they decide they need to have a seventh number, or have a SIMPLE equation for the numbers on a blackboard somewhere,  then the creators of the show might call up a mathematician who would do the exact same thing I'm doing in order to try to figure out what the seventh number "should" be.  In which case, I will be able to say "I called it!" and brag for all eternity.  But, that's really not at issue-- the real issue is, I have an obsessive need to learn the solutions to interesting math problems.


 * About Lostopedia-- yeah, I went ahead an posted the equations I've found to there, just so anyone who's interesting could take a peek. I figured they could always rip it down if nobody finds it interesting but me. hehehe.
 * --Alecmconroy 12:33, 7 October 2006 (UTC)

arithmetic sequences of integers and prime powers.
I'm wondering about possible generalizations and variants of Dirichlet's theorem that (a,b)=1 means {|a+kb|} contains infinitely many primes. Supposing (a,b)=1, and n is a fixed integer greater than 1. One question is: Must {|a+kb|} contain infinitely many nth powers of primes? If not, for which n, if any, and is it a function of a and b(aside from relative primehood)? Thanks.Rich 10:41, 5 October 2006 (UTC)
 * For a start, see quadratic residue. For all primes in the same residue class mod b, the nth powers lie again in one residue class mod b. E.g., there are no primes whose squares are 2 or 3 mod 5, but all primes of the form 5k+2 (infinitely many) have squares of the form 5k+4.--gwaihir 12:08, 5 October 2006 (UTC)

Thanks, that's a good answer.Rich 12:49, 5 October 2006 (UTC)

Plim's v. lim
What is the difference, in practice, of a probability limit and a normal limit? How does knowing a plim help? ChowderInopa 14:06, 5 October 2006 (UTC)


 * Uhh, some series converge in probability but not almost surely or pointwise almost surely or pointwise. It is a weaker notion. See convergence of random variables and come back if you have any more questions. What do you mean by "in practice"? –Joke 01:30, 6 October 2006 (UTC)