I need a little help on how does the iteration process. I know how

  • Context: Graduate 
  • Thread starter Thread starter maistral
  • Start date Start date
  • Tags Tags
    Process
Click For Summary

Discussion Overview

The discussion revolves around the iteration process of the Runge-Kutta-Fehlberg (RKF) method for solving differential equations. Participants explore the mechanics of the method, particularly how to adjust the step size and the implications of accuracy parameters.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant seeks clarification on the iteration process of the RKF method, specifically how the scaling factor 's' affects the step size and the values of the independent variable.
  • Another participant questions whether changing the step size throughout the iterations would still allow for reaching a specific endpoint accurately, raising concerns about potential overshooting.
  • There is a suggestion that if the last step would exceed the target value, it may be necessary to adjust the step size to ensure the final value is exact.
  • Some participants discuss the advantages of using adaptive RK methods with interpolation for better performance compared to fixed-step methods.
  • One participant expresses frustration with the RKF method due to the need for interpolation, which they wish to avoid.
  • There are recommendations to use existing software tools like Matlab's ode45 for implementing RKF, which includes automatic step size control.
  • Concerns are raised about the stability and accuracy of RK methods, particularly when dealing with equations that may not behave well under certain conditions.

Areas of Agreement / Disagreement

Participants express a range of views on the effectiveness and practicality of the RKF method, with some advocating for its use and others suggesting alternatives or expressing skepticism about its implementation. There is no clear consensus on the best approach to take.

Contextual Notes

Participants note that the behavior of the differential equations being solved can significantly impact the choice of step size and the overall accuracy of the method. The discussion highlights the complexity of implementing RKF effectively, particularly in relation to interpolation and stability issues.

Who May Find This Useful

This discussion may be of interest to individuals working on numerical methods for differential equations, particularly those exploring adaptive step size techniques and the implementation of RKF methods.

maistral
Messages
235
Reaction score
17
I need a little help on how does the iteration process. I know how Runge-Kutta 4 works, but I don't know how this Fehlberg one does.

So apparently the iteration goes like this:
http://math.fullerton.edu/mathews/n2003/rungekuttafehlberg/RungeKuttaFehlbergMod/Images/RungeKuttaFehlbergMod_gr_2.gif

Then apparently, the scheme requires two iterations; first would be
http://math.fullerton.edu/mathews/n2003/rungekuttafehlberg/RungeKuttaFehlbergMod/Images/RungeKuttaFehlbergMod_gr_3.gif

The second would be
http://math.fullerton.edu/mathews/n2003/rungekuttafehlberg/RungeKuttaFehlbergMod/Images/RungeKuttaFehlbergMod_gr_4.gif

My question is: what the freaking hell is this lol
http://math.fullerton.edu/mathews/n2003/rungekuttafehlberg/RungeKuttaFehlbergMod/Images/RungeKuttaFehlbergMod_gr_5.gif

As far as I understand this s thing is supposed to correct the value for h, given a value of ε.

My question are,
(1) How do I get the new value of h?
(2) Isn't this the value of h to be used in the next iteration, since I read from some texts that h is to be modified such that given a differential equation that doesn't behave very well, it's for accuracy purposes?
(3) Further, how does the value of ε really work? I know I have to enter the value of ε, and it apparently assigns the degree of accuracy, or so I've heard. But I want to understand this, really. Say for example, my tolerance is 0.84. How different is this from using a tolerance of 0.5? More accurate or less accurate?

This isn't an assignment guys, I just want something new instead of the old RK4 method that requires ridiculously small stepsizes to retain significant accuracy vs. indecently behaving equations. Needless to say, I've been using RK4 blindly with epicly small setpsize just to make sure that I get an accurate answer (which is fairly pathetic).

Thanks and more power guys! :)
 
Last edited by a moderator:
Physics news on Phys.org


I got a few stuff running in mind now, and if I'm correct, s is a scaling value;
Hnew = s * Hold; Xnew = s * Xold

My question now is this. If I continue to follow this method, my stepsize would surely continue to change assuming my function is rather ugly.

If this happens, if I assume initial values of x = 0, y = 1, and if x = 100 as the final x value, will I still end up with the exact value of x = 100 and y = whatever even if my stepsize keeps on changing? Thanks!
EDIT:

What I mean is, say for example I iterated a certain differential equation from x = 0 to x = 100. What I'm thinking is, say I'm at x = 99.72, but because of certain things, my stepsize became h = 0.45. That would cause me to get a value for x = 100.17, which is definitely not x = 100.

Or am I missing something?
 
Last edited:


maistral said:
I got a few stuff running in mind now, and if I'm correct, s is a scaling value;
Hnew = s * Hold; Xnew = s * Xold
Hnew = s * Hold look right, but I'm not sure why you want to do Xnew = s * Xold (but you haven't defined Xnew and Xold anywhere in your posts)
My question now is this. If I continue to follow this method, my stepsize would surely continue to change assuming my function is rather ugly.

If this happens, if I assume initial values of x = 0, y = 1, and if x = 100 as the final x value, will I still end up with the exact value of x = 100 and y = whatever even if my stepsize keeps on changing? Thanks!
If the final step would take you past x = 100, just reduce the final step to take you to exactly x = 100.

Often this doesn't matter. For example if you just want to plot the function, you can set the limits of the X axis of the plot to 0 and 100 and let the graphics software truncate the last line segment.

If does matter if you are integrating a function like sqrt(100 - x) that isn't even defined for x > 100.

Actually, you might want to adjust the step BEFORE the last one, if the last step would be a lot shorter than the previous steps. For eaxmple if the step size is about 1 and the last-but-one step would take you to x = 99.999, you might want to take 2 steps of about 0.5 each, rather than 1 and then 0.001.
 


Argh, nevermind, I give up. This method won't help me because I just realized that I would have to interpolate for such event, which is something I'm deliberately evading.
 


For generating tabular data with fixed interval of the independent variable (e.g. time) you should know that there exists methods that utilize the evaluations of the field made during an RK step to make interpolations with very few (or none, if I remember correct) extra evaluations. You will usually get much better performance (i.e. better global solution accuracy for a given computational effort) using an adaptive RK method with interpolation than with a fixed-step method without interpolation, but of course, the later is much simpler to implement.
 


Do you want to implement RKF? Why? Use ode45 in Matlab, which is RKF. There you have step size control and everything. (RK with fixed step size is just for academic considerations suitable. In practice, fixed step sizes are horror.) Additionally, if you have problems with an explicit solver like RKF use an implicit one like ode15s.
 


Filip Larsen said:
You will usually get much better performance (i.e. better global solution accuracy for a given computational effort) using an adaptive RK method with interpolation than with a fixed-step method without interpolation, but of course, the later is much simpler to implement.

You will usually get orders of magnitude better performance than RK (with or witout step size control) from a method that is a better match to the ODE you are solving.

The one big advantage of RK is that it rarely gives "plasubile looking but wrong" answers. When if blows up, it usually blows up big time. But it has the same defect as most finite difference methods of higher order than the ODE you are solving; the solution of the difference equations contains solutions that are NOT approximations to any solution of the ODE, and for steps bigger than some limit they are usually unstable. Step size control suppresses the symptoms, but it doesn't cure the disease.

RK is a good method for solving equations with a small number of degrees of freedom (e.g. one!) when it's not worth investing any effort to find a better way, but it's not good for much else IMO.
 


Unstable said:
Do you want to implement RKF? Why? Use ode45 in Matlab, which is RKF. There you have step size control and everything. (RK with fixed step size is just for academic considerations suitable. In practice, fixed step sizes are horror.) Additionally, if you have problems with an explicit solver like RKF use an implicit one like ode15s.

I actually have a programmable calculator for use, I just want it to have all the stuff I need. That's why I attempted to implement RKF. However I am deliberately evading interpolation, because, even though a weird reason, it gives me the hassle of interpolating everytime i need an answer for some value which is what I really don't like.

I however still wanted to pull out RKF45 properly, however my values explode to gazillions after trying to replicate it in Excel. God I'm horrible. I'm trying to practice now, but if I can't still pull it off correctly I might need your help guys.
 

Similar threads

  • · Replies 65 ·
3
Replies
65
Views
9K
  • · Replies 165 ·
6
Replies
165
Views
12K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 19 ·
Replies
19
Views
1K
Replies
3
Views
3K
Replies
3
Views
4K
Replies
10
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
2K