Perhaps you have seen one of those math problems that says, "What's the next number in this series: 2, 6, 12, 20, ...". Or in the real world, scientists and engineers routinely find a set of numbers through experiments and would then like to find a formula that fits these numbers. A few years ago I developed a simple (though admittedly sometimes tedious) technique for finding a formula to fit a set of numbers.
Disclaimer: While I developed this technique myself, the mathematics behind it is simple enough that I would not be in the least surprised to learn that someone else invented it before me. If anyone reading this is aware of this or a similar technique being published elsewhere, I'd be interested to here about it.
A mathematically astute person might immediately object that what I am saying is impossible, that there is no "one formula" that fits any given set of numbers. This is quite true. What this technique finds is the simplest polynomial that fits the numbers. A polynomial is an equation in the form
a_{0} + a_{1}n + a_{2}n^{2} + a_{3}n^{3} + a_{4}n^{4} + ...
To explain my technique, let's work through an example. Suppose you are given the following series of numbers and want to find a formula for them, and then compute the next number in the sequence.
2, 8, 9, 11, 20
The first step is to arrange them in a column. To the left of this column we write an ascending list of counting numbers, like this:
1 | 2 |
2 | 8 |
3 | 9 |
4 | 11 |
5 | 20 |
We number the column with the original values "0". We then create a column 1, where each value is the difference between each pair of values in column 0. Always take the lower number minus the upper number. That is, we first compare the first two numbers: 2 and 8. 8 - 2 = 6, so we write 6 to the right of and somewhat between 2 and 8. Then we compare the third number, 9, to the second number 8. 9 - 8 = 1. We proceed down the column this way, like so:
0 | 1 | |
---|---|---|
1 | 2 | |
6 | ||
2 | 8 | |
1 | ||
3 | 9 | |
2 | ||
4 | 11 | |
9 | ||
5 | 20 |
Now we make a column 2 by taking the differences between the values in column 1, like so:
0 | 1 | 2 | |
---|---|---|---|
1 | 2 | ||
6 | |||
2 | 8 | -5 | |
1 | |||
3 | 9 | 1 | |
2 | |||
4 | 11 | 7 | |
9 | |||
5 | 20 |
Note that negative results -- as in 1 - 6 -- are normal and expected.
We continue making new columns in this way until all the values in a column are the same. In this case, that just takes one more column.
0 | 1 | 2 | 3 | |
---|---|---|---|---|
1 | 2 | |||
6 | ||||
2 | 8 | -5 | ||
1 | 6 | |||
3 | 9 | 1 | ||
2 | 6 | |||
4 | 11 | 7 | ||
9 | ||||
5 | 20 |
Recall that subtracting a negative is the same as adding a positive. Thus 1 minus negative 5 = 1 + 5 = 6.
What happens, you may ask, if we never reach a point where all the numbers in a column are the same? Simple: sooner or later we will get to the point where there is only one number in the column. As this number must always be the same as itself, then we are done. More on this later.
We are now ready to construct the first term of the polynomial. The column number where we stopped is the power of n. In this case we stopped at column 3, so the first term involves n^{3}. We multiply this by the value in the column divided by the factorial of the column number. (A "factorial" is the product of all the integers from 1 to that number. For example, 5 factorial -- which is written "5!" -- is 5 x 4 x 3 x 2 x 1 = 120.) The value in this column is 6 and 3! is 6, so our first term is:
6 / 3! x n^{3}
= 6 / 6 x n^{3}
= n^{3}
Now we evaluate this term for 1, 2, 3, and so on, and subtract each result from the corresponding starting value.
We started with value #1 was 2. So we plug 1 into n^{3} = 1^{3} = 1, then subtract this from 2, 2 - 1 = 1.
Value #2 is 8. So we plug 2 into n^{3} = 2^{3} = 8. Subtract this from 8, 8 - 8 = 0.
We proceed thus through all the values:
Original - n^{3} | |
---|---|
1 | 2 - 1^{3} = 2 - 1 = 1 |
2 | 8 - 2^{3} = 8 - 8 = 0 |
3 | 9 - 3^{3} = 9 - 27 = -18 |
4 | 11 - 4^{3} = 11 - 64 = -53 |
5 | 20 - 5^{3} = 20 - 125 = -105 |
We create a new table from these values, calling these our new column 0. Like so:
0 | |
---|---|
1 | 1 |
2 | 0 |
3 | -18 |
4 | -53 |
5 | -105 |
Now we go through the same process as we did for the first table.
0 | 1 | 2 | |
---|---|---|---|
1 | 1 | ||
-1 | |||
2 | 0 | -17 | |
-18 | |||
3 | -18 | -17 | |
-35 | |||
4 | -53 | -17 | |
-52 | |||
5 | -105 |
Applying the same rules gives our second term:
-17 / 2! x n^{2}
= -17/2 x n^{2}
Note that this table was completed in fewer columns than the first table. That is, the first table ended with column 3, while this table ended with column 2. Every table must end with fewer columns than the previous table. If that doesn't happen, you have made an arithmetic mistake. (Otherwise you could get two n^{3} terms or whatever, which doesn't make sense.)
Again we plug the successive integers into this term and subtract from the starting values. Note we subtract with the values that we started with on this table -- we don't go back to the original values. Note that we are subtracting a negative, which is the same as adding a positive.
Original - -17/2 n^{2} | |
---|---|
1 | 1 + 17/2 1^{2} = 1 + 17/2 = 19/2 |
2 | 0 + 17/2 2^{2} = 0 + 34 = 34 |
3 | -18 + 17/2 3^{2} = -18 + 153/2 = 117/2 |
4 | -53 + 17/2 4^{2} = -53 + 272/2 = 83 |
5 | -105 + 17/2 5^{2} = -105 + 425/2 = 215/2 |
We build a new table with these values and go through the whole process again:
0 | 1 | |
---|---|---|
1 | 19/2 | |
49/2 | ||
2 | 34 | |
49/2 | ||
3 | 117/2 | |
49/2 | ||
4 | 83 | |
49/2 | ||
5 | 215/2 |
Giving our next term as:
49/2 / 1! x n^{1}= 49/2 n
Plug integers into this term to get the next table:
Original - 49/2 n | |
---|---|
1 | 19/2 - 49/2 x 1 = 19/2 - 49/2 = -15 |
2 | 34 - 49/2 x 2 = 34 - 49 = -15 |
3 | 117/2 - 49/2 x 3 = 117/2 - 147/2 = -15 |
4 | 83 - 49/2 x 4 = 83 - 98 = -15 |
5 | 215/2 - 49/2 x 5 = 215/2 - 245/2 = -15 |
Building another table and following through the process yields the simple result:
0 | |
---|---|
1 | -15 |
2 | -15 |
3 | -15 |
4 | -15 |
5 | -15 |
This is simple, of course, because column 0 already contains all the same value, so we are quickly done.
This gives a final term of:
-15 x n^{0}= -15
(Recall that any number to the zero power is simply one, and can be dropped from the expression.)
Once we get a table that is complete in the zero column, we are done. So now we put all these terms together to get the full equation:
n^{3} - 17/2 n^{2} + 49/2 n - 15
To check, try this on each value:
Original | Formula | |
---|---|---|
1 | 2 | 1^{3} - 17/2 x 1^{2} + 49/2 x 1 - 15 = 1 - 17/2 + 49/2 - 15 = 2 |
2 | 8 | 2^{3} - 17/2 x 2^{2} + 49/2 x 2 - 15 = 8 - 34 + 49 - 15 = 8 |
3 | 9 | 3^{3} - 17/2 x 3^{2} + 49/2 x 3 - 15 = 27 - 153/2 + 147/2 - 15 = 9 |
4 | 11 | 4^{3} - 17/2 x 4^{2} + 49/2 x 4 - 15 = 64 - 136 + 98 - 15 = 11 |
5 | 20 | 5^{3} - 17/2 x 5^{2} + 49/2 x 5 - 15 = 125 - 425/2 + 245/2 - 15 = 20 |
To find the next value in the table is now simply a matter of plugging 6 into the formula:
Original | Formula | |
---|---|---|
6 | ? | 6^{3} - 17/2 x 6^{2} + 49/2 x 6 - 15 = 216 - 306 + 147 - 15 = 42 |
And we see that the answer is the near-mythical value, 42.
As I noted earlier, a table is complete when all the values in a column are the same. If you come to a single value in a column, then it is the same as itself, and the table is complete. Mathematically, this is a perfectly valid solution. But if this happens, it should introduce some doubt into your mind. Do the numbers really follow some pattern, or am I just coming up with a formula to fit a set of random numbers? It is, after all, possible to come up with a formula for any set of numbers. The fact that this technique works should demonstrate that: pick any set of numbers, run them through this method, and you will get a formula to describe them. If you get to a column with two or three numbers the same, this is a good indication that there really is a pattern described by this formula. You would be unlikely to get such a result by chance.
Note this also illustrates the fact that any problem asking "what's the next number in this sequence" has an infinite number of possible answers. If someone gives you the sequence, say, "1, 4, 9, 16", you could run them through the above process and get the answer that the person is probably looking for: the rule is n^{2} so the next value is 25. But you could also invent any number as the next number in the sequence, say 42, and come up with a rule for "1, 4, 9, 16, 42". Feel free to work it out. It comes out to:
17/24 n^{4} - 85/12 n^{3} + 619/24 n^{2} - 425/12 n + 17
and the next term is then 121.
So if you want to be obnoxious, the next time you are given a quiz of "find the next number in the series" problems, just pick any number you like and fill it in, and you'll be completely correct. You'll probably get a failing grade on the test, but you can enjoy the smug satisfaction of knowing you were right.
In the above discussion I've been assuming that all numbers were exact. For a math problem, this would normally be the case. But if you've gotten a set of numbers from real-world measurements, there is probably some margin of error on your measurements. In this case, you run into an additional problem: If two numbers look close, are they equal within some margin of error? Or are they really different? And if you do consider them equal, what value do you use when you proceed to the next step?
I've tinkered with setting a margin of error, for example, differences less than .001 are considered insignificant, and then averaging the numbers together to go to the next step. I haven't found any solution better than trial and error for selecting the margin of error. If the next table does not end in fewer columns than the previous, then the margin of error was not correctly chosen. Perhaps there is something more rigorous one could do here; I haven't pursued it.
While I haven't constructed a formal mathematical proof that this works, the principle is simple if you know a little calculus.
When we take the difference between pairs of values, we are, in effect, finding the derivative. You may note that the value you get is the derivative at some value in between the two values where you took the difference. That is, when you take the difference between the Y values corresponding to X values of, say, 2 and 3, you get the derivative at some X between 2 and 3. Not necessarily 2.5, but between 2 and 3.
When you continue taking differences until you get a constant, this is the equivalent of taking derivatives until you get to a constant function.
So for example, suppose the equation is y=2 x^{3} + 3 x - 7. (Of course the whole point is that we don't know that initially, but let's suppose that's what it is.) So as we take successive differences, we get:
Column | Equation |
---|---|
0 | y = 2 x^{3} + 3 x - 7 |
1 | y' = 6 x^{2} + 3 |
2 | y'' = 12 x |
3 | y''' = 12 |
Thinking backwards, then, we see that when we reach a constant, the column number must be the highest power in the original equation. Each time we take a derivative, we multiply by the exponent, so if we take derivatives all the way to a constant, we will have multiplied by all the integers from 1 to the original power, that is, by the power factorial. So when we get to a constant row, we know that the first term in the original equation must have been this constant times x to the column power divided by that power factorial, that is, if k is the constant and p is the column number, the first term must have been (k / p!) x^{p}. In this example, the final column would be column 3 which would contain all 12's. We get (12 / 3!) x^{3} = (12 / 6) x^{3} = 2 x^{3}. Which indeed is the first term.
If we substract this value from each of the original Y's, then we are effectively dropping the first term from the equation. If we run through the whole process again, this should find us the second term. Etc.
Of course, I don't expect you to do all this arithmetic yourself. That's what computers are for.
So I've written a little program to do the work for you.
© 1999 by Jay Johansen
Fiaz Dec 3, 2010
Thanks for your excellent article at http://www.johansens.us/sane/technotes/formula.htm
I couldn't really understand why this works.. but I could follow through your argument and solve for any future such cases.
For your reference, I also happen to see a very concise and sweet method in here..
http://www.teachers.ash.org.au/mikemath/numseqfindiff/note2.pdf
which works nicely and to the point.
The method is certainly similar to users, and again I couldn't really understand the theory behind why it works.
Thanks & Regards
Fiaz
Walter Jan 27, 2011
Take a look at ... http://en.wikipedia.org/wiki/Difference_engine#Method_of_differences
A nobody called Isaac Newton has invented this method (^_^)
Jay Johansen Feb 18, 2011
It would be easy enough to increase the number of input fields on the screen. The logic would be the same. But 15 seems like a very large number.
This program finds the simplest polynomial formula that will generate the set of numbers that you give. That is, formulas in the form a + b x + c x2 + dx3 + e x4 ... (Where x2 means "x squared", x3 means "x cubed", etc. No superscripts in text email.) The highest exponent term it can generate is one less than the number of values you entered. That is, if you enter 10 values, it could come up with a formula going up to x to the 9th power. With 15 values, it can go up to x to the 14th power. If the set of numbers you give really requires a polynomial going up to the 14th power, well, I guess it depends what you're doing, but that's a very complicated formula. If, say, you're using numbers from a physics experiment and trying to find a formula to relate them, the odds are that the real formula doesn't go to the 14th power. This program doesn't allow for experimental error, it expects all numbers to be exact. Maybe some day I'll make a version that lets you enter some sort of margin for experimental error.
Anyway, my point is, try entering the first 15 numbers from your set and see what formula you get. If it really goes up to the 14th power, you probably have a set of numbers that cannot be described by a polynomial. They may be describable by some other sort of formula, a logarithm or trig function or some such. Or they may be just a bunch of random numbers.
Azick Feb 27, 2011
Sir, I am writing from Cameroon. I write to appreciate your effort of developing a very good program, How to Find formula for a set of Numbers. For I have been searching for such a program until this day that I found this one.But Sir, you limited the program for whole numbers and fractions formula to only 15 numbers.That means only the formula for 15 numbers and not more can be obtained after clicking on poly me Sir, I also write to inquire if you have any latest update for the program especially with regard to finding the formula for more than 18 numbers or so or between 18 to 25 numbers.Thanks
Terry Apr 22, 2011
I googled and found your site tonight for solving a sequence. I had a table with 4 sets of numbers, x and y, with x values starting with 1 and ending with 4. Your method helped me find the formula, which was a 3rd degree polynomial, not fun. Well, I think I have seen this method before. Have you been told any other sources for it? I have taken History of Mathematics. Maybe it was in that class. But your method saved the day - it was the only one that showed up in the search engine.
I was helping a poor College Algebra student who was given the table and asked whether it was proportional. We should have just plotted it to see that it wasn't linear (and/or didn't go through the origin). But I got stubborn and had to find the formula. It was a good exercise. Thank you for posting it.
Have a nice weekend.
Columbus State University
Columbus, Georgia
Nick Jul 28, 2011
Very interesting work. Brilliant. Thanks for sharing. Has anyone ever discussed your method ? Has it out there before you discovered it ?
Nick
Cincinnati, Ohio
Jay Johansen Jul 29, 2011
I really need to update my page. It turns out that this technique was invented by a little-known mathematician named Isaac Newton. I guess if you're going to come in second to someone, Isaac Newton isn't a bad person for it to be. Also, he didn't create a web page to implement it. :-)
Nick Aug 7, 2011
Well, I guess you are in good company. You should create an algorithm for data analysis. Just tweak the web page code to analyze data for signals (formulas). That awesome technique has to have some commercial/scientific application. I might write some C++ code for the technique.
Chris Sep 6, 2011
I found your site and have found it immensely helpful with a project i have been working on for a while.
It is essentially the same formula program you have made, except its designed to analyse multiple columns of data to get the equation, similar to BACON1. The version im working on is also designed to calculate it in terms of other mathematical functions (such as sin, mod, log, sqrt, etc). I was wondering if you would be willing to give me a hand with it or any resources i could use for aid.
Jay Johansen Sep 8, 2011
Expanding to other types of equations is an obvious next step. It also seems like a fairly difficult next step. Do you have a plan for how to do it? You could always do it by trial and error, i.e. have a list of functions and try each in turn until you get something that seems to work. Off the top of my head I don't know what you could do that would be better, but, well, there should be something. Trial and error would make it very difficult to discover a formula like y=sin x / x + ln x - x^2.
Curtis Sep 12, 2011
I recently view your website regarding your systematic computation of polynomial formulas. One issue I wanted to mention is that it incorrectly maps all functions to polynomials. For example the function n! which is NP and cannot be mapped to a polynomial, but in your website it is mapped to a polynomial in your program. There should be a quick check in place to see if the sequence grows at a rate faster than polynomial speed (i.e. n^k as k->some constant exponent value). Another example is 2^x...
The idea of subtracting numbers in a sequence to obtain the terms has been done many times, however your website does it quite nicely! However, your algorithm is inefficience and I wanted to help you out but giving you a suggestion to improve your solution. If you can "guess" the highest order term, simply by looking at the terms and seeing how each term relates to index i... you can guess the highest power this way. Then compute f(n)/n^highest power. If this value approaches a constant, you have correctly guessed the highest power. If it approaches 0, the power you have guessed was too high (you should guess again with a lower power), and if it approaches infinite the power you guessed was too low (guess again with a higher power). You can use this information to determine whether you need to revise the power you guessed or not. MOST IMPORTANTLY, when it approaches a constant, the value that it approaches is the constant which is multiplied by the highest power (i.e. f(n)/n^2 (assuming 2 is highest power) if computing this sequence seems to approach 5, then the first term in the function is 5n^2).
This is a much more efficient algorithm. Computing this way would allow you to compute hundreds of terms instead of just 15 on your site, as long as your server speed was fast enough, which in today's standards, is definitely not a problem.
Keep up the good work and enthusiasm!
Jay Johansen Sep 13, 2011
Hmm, I don't know how you can say that my algorithm "INCORRECTLY maps all functions to polynomials". How can you say that my mapping is incorrect? It derives a polynomial that generates the given set of numbers.
Consider the series 1, 2, 6, 24. Yes, this series could be generated by the formula y=x!
This program generates the polynomial y=11/6 x^3 - 19/2 x^2 + 50/3 x -8. The first four terms of this polynomial are, in fact, 1, 2, 6, 24.
11/6 (1)^3 - 19/2 (1)^2 + 50/3 -8 = 11/6 - 19/2 + 50/3 - 8 = (11 - 57 + 100 - 48) / 6 = 1
11/6 (2)^3 - 19/2 (2)^2 + 50/3 (2) - 8 = 88 / 6 - 76/2 + 100/3 - 8 = (88 - 228 + 200 - 48) / 6 = 2
Etc.
Both formulas generate the same set of numbers. Therefore, both are correct solutions to the problem. The fact that you may have come up with the sequence by using the factorial function doesn't make that the "correct answer". There's no way for the computer to know what you were thinking when you typed in the numbers.
Indeed, there are an infinite number of equations that could generate any given sequence. We could also generate this sequence with
y= (-x^4 + 32 x^3 + -149 x^2 + 250 x - 120) / 12
Or
y = 2^x (2-x)(x-3) (x-4) / 12 + 2^x (x-1)(x-3)(x-4) / 4 + 3 cos(x-3) (x-1)(x-2)(4-x) + 24 ln(x) (x-1)(x-2)(x-3) / ln(4)
As I stated on the web page, "What this technique finds is the simplest polynomial that fits the numbers." For any given finite list of numbers, there are an infinite number of possible rules or formulas to produce that list. For every new value added to the list, we could eliminate some of these possible formulas, but there will always be an infinite number.
I absolutely agree that an algorithm that could find trig functions and exponentials and logs and so on would be cool. But to derive this from a finite set of values would not be possible with a determinitive algorithm, i.e. there would not be a single correct answer. Intuitively you would want the "simplest" answer, i.e. "3x sin(x)" should win over a ten-term polynomial. But simplicity in that sense is difficult to even define mathematically, never mind implement with an algorithm.
The 15-value limit is not imposed by the power of the computer, but was simply an arbitrary choice. The intent when I created this web page was that it would be used with empirical data. If it can't find the right equation with 15 terms, the odds are that what you are looking for is not a polynomial, but a trig or log or some other formula.
Anyway, thanks for the comments.
Curtis Sep 14, 2011
That is a great explanation and definitely makes sense.
I was rude and tactless to say "incorrectly," and also the lack in clarity is on my part. My meaning in saying incorrectly, is that such a deterministic approach lends itself only to polynomial solutions. IT IS possible to fix this and it is not difficult. If you compute the solution using the method of dividing by the greatest power, than you will have the speed to compute two functions and compare them to find which one is "simpler" i.e. less terms. The first function is a polynomial guess (which you can compute efficiently using the method in the last email) and the second function is a NP guess of fairly simplistic forms such as a^x or n!. Here is how to write the function for NP guesses.
To find 2^x functions and factorial functions, the trick is to simply try dividing by f(n-1) for all functions which grow faster than polynomial time. That will do the trick. Dividing by f(n-1) maps n! to n and a^x to a allowing you to get a quick clear solution which you can output extremely efficiently. By comparing this solution with the polynomial solution, you can output whichever has least terms with a very quick comparison.
My reason for suggesting that what you have is incorrect is based on the following. If a user inputs 2 4 8 16 32 64 128 256 512.... up to the 15th digit, and you output a 16 term polynomial, I can't find any good argument to say that anyone realistic person would suggest that a 16 term polynomial solution is any good to them. Relative to a simple output of 2^x, it is of no value. I agree completely that you can find infinite functions which fit discrete values, NO ONE will dispute that point. But we all know a basic intuition of why we write programs... we write them to be useful, to aid us, and to solve problems. An extremely long polynomial solves the problem for a machine, but as humans, it is not useful and it does not aid us when a solution such as 2^x exists and can be obtained extremely quickly simply by checking the case when f(n)/f(n-1) and taking the limit as n->infinite. When someone enters 15 digits they are generally suggesting a pattern for a well described function, not simply an exuberant polynomial which somehow fits the digits. Its all about the point of the writing the program in the first place. If its point is just to map all discrete sets to polynomials than it is perfect. You just asked those with suggestions to comment, and I wanted to help you out by showing you a very quick adjustment that would make it cover a much greater range of functions, be more versatile, become more efficient and faster, and in the case of NP problems, give the correct answer.
Your website is awesome. I wouldn't take the time to write this if you didn't have my respect.
Vanderhoof Oct 31, 2011
I am writing you today in reference to an article you wrote, "How to Find a Formula for a Set of Numbers". I was intrigued by the idea of formulating a polynomial from a table of values and was very pleased to see that you had developed a method for this. I noticed, however, that you had not written a mathematical proof at the time (as you stated on the webpage) and I was wondering if you had written one since then or if you had been informed as to whether or not anyone else had written one. I am currently involved in the mathematics education department at the University of Central Florida and, since I plan on sharing this technique with my colleagues, I would love to have a proof to share as well (if available). Thank you for your time and I look forward to hearing from you.
Jay Johansen Nov 1, 2011
I'm told that my technique is essentially the same as one developed by Isaac Newton, which is called his "method of differences" or "method of divided differences". I just haven't had the time to investigate this but frankly I would have been surprised if someone hadn't figured out this basic technique before me: it's pretty obvious. (Bummer! Newton beat me by only 300 years!)
In any case, the concept behind it is this: When you take the difference between "adjacent" values, you are finding delta-y for delta-x = 1 for a series of x values. You are in effect finding the derivative. For example, say the function is actually x^2 + 1. (The whole idea is that we don't know this starting out, but let's assume this for purposes of discussion.) So our initial table would look like this:
x f(x)
1 2
2 5
3 10
4 17
Now we find the differences
x f(x) f'(x) f''(x)
1 2
3
2 5 2
5
3 10 2
7
4 17
The f'(x) of itself isn't much use, because we don't know what the x values are. We know that f'(x) is 3 for some value of x between 1 and 2, but we don't know what value. (In this case it's halfway between, 1.5, but in general it's not that simple.)
But when we get the f''(x) column, the f'' value is constant, so it doesn't matter what x is, it applies to all x.
So now we know that f''(x) = 2. From this we can deduce that f'(x)=2x+C1 and f(x)=x^2 + C1*x + C2.
In general if the constant term ends up as some value n, and the constant is in column p, then the high-order term is n/p! * x^p.
If we subtract x^2 from each f(x) value, we can then run through the same procedure to find C1. Then we do it all again to find C2.
I realize this is a long way from a formal mathematical proof, but that was the concept. I must admit that I'm just not quite sure how to get from where I am to a real proof. I've never really sat down to try to work it out. I'm a computer geek and not a mathematician, so I was approaching this from more of an engineering perspective: I didn't need a formal mathematical proof, just some logic that sounds plausible and that works when I try it with a variety of data. Sure, this kind of thinking often gets non-mathematicians into trouble: without a formal proof, you can't be sure that it works 100% of the time. There may be special cases. Or for that matter the cases you tried may turn out to be the small number of special cases where it works.
Hmm, just thinking about it now, it occurs to me that the casual thinking I've done about it so far has been trying to go from the differences to the polynomial. But it occurs to me that a more productive approach is probably to go from the polynomial to the differences. That is, if the high order term is ax^n, then we can readily demonstrate that the n-th derivative of f is a*n! . So all that remains to prove is that the n-th column of differences are equal to the constant term of the n-th derivative. If I just worked on this a little I might come up with an actual proof.
Chris Nov 13, 2011
I wasn't quite sure. I was thinking of having a set of functions to test in sequence (of all available data) in each possible format. There would be constants that can be adjusted later, but this stage is designed to try and discover the function for the change, then after, the constants can be adjusted to get it to line up.
It sort of is trial and error, but if a list of suitable tester functions for each element could be assembled, id imagine it could get quite close, maybe find multiple equations for the same outcomes. I recon it would be very similar to the keplar program.
Ashley Feb 10, 2012
I like your website, it's informative. I also tried to use the sequence program and got a huge string of numbers. Maybe you could help me decipher them?
Okay so I typed in a string of 'random' numbers and this is what I got ( was just looking for the next in the sequence):
Final Answer
y = -6169/3228825600 x14 +2045782776184849337/1438777253582157824 x13 +47339270785488829/285103675391207424 x12 -66956796112409307/7879453435756460032 x11 -1345146413511675721/3716083674335348736 x10 -1265383237270535869/1768146741225617408 x9 -103110904635775/1246640676310390784 x8 -12351101043369721/920856574319114240 x7 -28875337419760317/7407460916899644928 x6 +11189711754560527/563704541018865536 x5 +31419522614634823/572908877914485888 x4 -128727978105837323/829860257916322176 x3 +126147133537779719/130875669076421728 x2 +2482680522399570425/516821091708297996 x +433999830631005724/155278720400261061
Jay Johansen Feb 11, 2012
If you type in random numbers, you'll get essentially random output. Assuming the program is working this function should generate the sequence of numbers you gave. Verifying it would be a pain.
You might try it with shorter, more carefully chosen set of numbers. Like put in 1, 4, 9, 16 and see if it says this is x^2, etc.
Ashley Feb 14, 2012
Well, I took the sequence of numbers from a random number generator. Seeing how its a computer function i thought it couldn't actually be random. I guessed using your program could maybe show the pattern ? Apparently not. Is it possible to figure out how numbers are selected through a random number generator using a produced string of numbers? Just curious.
Jay Johansen Feb 14, 2012
My "function finder" wouldn't uncover the algorithm behind any computer random number generator that I know. My function finds polynomials, and computer random number functions tend to use recursive functions and twiddle bits, which would obscure any polynomial.
Yes, it is true that computer random numbers are not random in the same sense that a die roll is random. They are often called "pseudo-random".
Are you wondering how computer random number functions work in general, or how one works in particular?
If the former: The random number function used by Java is pretty typical.
Each random number is generated from the previous random number. It takes the previous number, multiplies by 25214903917 and adds 11. Then it calls another function that I don't have the source code for but I think it's just preventing getting the same number twice in a row. Each request for a random number specifies how many binary digits it wants, so it peels off the first however-many digits and that's what it returns. Then this number (the full number, not the peeled-off digits) is saved to use the next time around.
To get the first number, when you have no "previous", the calling program can set a value. Programmers sometimes do this when testing so they can get the same series of numbers for each test. Normally, though, it uses the number of nanoseconds from the current time as the starting value. I just noticed that Java carefully adds 1 to this each time you create a new random-number sequence, so if you create two random number sequences within one nanosecond they'll get different starting values.
rovingrover Mar 23, 2012
I am contacting you regarding your method of calculating differences between polynomial terms as I too have done work on this area, though with a different approach and not as in depth. I, also was not able to find any demonstration of this work in other places, though would be highly interested in finding out if you find some professional work on this topic. I am currently a high school equivalent student to give you some perspective. I think a formal would proof would be showing that the nth derivative of x^n simplifies to x!, try it for yourself.
Interestingly this may, with a little adapation, work for non integer n by means of an infinite series, [note to self gamma function?]. Your blog has just given me a little eureka moment!
Thanks for the entertaining article, and please contact me if you find a more in depth explanation of this, though I fear it may be too simplistic to be considered in great depth.
Atanas Oct 11, 2012
I remember learning this formula from a math club instructor back in high school. Then I forgot it and I needed it to solve a problem in one of my classes. I gave up on finding the formula and then today I stumbled across your website where you said you derived this yourself and you were interested in knowing if anyone else had either so I guess I'm just emailing you to say thanks for putting that up and that I have seen it before and it's probably my favorite mathematical trick so....thanks again!!
Ed Feb 1, 2013
Thanks for posting this.
I am considering the use of your Formula Generator for an certain application where the numbers inputted represent specific incremental bioenergetic microfrequencies-representative of disorder in a chaotic system.
My query:
I am trying to understand how the formula derived might be understood to represent a harmonic relationship between the individual numbers of increasing values. Should such a relationship be conceivable as such.
I am also interested in knowing which process,or variable, would bring the established formula to zero (theoretically neutralizing the entropy represented by the values)
I am obviously attempting to find a numeric value which stabilizes the disorder.
Your thoughts are very much appreciated.
Many thanks for your time,
Jay Johansen Feb 2, 2013
Short answer: This program will find the simplest POLYNOMIAL which generates the given set of data. I don't want to overstate what it does. If the "true" formula is a harmonic or trigonometric or some such, this program won't generate n^-1 or sin n terms -- it will still generate a polynomial, the polynomial that gives the best fit to your data.
People have occasionally suggested that I extend the program to handle a wider variety of functions. I agree that would be cool, but barring a brainstorm on how to do it easily, that would be a much more complicated project, one that I'm not likely to do in my spare time.
I'm happy to chat with you about how to find solutions for the more general case, but that's about all I can say.
Best of luck! :-)
Tony Jun 5, 2013
My greatest of compliments on your program. I have been using your website to introduce students to linear regression and Taylor/Maclaurin as a tutor for years now. I was wondering if you might be selling "polyme" the program as a stand-alone program that wouldn't require Internet access. If you aren't, again, my greatest of compliments and thanks for the instructive resource that I've been using all of these years.
Stephen Jul 28, 2013
I absolutely LOVE your page on a formula for any set of numbers. i've long wondered about that sort of thing and eventually i found your page after attempting to research such a thing on the internet. I know it's been several years since you made the website, look at the page I think it's been 15, but you updated it 5 years ago if I'm not mistaken. However, I'm very interested in computer science now, and I'm going to be a freshman at a university in North Carolina in the fall, so I'm wondering if there's any chance you would mind giving me access to your page, or spreadsheet, whatever it is that you used to create that program which does the math for you. I understand this is a big request, which is why I'm asking you. I've begun to try to emulate the process you describe, using my limited (though rapidly improving) knowledge of excel, but I can't even get the if-then statements to work :(
anyway, I'm hoping to hear from you soon, and have a great day and thank you for your marvelous work!
ali shahzad Oct 24, 2013
Dear Mr. Jay,
Hope you will be fine and enjoying some great work.
I would like to convey my special thanks to you for such a nice program for generating equation for numbers.
For my M.Sc Engineering in mechanical design thesis work, I have established a equation from your written online program.
This program helped me a lot.
Well done.
Jonah Dec 22, 2013
I came across your "How to Find a Formula for a Set of Numbers" webpage and was intrigued by it. I've done the same thing many times myself; in fact, in 6th grade, this is essentially what our teacher taught us to do. I'm sure you've been told this before, but do you realize that you essentially recreated Taylor Series??
It's quite cool.
Thanks for the fun!
satdeep Jan 30, 2014
I found your "How to Find a Formula for a Set of Numbers" webpage very useful. But I have a small confusion. While generating the formula, especially for your data, 2,8,9,11,20,... you came up with a step like this,
6 / 3! x n3
= 6 / 6 x n3
= n3
I don't know what 'x' and 'n' indicates. Because, in this webpage you finally ended up with the formula,
n3 - 17/2 n2 + 49/2 n - 15
But, if I use your computer program 'Poly Me', the formula comes like this,
y = +1 x3 -17/2 x2 +49/2 x -15
Please clear my confusion.
Jay Johansen Feb 2, 2014
Okay, I was inconsistent. "x" and "n" are the input variables. The letter doesn't really matter. Whether you write y=3x+5 or q=3n+5, it's the same formula.
To take that example, if I plug in x=1 I should get out y=8. If I plug in x=2 I get out y=11. Etc.
satdeep Feb 2, 2014
Thanks for clearing my doubt. I appreciate.
lalit bhardwaj Feb 20, 2014
thanx for this formula.......... pls.send all formula my mail ID . THANKU
just click this Mar 7, 2014
This site inspires me everyday, you should update it more often
Totardo Tobing Mar 19, 2014
Wow thanks... Your program works.... I wish that you write your explanation with a simpler example Sir. Just for a guy like me can follow/understand. For instance: 3,5,9,15
But anyway really thankful for this great work, thank you
Jay Johansen Mar 20, 2014
3
5 -> 2
9 -> 4 -> 2
15 -> 6 -> 2
So first term is 2/2! x ^2 = x^2. Subtract that from each term ...
3-1=2
5-4=1
9-9=0
15-16=-1
Then run thru again ...
2
1->-1
0->-1
-1->-1
so second term is -1/1! x ^ 1 = -x. Subtract that from each term -- remember minus a minus is a plus.
2+1=3
1+2=3
0+3=3
-1+4=3
So last term is 3/0! x^0 = 3.
Putting that together gives x^2 - x + 3.
Check it:
f(x)=x^2 - x +3
f(1)=1-1+3=3
f(2)=4-2+3=5
f(3)=9-3+3=9
f(4)=16-4+3=15
Hooray!
Totardo Tobing Mar 22, 2014
Lots of funn,, thank you Sirrrr, God bless
Johnd611 May 19, 2014
This website is mostly a walkby for all the info you wished about this and didnt know who to ask. Glimpse right here, and also youll undoubtedly uncover it. bcdfdeedeged
Andrew May 21, 2014
Wow! Thanks for this in-depth explanation! Really great method.
I've tried implementing this method in Python for my own interest, however I was unable to get it working correctly on the last few steps.
Is there any chance that you would be able to provide the source code to your program?
michael kors black ion May 25, 2014
Just to let you know, this post looks a little bit odd from my android phone. Who knows maybe it really is just my cell phone. Great post by the way.
Morteza Oct 17, 2014
Hi. I'd like to translate this article into Persian.
Do you allow me to do that?
All your rights will be reserved..
Answer me via Email.
Ehab saber Dec 17, 2014
what is the formula of :
19, 17, 12, 11, 19, 18, 43
in seq 1 : 7
William Bouris Apr 8, 2015
I used Poly Me, the program, and it worked wonderfully. You have a great website. Thanks, again! Bill
Caitlin Apr 28, 2015
I wanted to mention that this would not be a good method to find the formula for a sequence of real world data. Although this method would be able to fit a n^th order polynomial to the curve, and it would go exactly through all the points, it would not be much use at actually predicting other values. But for cases when you are just trying to find the next value in a sequence, this is very interesting and fine.
Jay Johansen May 1, 2015
Caitlin: Absolutely true, especially if we're talking about using my program. If you have data collected from, say, a scientific experiment, there is going to be some measurement error in there, and my program expects all the numbers to be exact. It's useful for working with MATH problems, not SCIENCE problems. This method could work for real-world data if you accepted some fudging of the numbers, like if you see a column of differences comes out to 1.9, 2.1, 1.88, and 2.02, you might way, "hmm, maybe the real number is 2" and see how it works out. I've been thinking for a long time of adding a feature to my program to allow for some error, but I've never gotten around to it.
Also, note this method will find a POLYNOMIAL, period. It wont find a trig function or a log or many other possibilities. It would take entirely different methods to find such functions.
JeremyPt Jul 9, 2015
Hello.
my name is jeremy from tanzania
nice to join this forum
q point Jul 12, 2015
I like how will it is explained. Wondering if the same concept can work a set of 3 numbers to find the answer in 3 set of numbers....
example
302-185-23
Result
100-93-124
Or a way to find the formula with the answer.
Or pluging in all questions with answers in pairs to better find formula.....
Example
X-Y-Z = A-B-C \
X-Y-Z = A-B-C > (formula)
X-Y-Z = A-B-C /
Jay Johansen Jul 22, 2015
q point: I'm not sure what you mean. What is the relationship between the two sets of three numbers? Can you explain more fully?
q point Jul 23, 2015
Hey jay.....the three sets of numbers are given as a question and i input it in a special program. Then the program will just give me an output in a set of three numbers.
Example
Input 551-69-11
Answer 534-92-105
Input 6649-13-23
Answer 2149-97-94
Input 4343-110-131
Answer 3241-95-112
Input 25651-185-2095
Answer 23228-97-124
Input 19519-50-617
Answer 18327-93-102
Input 9073-112-131
Answer 92-93-113
Input 458-38-5
Answer 341-91-99
Input 481-236-29
Answer 303-92-132
Input 302-185-23
Answer 100-93-124
Input 1769-45-59
Answer 1633-94-101
Input 791-79-11
Answer 282-91-107
Input 5767-186-211
Answer 1830-90-125
I notice that the middle number from the ANSWER is less than 99 and the third number is in the 100's.....
The three set of numbers are used to unlock cell phones. I believe that the formula uses stream cipher techniques.
My question
Is there a way to use the answer to find the formula in respect to the input question?
My example
| Input. Output | \
| Input. Output | \
| Input. Output | \
| Input. Output | / = formula
| Input. Output | /
| Input. Output | /
Use a couple of the input and outputs to find a middle point to find the formula...or plug in the technique you used above.
Samba Sep 5, 2015
my student AMRUTHA chkeced the same case with another polinomial"if (x-2)&(x-5) are two factors of a polinomial 'X cubed-aXsqured-bX+20',find the value of 'a'&'b'.in this polinomial you won't get any value of 'a'&'b'. can you find using one equation? YOUR answer will be NO.THEN think ......"
mani Oct 27, 2015
243,861,315,-what is the next numbers
okfrb Dec 5, 2015
Hondrocream .
BrendaHali Dec 12, 2015
∑분당오피【Opｙo０１。ＣoＭ】“정재형”《정보오피요》인천건마こ선릉건마フ상동건마
∑분당오피【Opｙo０１。ＣoＭ】“정재형”《정보오피요》인천건마こ선릉건마フ상동건마
∑분당오피【Opｙo０１。ＣoＭ】“정재형”《정보오피요》인천건마こ선릉건마フ상동건마
∑분당오피【Opｙo０１。ＣoＭ】“정재형”《정보오피요》인천건마こ선릉건마フ상동건마
∑분당오피【Opｙo０１。ＣoＭ】“정재형”《정보오피요》인천건마こ선릉건마フ상동건마
∑분당오피【Opｙo０１。ＣoＭ】“정재형”《정보오피요》인천건마こ선릉건마フ상동건마
∑분당오피【Opｙo０１。ＣoＭ】“정재형”《정보오피요》인천건마こ선릉건마フ상동건마
AndriaJef Dec 14, 2015
∑분당오피【Opyo01。CoM】“서지원”《정보오피요》홍대오피こ용인오피フ대전오피
∑분당오피【Opyo01。CoM】“서지원”《정보오피요》홍대오피こ용인오피フ대전오피
∑분당오피【Opyo01。CoM】“서지원”《정보오피요》홍대오피こ용인오피フ대전오피
∑분당오피【Opyo01。CoM】“서지원”《정보오피요》홍대오피こ용인오피フ대전오피
∑분당오피【Opyo01。CoM】“서지원”《정보오피요》홍대오피こ용인오피フ대전오피
∑분당오피【Opyo01。CoM】“서지원”《정보오피요》홍대오피こ용인오피フ대전오피
∑분당오피【Opyo01。CoM】“서지원”《정보오피요》홍대오피こ용인오피フ대전오피
Nick Dec 22, 2015
I am trying to use your method, or rather your calculator, to predict next year's baseball stats. Do you think it will yield useful results, or that I should look for another method? Every relevant formula in Google Sheets wants two axes, but all I have are one-dimensional lists.
Jay Johansen Dec 25, 2015
Nick: Short answer: I sincerely doubt it will work.
1. It's extremely unlikely that baseball stats follow a rigid formula. There are hundreds of factors involved, many of them very difficult to quantify objectively. I would be extremely surprised if you could come up with a formula where you plug in the year and it pops out, say, the number of home runs that were or will be hit that year. At the very least you'd have to factor in some measure of the skill levels of the players. Probably also everything from humidity on the day of the game to data about the composition of the particular ball pitched.
2. On the practical side, my program only handles functions in one variable, and makes no allowance for measurement errors in the data. It's really intended more for uses in pure math than real-world measurements. I keep saying that some day I'll add a "measurement tolerance" to it, but I haven't gotten to it.
If you actually come up with a formula that accurately predicts baseball stats in advance, I presume you can become very rich by betting on game results. Which is why people have been trying to do it for decades, and to the best of my knowledge none has succeeded.
Paul Kranz Mar 10, 2016
Jay:
My series has a formula of x(X + 1)/2. It shows how many days worth of interest is paid on a line of credit. The formula works as long as the draws are averaged and I take a new draw everyday. How can I determine the number of interest-days when I skip a few days between draws (e.g. over the weekend days when I cannot access my account to take a draw)?
Paul sends...
grad student Mar 26, 2016
It is much quicker to just use Lagrange interpolation
MarcysiaaW Apr 17, 2016
Od jutra zaczynam odchudzanie, kto sie odchudza ze mna? Znalazlam w necie dobry sposob na chudniecie, wygoglujcie sobie - xxally radzi spalanie tluszczu
vetaia May 5, 2016
can u find a formula for this sequence
1,2,2,3,3,3,4,4,4,4
Williamwew May 20, 2016
Muchos Gracias for your forum post.Really thank you! Want more. Wehbe
Solomon Jun 1, 2016
Hello Jay,
Thank you for sharing this great tool. Although i have a question for you. If i have three data and trying to find a connection between these data. e.g
Temperature of a room is determined by the time the heater is turned on to the area of the room.
A = Temperature
B = Time
C = Area of the room.
I have all three values for about 50 test conditions and they all have different values. based on this can i get a code to generate a formula that will give an accurate A value when i use any value for B or C. Thank you.
Solomon Jun 1, 2016
Hello Jay,
Thank you for sharing this great tool. Although i have a question for you. If i have three data and trying to find a connection between these data. e.g
Temperature of a room is determined by the time the heater is turned on to the area of the room.
A = Temperature
B = Time
C = Area of the room.
I have all three values for about 50 test conditions and they all have different values. based on this can i get a code to generate a formula that will give an accurate A value when i use any value for B or C. Thank you.
Jay Johansen Jun 4, 2016
Solomon: My technique as I have worked it out only handles functions of one variable. I haven't pursued multiple variables. In general, I think the way you solve such a problem is by holding one variable constant, varying the other, and seeing what kind of formula you can derive. Then hold the second one constant and vary the first.
Jay Johansen Jun 4, 2016
grad student: "It is much quicker to just use Lagrange interpolation" So ... use Lagrange interpolation. I'm not familiar with the technique. Care to post a link to a page explaining how to use it?
Jay Johansen Jun 4, 2016
vetaia: Sure: y = -1/13440 x^9 +67/20160 x^8 -1247/20160 x^7 +893/1440 x^6 -20773/5760 x^5 +34909/2880 x^4 -217519/10080 x^3 +7983/560 x^2 +761/105 x -8
I'm sure you're thinking of a rule more like, "Each number occurs as many times as that number, one one, two two's, three three's, etc."
But the whole point of my article here is that you can always find a polynomial that will generate any finite series. My algorithm finds the polynomial. There are an infinite number of ways to generate any given series. The polynomial MAY be the simplest or most logical, or it may not.
Arorneonexofs Jun 29, 2016
- SMART Media (),
WhatsApp , , .
, ,
.
:
. 21, 11
: +7 777 785 62 74, +7 707 60 77 500
Skype: alexsei-92
, !
a Nov 1, 2016
very useful. thanku
Jeff Smith Nov 4, 2016
This is fantastic, but what about a series of numerical values? For example, let's say I have to make a bridge out of plywood. The only samples I have are 5 feet, 6 feet, 7 feet, and 8 feet long. Now, assume that the bridge must be symmetrical, and that both using the pieces most similar in size and using the fewest amount of pieces is the best.
I want to find the best way to make a bridge 14 pieces long, 15 pieces long, 16.....50 pieces long. Each numerical value representing each bridge will look like (N1 N2 ... Nk), where k is the fewest amount of pieces.
14 pieces = 2 7' = (77)
15 pieces = 3 5' = (555)
16 pieces = 2 8' = (88)
17 pieces = 1 5', 2 6' = (656)
18 pieces = 3 6' = (666)
19 pieces = 2 6', 1 7' = (676)
20 pieces = 1 6', 2 7' = (767)
21 pieces = 3 7' = (777)
....
Sure, I can manually do this for up to 50 pieces, but what if I want to make a bridge 1400 pieces wide? It'd be nice to have a formula that could do this. Any ideas?
Edward Negondeni Nov 19, 2016
Hello Jay Johansen
Your program is really fantastic. It does help indeed. Can there be a way of finding a formula through this program if the given x values skip and the given y values given also skipped? Like
x:-3; 0; 3; 6; 9; 12
y: 4; 2; 0; -2; -4; -6
I struggled to get through this ordered pairs in order to find the formula. Please help!
Johnk169 Nov 23, 2016
I like what you guys are usually up too. This kind of clever work and exposure! Keep up the amazing works guys I've added you guys to my blogroll. cekgkcgebdbd
Me Nov 27, 2016
Look at the age of this thing!
Math doesn`t get old :)
Thanks for this wonderful article!
Jay Johansen Nov 30, 2016
Edward Negondeni: Sometimes, with some extra work.
Let's create a new variable, call it n. Imagine a function x=f(n), and another function y=f(n). That is, f is (1,-3), (2,0), (3,3), (4,6), (5,9), (6,12). g is (1,4), (2,2), (3,0), (4,-2), (5,-4), and (6,-6).
Run f through this method and you get x=3n-6. Run g and you get y=-2n+6.
Now you "just" need to combine those two equations to get a function that maps x to y.
In this case, we can solve f for n. n=1/3 x + 2. Then plug that into g. y=-2 (1/3 x + 2) + 6, which simplifies to y= -2/3 x + 2.
If f cannot be solved for n, it gets more complicated.
Jay Johansen Nov 30, 2016
Jeff Smith: The method described in this article isn't going to help you, as it's just not that kind of problem. It's not a polynomial. This is more like linear algebra.
I think in your examples you meant not "14 pieces", "15 pieces", etc but "14 feet", "15 feet", etc. Right? It doesn't seem to make sense otherwise. You can get 14 feet with 2 7 foot pieces, etc.
With these particular numbers, many lengths would be impossible. 9 feet, for example.
If the bridge is symmetrical, then you can have at most one length that occurs an odd number of times: one that goes in the middle.
I don't think you can solve this with a formula or equation, but you could come up with an algorithm. My thought is: take the total length. If it's odd, there must be an odd number of pieces, and the middle one must be a 5 or a 7. If it's even, we could have an odd number of pieces with the middle one having an even length, or an even number of pieces. So take all the possible values for the middle piece -- including zero. For each, divide the remaining length by 2. Find the largest multiple of 8 less than this. See if you can make up what's left with shorter pieces. If not, take the next lower multiple of 8. Etc. With a little work you could probably make it more systematic.
Dominic Jan 3, 2017
I think what you published was very reasonable. However, think on this, suppose you were
to create a killer headline? I ain't saying your information is not good., but suppose
you added a post title that makes people desire more?
I mean How To Find a Formula For a Set of Numbers - Island of Sanity is a little vanilla.
You could peek at Yahoo's front page and watch how they create article titles to grab people
to open the links. You might try adding a video or a related picture or two
to grab readers interested about everything've got to say.
In my opinion, it might bring your posts a little bit more
interesting. math solver (Jorja) Mathematics is vital in many
areas, including natural research, engineering, medicine, money and the communal sciences.
Applied mathematics has led to new mathematical disciplines
entirely, such as information and game theory.
Mathematicians also take part in pure mathematics, or
mathematics because of its own sake, with no any application at heart.
There is absolutely no clear range separating natural and applied mathematics,
and practical applications for what started out as pure
mathematics are learned often.
interested hobbyist Feb 15, 2017
I'd like to first pile on my praise to your heap of praises for your clear explanation on your site. :)
I liked it so much that i tried doing an implementation in python, which worked.. but it seems to be pretty slow the more numbers i added (which is within expectations)
however it seems your implementation on your calculator differs slightly in that your subsequent column zeros get shorter and shorter. I was wondering if anything changed in between your article and your calculator program (the one that works with fractions). perhaps that implementation is a lot faster? i couldn't get it to work at a reasonable pace once i fed upwards of 10-15 numbers.
If you like, i can send you my python implementation (which is neither concise nor very pythonic) for a look.
hope to hear from you!
Jay Johansen Feb 21, 2017
You can drop one row with each iteration. If you try it manually, or have the program dump out the results, you'll see that after the first "frame", the numbers in the last column are always the same.
Regardless, I don't see why it should be slow. My PHP program runs in a fraction of a second. I frankly don't know if PHP is inherently faster than Python, but I would be surprised if it is a huge difference. If your program is taking a long time to run, I suspect you have a flaw. You are doing the same work over and over, or maybe creating and destroying too many objects, or something of that sort.
I could take a look at your Python program but I've only dabbled in Python, I don't claim to be any sort of expert.
Paul Kranz Mar 20, 2017
I gave you
n =... desired result...
1 1
2 2
3 1
4 2
5 1
6 2
7 1
8 2
9 1
10 2... etc.
You gave me "y = +2/2835 x9 -11/315 x8 +20/27 x7 -44/5 x6 +8666/135 x5 -4444/15 x4 +486536/567 x3 -468688/315 x2 +62144/45 x -510," but the answer is
"2 - (n mod 2)." What gives?
Paul sends...
Tim Apr 23, 2017
Hey Mr.Jay Johansen,pretty impressed with the work you've done specially the coding part,would like to know if you could help sharing the code as i'd need a similar one as a part of my engineering project
Nick Jun 26, 2017
Dude. So I used your method to calculate the random sequence 1,6,13,14 and managed to get it to work. Thanks. I am sure you can imagine my pleasant surprise when I got to the 6th number :)
Nick Jun 26, 2017
Scratch that. I had grabbed to wrong cell from spreadsheet :(
Yogesh Singh Jul 15, 2017
This was really fun to try out and it helped in small sets. Thanks for posting this method.. But was trying to find out relation between nearly 20000 numbers in a column.. This would increase the power so high that polynomial calculation looks would be a costly affair for the machine. Does anyone think of any other methods?
Sherman Jul 22, 2017
I like the valuable info you provide in your articles.
I will bookmark your weblog and check again here frequently.
I am quite sure I will learn many new stuff right here!
Best of luck for the next!post-788
Raj Aug 6, 2017
Does this only work for integers? I tried it for the sequence below and got 2 n^4 terms, which, according to your explanation, should not happen
1, 27, 31, 4, 57.5
Jay Johansen Aug 6, 2017
No, it should work for any real numbers.
When I enter those values I get the formula
y = +241/48 x^4 -1241/24 x^3 +8339/48 x^2 -5005/24 x +165/2
Perhaps you made an arithmetic error somewhere? You might try my on-line program. See the link at the bottom of the article.
Jay Johansen Aug 6, 2017
Yogesh: If you are looking at real-world data, just try running the algorithm against the first 10 numbers or so. If you get a formula that looks like it might be plausible, see if it works with the remaining 19,990 numbers. The method will work with 20,000 numbers, but it could result in a polynomial with 20,000 terms, which is unlikely to be useful.
Matthewjak Aug 6, 2017
Анечка, восхитительная, с днем рождения!
И пускай великолепная осень награждает ценным золотом счастья, вдохновляющая весна - чудом нереального возрождения,
пышная зима - нежностью волшебной любви и долгожданное лето - невероятной жарой удивительной страсти!
elias aliyi haji Aug 8, 2017
this formula does not work for geometric sequence
elias aliyi haji Aug 8, 2017
for example can tell me a formula for the sequence below
2,6,36,432
elias aliyi haji Aug 8, 2017
for example can you tell me a formula for the sequence below
2,6,36,432
elias aliyi haji Aug 8, 2017
for example can you tell me a formula for the sequence below
2,6,36,432
Farmaciaeffed Aug 9, 2017
Farmacia online
Connor Nov 3, 2017
I tried this with the sequence 1,2,5,26,677 and did not get an answer that worked (the last column kept ending up as all zeroes). I'm not sure if I misunderstood it or what. Any advice?
Connor Nov 5, 2017
I tried this with the sequence 1,2,5,26,677 and did not get an answer that worked (the last column kept ending up as all zeroes). I'm not sure if I misunderstood it or what. Any advice?
Eilbron Dec 3, 2017
I believe there is problem with a program you wrote.
It doesn't calculate the formula properly.
Kandace Dec 14, 2017
whoah this blog is fantastic i really like reading your posts.
Keep up the great work! You know, a lot of individuals are searching round for
this information, you could help them greatly. message36
Patel urmit Mar 14, 2018
I have found formula for sequence. In this you use minus of terms. But we also use multiply of terms. Like 2 4 8 ... So in this formula is 2^n.your method not give this formula.you dividing term to next term so you give 2.
Alica Mar 14, 2018
Elite/throwback/authentic/replica cheap authentic soccer jerseys for you,access our site by click:
nfl shop cheap jerseys
detectiver Mar 15, 2018
Услуги частного детектива
Предоставляем полный спектр детективных услуг
Наши плюсы: Всегда озвучиваем возможности и информацию как есть, наши цены в 2-3 раза ниже чем у большинства конкурентов, огромный опыт и запас креатива, делаем то, что многие считают невозможным.
Не берем предоплат, не занимаемся высасыванием денег. Консультация бесплатно.
1. Пробив абсолютно любой информации
Пробив по мобильным системам (детализация, паспортные данные, определение местоположения)
Спектр услуг:
Сбор абсолютно любой информации о человеке
Определение местонахождения человека по номеру телефона
Детализация звонков и смс
Информация из почт и социальных сетей
Выявление факта супружеской неверности
Розыск должников
Розыск имущества должника
Розыск безвести пропавших людей
Розыск родственников и людей с которыми утеряна связь
Розыск мошенников
Проверка образа жизни ребенка
Помощь родителям (уход из дома, правонарушения, наркомания)
Услуги по выявлению фальшивых невест
Содействие адвокатам
Помощь в уголовном расследовании, сбор доказательств
Сбор компромата
Сбор информации о юридических лицах
Проверка персонала
Обеспечение анонимной связи и информационной безопасности
Контроль мобильного телефона
Защита компьютерной техники
Восстановление утерянной информации
Оказание юридической помощи
Оказание коллекторских услуг
Контакты:
+79180520135 - (телефон, viber, whatsapp, skype)
Telegram - @RFDetective
почта - RFDetektiv@gmail.com
Alma Mar 16, 2018
It is not my first time to go to see this website, i
am visiting this web site dailly and get pleasant facts from here everyday.cheap
jerseys
YhtU Mar 16, 2018
tHip
YhtU Mar 16, 2018
tHip
FerryM Mar 17, 2018
Guys, she has account on cam website i saw this hottie performing on hotbabescams.com
Valentina Mar 21, 2018
constantly i used to read smaller content
that as well clear their motive, and that is also happening with this post which I am reading at this place.cheap nfl jerseys
Keenan Mar 23, 2018
Never miss the new year popular cheap jerseys game, and come here - cheap
jerseys shop
Neva Mar 24, 2018
What is size of cheap jerseys china us may
have? Know more about here - penn state
merchandise sales
RLTjiEZgXH Mar 25, 2018
QOuiTZpMSY iOBssXeiTY PTSKXMBjyi GvCJaHjCta zChlVhxEfK TMygtwEvjZ FZxleFuZQc JuFedzPbSX kfYtuGmmHf IpacBuxKsh
probivinfo Apr 2, 2018
Пробив информации по абсолютно любым госсударственным базам, а так же банкам и сотовым сетям.
Достанем для вас информацию из баз МВД, ГИБДД, ФССП, ФМС, Налоговой, ЕГРП, Пенсионному фонду
А так же достанем паспортные данные, сделаем детализацию, определим местоположение абонента таких сетей как МТС, Билайн, Мегафон, Теле2 и достанем информацию из любых российских банков.
Так же имеем много возможностей достать информацию из баз Украины, Беларуси, Казахстана и других стран ближнего зарубежья.
Оплата в большинстве случаев после выполнения заказа, никакого обмана, не требуем предоплат!!!
Не стесняйтесь, пишите, спрашивайте, поможем, ответим на все вопросы.
Цены на пробивы от 500 руб!
контакты:
+79180589706 Алексей (телефон, viber, whatsapp, skype)
Telegram @alekseydetectiv
почта alekseydetectiv@gmail.com
alkoholrus Apr 6, 2018
Качественный алкоголь в 5 литровых канистрах с доставкой по России
Предлагаю вашему вниманию качественный алкоголь по демократичным ценам.
Доставка по всей России от 1 коробки (3 канистры по 5л)
В наличии:
Водка (Де люкс) 600руб\5л
Водка со вкусами (Виноград, вишня, грейпфрут, дыня, клюква, лимон, мята, черная смородина) 600руб\5л
Коньяк (обычный 5 звезд, шоколадный, вишневый, миндальный, карамельный, барбарис, мускат, абрикос) 600 руб\5л
Ром Баккарди (белый, черный) 650руб\5л
Текила Olmeca (золотая, серебряная) 650руб\5л
Виски Grants 650руб\5л
Наливка спотыкач (вишня с черносливом, 60% сахара) 650руб\5л
Амаретто (миндаль, вишня) 600руб\5л
Джин "Бифитер" 900 руб\5л
Абсент "Ксента" 900руб\5л
Самбука "Молинари" 900руб\5л
Ментоловая водка "Минта" Финская водка 900руб\5л
"Куантро" апельсиновый ликер 900 руб\5л
Мартини (вермут) 900руб\5л
Вино крепленое 18% (Малиновое, изабелла, вишневое) 600 руб\5л
Спирт "Люкс" 96 градусов 850руб\5л
Весь алкоголь отличного качества и постоянно проходит контроль качества.
Доставка по территории России транспортными компаниями занимает от 2ух до 15 дней.
Контакты для связи:
+7 988 3208922 Алексей (Телефон, viber, whatsapp, skype)
@Alkogolru - telegram
BrianTus Apr 9, 2018
Пробив информации по абсолютно любым госсударственным базам, банкам и мобильным операторам.
Достанем для вас информацию из баз МВД, ГИБДД, ФССП, ФМС, Налоговой, ЕГРП, Пенсионному фонду
А так же достанем паспортные данные, сделаем детализацию, определим местоположение абонента таких сетей как МТС, Билайн, Мегафон, Теле2 и достанем информацию из любых российских банков.
Так же имеем много возможностей достать информацию из баз Украины, Беларуси, Казахстана и других стран ближнего зарубежья.
Оплата в большинстве случаев после выполнения заказа, никакого обмана, не требуем предоплат!!!
Не стесняйтесь, пишите, спрашивайте, поможем, ответим на все вопросы.
Цены на пробивы от 500 руб!
контакты:
+79180589706 Алексей (телефон, viber, whatsapp, skype)
Telegram @alekseydetectiv
Amee Apr 10, 2018
It is appropriate time to make some plans for the future
and it is time to be happy. I have read this post and if I could I wish to
suggest you some interesting things or suggestions.
Maybe you could write next articles referring to this article.
I wish to read more things about it!wholesale
NFL jerseys
Petra Apr 18, 2018
Free shipping site of all cheap jerseys from china 5xl products,more items bigger discount,hurry to collect cheap nfl nike jerseys free shipping
Aisha May 3, 2018
fantastic publish, very informative. I ponder why the opposite experts of this sector don't notice this.
You must proceed your writing. I am sure, you've a great readers' base already!cheap
nfl jerseys
Igor Novikov May 12, 2018
In this example, the start date is in cell D9, and the end date is in E9. The formula is in F9. The
Louanne May 15, 2018
Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.
You definitely know what youre talking about, why waste your intelligence on just posting
videos to your blog when you could be giving us something informative to read?146832
Tanja May 16, 2018
Hello there! This post could not be written much better!
Reading through this article reminds me of my previous roommate!
He constantly kept talking about this. I'll forward this article to him.
Pretty sure he'll have a good read. Many thanks
for sharing!146832
Eloy May 18, 2018
I got this web site from my buddy who shared with me concerning this web page and now this time I am browsing
this web site and reading very informative content at this time.wholesale nhl jerseys
Lincoln May 19, 2018
It's in fact very complicated in this busy life to listen news
on Television, thus I simply use world wide web for that purpose, and take the hottest news.cheap mlb jerseys
Hwa May 19, 2018
A person essentially lend a hand to make seriously posts I might state.
This is the very first time I frequented your website
page and thus far? I amazed with the analysis you made to
create this particular post amazing. Magnificent task!wholesale nba jerseys
Isabella May 19, 2018
Every weekend i used to pay a visit this web site, as i
want enjoyment, as this this web page conations in fact fastidious funny information too.wholesale jerseys
Soon May 20, 2018
It's appropriate time to make some plans for the future and it's time to be happy.
I have read this post and if I could I wish to suggest you some
interesting things or suggestions. Maybe you can write next articles referring to this article.
I wish to read more things about it!message10
Bernadine May 20, 2018
I absolutely love your blog and find nearly all of your post's to be just what I'm looking for.
Does one offer guest writers to write content in your case?
I wouldn't mind publishing a post or elaborating on many of the subjects you write about here.
Again, awesome web site!146832
Georgiana May 22, 2018
This excellent website truly has all of the information I
needed concerning this subject and didn't know who
to ask. cheap nfl jerseys
Lucinda May 22, 2018
If some one desires expert view regarding blogging then i propose him/her to pay a quick visit this web site, Keep up the fastidious
work.36080