Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Fortran Programming Language

How Accurate is Runge-Kutta?


Hello. I'm currently investigating some strange results I'm getting in
a simulation using the fourth Order Runge-Kutta algorithm. Basically
I'm quite certain that the numerical method is to blame for some
slightly errornous results cropping up in the more extreme regions of
my simulation. However, I have just tried halving the stepsize used,
and it made no difference.

Is it possible that there are inhenrent inaccuracies in the Fourth
Order Runge-Kutta method that no matter how low the stepsize goes,
they will always be there?

Kind Regards,

Matt

Matt wrote:
> Hello. I'm currently investigating some strange results I'm getting in
> a simulation using the fourth Order Runge-Kutta algorithm. Basically
> I'm quite certain that the numerical method is to blame for some
> slightly errornous results cropping up in the more extreme regions of
> my simulation. However, I have just tried halving the stepsize used,
> and it made no difference.

> Is it possible that there are inhenrent inaccuracies in the Fourth
> Order Runge-Kutta method that no matter how low the stepsize goes,
> they will always be there?

Yes.  Runge-Kutta methods, and most other methods of this sort, assume
that the equations that they are solving have continuous solutions.  If
the true solution is discontinuous, or has discontinuous derivatives,
then you will find errors that do not decrease with the expected order
of accuracy of the method, and in some cases you will find errors that
do not decrease at all.

Furthermore, the convergence theory regarding Runge-Kutta methods
assumes perfect arithmetic.  This is not true inside a computer, of
course.  If these "extreme regions" of your simulation involve large
coefficients that nearly cancel, for example, the numerical roundoff
errors can be quite significant.  Similarly, if you have a very tiny
step size, you can also get roundoff errors that accumulate to
significant levels.

However, if the solution to your equations does, in fact, meet the
necessary continuity requirements, and there are no problems due to
numerical roundoff error, and there are no errors from other portions of
the calculation, then it is fundamentally true that in the limit as the
Runge-Kutta step size is decreased the errors will converge to zero.

(Er, right -- this also assumes that the method is in fact stable for
the relevant equation.  I believe that the standard coefficients for the
fourth-order Runge Kutta scheme are stable for very tiny step sizes
regardless of the differential equation involved, but I wouldn't swear
to it, and I presume there are also nonstandard coefficient choices that
aren't stable.)

- Brooks

--
The "bmoses-nospam" address is valid; no unmunging needed.

"Matt" <matt@hotmail.com> wrote in message

news:1177624455.861827.12070@o40g2000prh.googlegroups.com...
> Hello. I'm currently investigating some strange results I'm getting in
> a simulation using the fourth Order Runge-Kutta algorithm. Basically
> I'm quite certain that the numerical method is to blame for some
> slightly errornous results cropping up in the more extreme regions of
> my simulation. However, I have just tried halving the stepsize used,
> and it made no difference.

> Is it possible that there are inhenrent inaccuracies in the Fourth
> Order Runge-Kutta method that no matter how low the stepsize goes,
> they will always be there?

> Kind Regards,

Integral calculus is a misnomer.  If it were, we might understand how Dick
Feynman operated.  What are you integrating and over what space?
--
WW
The 1961 "Modern Computing Methods" HM Stationary Office notes for the
Runge-Kutta method (Chapter 9) that the main disadvantage is
instability The problem arises in that the finite difference equation
upon which the method is based may have an unwanted increasing
solution where the underlying original set of equations does not.

The only hope offered is to use smaller and smaller steps until a
different behaviour is found. More reasons are given in section 27 of
chapter 9.
Further methods suggested are that of De Vogelaere and the use of
Chebyshev series.

On Apr 26, 10:54 pm, Matt <matt@hotmail.com> wrote:

> Hello. I'm currently investigating some strange results I'm getting in
> a simulation using the fourth Order Runge-Kutta algorithm. Basically
> I'm quite certain that the numerical method is to blame for some
> slightly errornous results cropping up in the more extreme regions of
> my simulation. However, I have just tried halving the stepsize used,
> and it made no difference.

> Is it possible that there are inhenrent inaccuracies in the Fourth
> Order Runge-Kutta method that no matter how low the stepsize goes,
> they will always be there?

Check your code first. Take a system with known solution, then check
how the accuracy of your code changes with step size. Easy enough to
get one of the constants wrong. Halving the step size won't make a
difference once you are at the limit of your floating-point
arithmetic. You are not using "float" by any chance? Do you have any
step control based on error estimates?

You will always have problems if the function involved doesn't have
fourth derivatives (maybe fifth), or something like sqrt (x) close to
0.

And what exactly do you mean by "it made no difference"?

Terence wrote:
> The 1961 "Modern Computing Methods" HM Stationary Office notes for the
> Runge-Kutta method (Chapter 9) that the main disadvantage is
> instability The problem arises in that the finite difference equation
> upon which the method is based may have an unwanted increasing
> solution where the underlying original set of equations does not.

I believe this is true for all initial value that integrate
the solution in the direction of an undesired exponentially
growing solution.  It results in diverging solutions.
If the OP didn't go too far, it might be just enough of a
difference to seem wrong, before it really diverges.

-- glen

On Apr 26, 2:54 pm, Matt <matt@hotmail.com> wrote:

> Hello. I'm currently investigating some strange results I'm getting in
> a simulation using the fourth Order Runge-Kutta algorithm. Basically
> I'm quite certain that the numerical method is to blame for some
> slightly errornous results cropping up in the more extreme regions of
> my simulation. However, I have just tried halving the stepsize used,
> and it made no difference.

> Is it possible that there are inhenrent inaccuracies in the Fourth
> Order Runge-Kutta method that no matter how low the stepsize goes,
> they will always be there?

If your system of DE's is "stiff", you may need to go with another
type of integrator, such as one of the predictor-corrector methods.
Runge-Kutta simply does not always work. There are whole research
groups in places like Electrical Engineering or Physics departments
who work, even today, at developing better numerical DE solvers, and
they do so because they have to: for many circuit-design or power
system problems, classical methods like Runge-Kutta are just not good
enough.

Choosing a best step-size can be a non-trivial problem: if it is too
large, truncation errors are excessive, but if it is too small,
roundoff errors ruin everything. If you want really small step-sizes,
you may need to go with extended-precision arithmetic. Most numerical
analysis books or books about the numerical solution of DEs will
contain discussions of stepsize choice.

Good luck.

R.G. Vickson

On Apr 26, 3:54 pm, Matt <matt@hotmail.com> wrote:

> Hello. I'm currently investigating some strange results I'm getting in
> a simulation using the fourth Order Runge-Kutta algorithm. Basically
> I'm quite certain that the numerical method is to blame for some
> slightly errornous results cropping up in the more extreme regions of
> my simulation. However, I have just tried halving the stepsize used,
> and it made no difference.

> Is it possible that there are inhenrent inaccuracies in the Fourth
> Order Runge-Kutta method that no matter how low the stepsize goes,
> they will always be there?

> Kind Regards,

> Matt

Any explicit RK method of order higher than 2 may converge to spurious
steady-state solutions if run with fixed time stepsize.  Changing the
stepsize
during the run sometimes helps, but running with another fixed
stepsize doesnt.
If you suspect this is the problem, force the integrator to vary the
step
randomly (but within tight bounds) and see what happens.

The classical reference for this phenomenom, which is common
in long-term simulations of gradient (Hamiltonian)  systems (& also
in chaotic systems) is

J. M. Sanz Serna, Numerical ordinary differential equations versus
dynamical systems, in "The dynamics of numerics and the numerics
of dynamics", ed by Broomhead and Iserles, Cambridge, 1992.

If you suspect your method, why not pick up a tested code at netlib.org.
 I happen to have a preference for the codes on my site at
http://mathalacarte.com/.
And yes if the stepsize goes to 0, and rounding errors are not a
problem, the error should get better if you don't have other mistakes.
Halving the stepsize may not have been nearly a large enough reduction.
Fred
On Apr 27, 3:51 pm, Fred Krogh <fkr@mathalacarte.com> wrote:

But, rounding errors are always a problem, at least in floating-point
arithmetic. That's why the step-size choice problem is nontrivial.

R.G. Vickson

On 28 Apr 2007 17:37:23 -0700, "C@shaw.ca" <C@shaw.ca> wrote:

>But, rounding errors are always a problem, at least in floating-point
>arithmetic. That's why the step-size choice problem is nontrivial.

No.   Rounding is always an issue to keep in mind but it is not
necessarily a problem.
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc