Fourth order Runge–Kutta in C# - two differential equations

In summary, the conversation is about implementing two non-linear differential equations in C# using the fourth-order Runge-Kutha method. The equations involve various constants such as ALFA, MU, BETA, LAMBDA, V, FI, TETA, QL, and H, and the code also includes functions for calculating the derivatives and running the equations. The conversation also mentions the use of ArrayLists to store the results of the equations.
  • #36
So if I get:

h AUC(after 2 hours)
0.01 335.40257585727842
0.005 335.87803342989893

Can I presume that 335 is accurate result? (without knowing the part after comma).
If h=0.01 does O(h5) mean that up to the 0.015 I get accurate digits?

And should I count O(h5) or O(h4)? Local/global error?
 
Physics news on Phys.org
  • #37
Itosu said:
If h=0.01 does O(h5) mean that up to the 0.015 I get accurate digits?

It means that up to *a constant times* 0.015 you will get accurate digits.
This constant is unknown (and might be bigger than you think or suspect).
Itosu said:
So if I get:

h AUC(after 2 hours)
0.01 335.40257585727842
0.005 335.87803342989893

Can I presume that 335 is accurate result? (without knowing the part after comma).

Since the constant is unknown and you have a discontinuity in your function, you'll have to experiment a bit.
Try a step like 0.0025.
I expect that you'll see an AUC that starts with 335.8, and probably even 335.87 or 335.88.
That should give you "confidence" that 335 are indeed accurate digits, but there is no "guarantee" mathematically speaking.
The result to present, based on your calculation, would be 335.9 ± 0.5 or 335.88 ± 0.48.
Note that whenever you measure something and present a result, you are supposed to always include the margin of error in your result.
 
Last edited:
  • #38
Thank you, I understand.
Could you explain more deeply the idea of the error O(h5) or provide a link?

Thank you in advance!
 
  • #39
Itosu said:
Thank you, I understand.
Could you explain more deeply the idea of the error O(h5) or provide a link?

Thank you in advance!

The errors of numerical algorithms are expressed with this big O notation:
http://en.wikipedia.org/wiki/Big_O_notation"
 
Last edited by a moderator:

Similar threads

  • Programming and Computer Science
2
Replies
36
Views
3K
  • Programming and Computer Science
Replies
15
Views
2K
  • Programming and Computer Science
Replies
1
Views
2K
Replies
5
Views
359
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Programming and Computer Science
Replies
5
Views
2K
Replies
14
Views
4K
  • Programming and Computer Science
Replies
23
Views
2K
  • Advanced Physics Homework Help
Replies
4
Views
6K
Back
Top