Math question
category: general [glöplog]
And this is how i tested that the numbers were right, for what it's worth. f(x)
texel: Damn you, I wanted to write such a program, too. Now the project is obsolete :)
you're obsolete
OUT!
OUT!
oh shit ! Command Cyborg, brilliant ! I didn't know you could do that for 5 numbers... It reminds me a bit of some spline code.
Quote:
It reminds me a bit of some spline code.
and from interpolation, to approximation: fourier series and legendre polynomials, useful also for 3d camera keyframe interpolation (tadaaa)
kraboob: It is spline code, basically. Most straightforward way I know to do cubic splines is to do the same for a cubic polynomial x(t)=at^3+bt^2+ct+d, differentiate to get the tangent expression x'(t)=3at^2+2bt+c, set up a system of equations for the two points x(0) and x(1) and their respective tangents x'(0) and x'(1), which gives you the equation:
Which you solve for a,b,c,d in the same way, and interpolate t=0..1 with the cubic function.
Code:
|x(0) | | 0 0 0 1 | |a|
|x(1) | | 1 1 1 1 | |b|
|x'(0)| = | 0 0 1 0 | * |c|
|x'(1)| | 3 2 1 0 | |d|
Which you solve for a,b,c,d in the same way, and interpolate t=0..1 with the cubic function.
lverona, if you're after a function for a specific sequence of numbers that your guts tell you make sense somehow, but you can't figure it out (which probably isn't the case, but it's interesting anyway), try the On-Line Encyclopedia of Integer Sequences. Fun fact: neoneye has an entry there.
here, in fact.
I heard somewhere it's always possible to add a number of sines together to come very close to any sequence of numbers. The more sines, the closer you can get. Kinda the way JPEG works or something. Don't know how to find the sine frequency etc. though.
Yes, fourier transformation. It doesn't just bring you "very close", but arbitrarily close. JPEG uses DCT which is essentially the same thing (cosines rather than sines and cosines).
How about Taylor series? But I have no idea how to calculate dy/dx for a function that is defined only as some x, f(x) pairs?
Well, I've looked through formulas, wow! But again - the task is simple. There are a lot of math puzzles like that: 1,2,5,7 - what number should go next? And you have to understand what math operation or principle was used to receive that sequence.
So if I just randomly (not by a random number generator, but out of my head) write numbers, say 2,3,232,456,1007 - can there be a mathematical function or operation that satisfies it? So that one can tell the next number?
So if I just randomly (not by a random number generator, but out of my head) write numbers, say 2,3,232,456,1007 - can there be a mathematical function or operation that satisfies it? So that one can tell the next number?
Louigi: There's an infinite number of mathematical functions and operations that satisfy any sequence of numbers. The problem is finding the TYPE of function that the author of the puzzle had in mind. If you just want to solve the puzzle in a douchey sort of way, use the polynomial approach, or anything you find that's simpler.
What you'll get, technically, is the next number in a sequence that contains the given five numbers. There's not a "the next number", because there's not a "the sequence". Any number is correct depending on which of the infinitely many possible functions you pick. If you want a PRETTY solution, you need some sort of AI that understands what a pretty solution is compared to an ugly one (see: science fiction).
What you'll get, technically, is the next number in a sequence that contains the given five numbers. There's not a "the next number", because there's not a "the sequence". Any number is correct depending on which of the infinitely many possible functions you pick. If you want a PRETTY solution, you need some sort of AI that understands what a pretty solution is compared to an ugly one (see: science fiction).
It's so fun to see the mensah people so completely lost when it comes to real problems
Here is a Lagrange Polynomials Demo:
http://www.students.meduniwien.ac.at/~n0102122/miscellaneous/lagrange.zip
Input in points.txt (see example), no linebreak at the end of the file! It first displays only the points defined. To toggle interpolation, press SPACE.
http://www.students.meduniwien.ac.at/~n0102122/miscellaneous/lagrange.zip
Input in points.txt (see example), no linebreak at the end of the file! It first displays only the points defined. To toggle interpolation, press SPACE.
BUT ME WANTS TO PRESS ADOK ?!
v4nl4me: Don't you have a girlfriend? :)
YEAHR I HAVE MANY GIRLFRIENDS AND ALSO I HAVE ONE I LIKE MOST BUT THEY ALL CANT COMPARE WITH A GREAT MAN LIKE YOU ARE ADOKZ ! YOUR INTELLIGENZES ARE SUPER AMAZING !
v4nl4me: What matters is that if you want to get intelligent children, your girlfriend must be intelligent as well. Women have two X chromosomes, men just one. The intelligence genes reside in the X chromosomes. That's why an intelligent woman passes her intelligence genes to her children.
YEAH BUT DOES THAT MEAN THAT YOUR CHILDREN WILL BE DUMB?
v4nl4me: It will depend on my wife. :)
why do the functions need to be polynomal?