http://www.perlmonks.org?node_id=340656


in reply to Estimating continuous functions

I'm trying to "pull a rabbit out of my hat" here, so read this with that in mind.

My first thoughts were Runge-Kutta methods. Do a google search for Runge-Kutta. I don't know how advanced your math skills are, (and mine are a bit rusty).

But what I would try to do is try and develope a set of differential equations which describe the differences between adjacent table entries. These can be as long as you need, and can involve "higher order differentials" with linear constants. Then try to combine the equations set and maybe integrate the whole thing to get a function out of it.

It may only give you a segmented function like it's "this if between 3 and 4", and that if between "4 and 5", etc.

I'm just guessing from your limited description, but you could setup equations with elements like

w1 = w0 + a(dx/dw) + b(dy/dw) + c(dz/dw) + d(dx2/dw2) + e(dy2/dw2) + f(dz2/dw2) w2 = w1 + a(dx/dw) + b(dy/dw) + c(dz/dw) + d(dx2/dw2) + e(dy2/dw2) + f(dz2/dw2) ..etc..
where w1 and w2 etc are known values from the table. Then try to solve for a,b,d,e,f,g and integrating the whole mess. I've only shown the second order differential, but you can go as high as you need to get accuracy. ( I think the space shots use a "4th order Runge-Kutta"). That is they evaluate the velocity, rate of change of velocity(acceleration), rate of change of acceleration, and rate of rate of change of acceleration. They do this for all x,y,z. They have to account for time, and rotation of the planet too.

The Runge-Kutta method assumes you know the function to get the results. What I'm suggesting is to "reverse engineer" the equation. But that's what make computers so powerful...you can make a big sloppy list of equations to run thru to calculate a value, and the computer dosn't care.

Not that it will solve your problem, but there is a perl module for Runge-Kutta, Math::RungeKutta, here is the README The examples in the module are very cool, one is an ascii animation of plantary orbits.

The problem with solving these types of problems is the "time factor", if you think long enough on it you will eventually come to the best answer. The trouble is it may take "years of contemplation", which dosn't cut it for homework assignments. :-)


I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re: Re: Estimating continuous functions
by tilly (Archbishop) on Mar 30, 2004 at 02:44 UTC
    Your math is definitely rusty.

    Runge-Kutta techniques are useful for solving a known set of differential equations numerically. This does not give you a convenient way to figure out which set of differential equations will give you a known set of points. Worse yet, many sets of equations will give you those points, and Runge-Kutta offers you no way to decide between them.

    Thus while the similarity of certain key-words might make you think that there is a useful connection, there really isn't one.

    Sorry...

Re: Re: Estimating continuous functions
by Itatsumaki (Friar) on Mar 29, 2004 at 17:43 UTC

    Isn't Runge-Kutta a method for numeric integration of known curves? I think essentially you're suggesting to regress a high-order Runge-Kutta and then minimize the differential area. That's an interesting approach, but I suspect pretty computationally slow compared to directly fitting splines or something like that. I suspect the OP would be better off doing direct interpolation instead, especially because Runge-Kutta won't allow for extrapolation beyond predicted values.

    One other note: remember that if you try to estimate a high-order equation without a lot of input data, you can run into over-fitting problems. Most numerical techniques get much more accurate (and slower) with lots of data

      Runge-Kutta is a method for solving differential equations numerically. However, there is a mapping from integrals to differential equations, so in that respect Runge-Kutta is also a method for solving integrals numerically.

      thor