Itosu said:
Thank you!
And regarding errors - I should run the programm with step = H/2 and compare results, however on what basis? - I don't know the exact result that should be. Should I do it one more time and check if the results vary much?
When you use the step H/2, the result should be about 32 times as accurate (this is what O(h
5) means).
You can interpret this as that you have at least one extra digit that is accurate in your result.
So all the digits that are the same in both results will be presumably accurate.
Itosu said:
Ok, I understand that if one set of results differs much from another set (with different step) then the step should be decreased until differences won' tbe large.
One more question :)
Here we are using fixed-step. Is it difficult to implement variable step size?
Thank you in advance!
No, it's not particularly difficult to implement a variable step size.
You will have to adjust your rungeDx() method to not simply update this.x, this.y, and this.auc, but these values need to be returned from the method.
That way, you can calculate each step more than once without actually executing it.
In each step you need to repeatedly calculate the result, halving the step size, until your result does not change much anymore, that is, changes less than some threshold that you defined beforehand.
With each step you can also try to repeatedly double the step size until it changes too much.
Basically, that's it.