Comparing Numerical Methods for ODEs: Euler, Heun, and Runge-Kutta

  • Thread starter Thread starter mamma_mia66
  • Start date Start date
  • Tags Tags
    Numerical Ode
Click For Summary
The discussion focuses on comparing numerical methods for solving ordinary differential equations (ODEs), specifically Euler, Heun, and Runge-Kutta methods. Participants emphasize the importance of understanding the advantages and disadvantages of each method, such as error analysis, stability, and whether they are explicit or implicit. They highlight that while Matlab is favored for numerical computations due to its ease of use with matrices, C++ offers more flexibility and power for general programming tasks. Concerns about the performance of Matlab and its limitations in certain applications are also mentioned, alongside the availability of alternatives like Octave. Ultimately, the choice of programming language may depend on specific project requirements and personal familiarity.
mamma_mia66
Messages
51
Reaction score
0
Please someone help me how to find information about the advantages and disadvantages of each method (Euler, Heun and Runge-Kutta). I surched in google and there is nothing useful posted there. We using Dennis Zill textbook for First course of DE. I need to kind of compare them before I use one of them for a mini project. This independent study online course.

Thank you in advance.
 
Last edited:
Physics news on Phys.org
Any reasonable book on Numerical Analysis will have an error analysis for each of the methods you list.

In general the more points you use to compute the next point the smaller your errors will be.
 
Consider whether the method is explicit or implicit (implicit methods require solving non-linear algebraic equations at each time-step which is gah :( , but on the other hand tend to be more stable as far as absolute stability is concerned which is a definite yay :D ) . . . think about the advantages or disadvantages of the method being single-step or multi-step, of methods that are linear versus non-linear methods . . . of methods which are specifically designed for solving "stiff" problems . . . there are advantages and disadvantages to all these aspects, depending too on the differential system you need to solve . . . reducing the step-size when a method is not performing well is not always the best solution because very small step-sizes can lead to problems related to finite precision errors . . . so it's good to look for alternate methods :)

A good book (at least I like:P) is: "Numerical Methods for Ordinary Differential Systems: The Initial Value Problem" by J. D. Lambert.
 
After learning the numerical methods, the next step is to write program for the algorithm. I don't expect we calculate manually. So what is the most appropriate language for doing numerical computation? I would say use Matlab ( sorry this is the only language I know! :approve:)

But I have seen people using C++ to do numerical computation. Is there any advantages of using C++ over MATLAB ? Beside it able to create exe file (stand alone program). Graphic is difficult to display in C++.
 
I'm like yoo matematikawan, I only know Matlab :P I don't think there'd be any advantages or disadvantages to programming the method in any other language (as far as the end results go, as long as you use the same precision to represent numbers), just it would be harder maybe, and take longer to execute, because Matlab is optimized to operate with matrices and for the programmer it's really so easily to operate with them . . so for example how would you do x=A\b in C+, would you have to implement another algorithm just for that? I really don't know . . . but if you do, then I'd stick to Matlab :)
 
Other languages are more flexible and powerful than Matlab. Of course, you don't really need flexibility or power for this project...
 
Other languages are more flexible and powerful than Matlab.

O: Can you tell me which ones, for instance, and in what way? I'd like to know so I can learn xD
 
Well, Matlab is really a scripting environment more than a programming language. It is interpreted, if my recollection is correct, which means that it's never actually compiled to machine code. This has advantages and drawbacks. Advantages include less restrictive syntax and easier debugging / execution. Drawbacks include slower speed and more complex semantics. Also, as a scripting language, interfacing with hardware and using low-level constructs is clunky and/or impossible.

A good discussion can be found at http://www.cpptalk.net/c-vs-matlab-vt47148.html .

Basically, I feel like Matlab is a numerical analysis tool, and that C++ is a general-purpose programming language.

Apparently, Matlab is Turing complete. Still, I wouldn't want to misuse it to write general-purpose programs.
 
Last edited by a moderator:
Thanks for the link the MATLAB vs C++ discussion. I copy here the reasoning by one responden Tuva

...With that said, there are cases whereby one still might consider C++ for a scientific function library. I can think of three:
A) Matlab code isn't fast enough,
B) Matlab code cannot be transported to a DLL or COM object (for example some of the neural net functions cannot be compiled), or
C) Matlab is too expensive.
But even in those cases I would think long and hard before going C++ entirely...


For the reason A, I don't worry much. I think Matlab is fast enough to do my job. For reason C, I also do not worry. Our department have MATLAB install in almost all PC in the lab. To work at home I can use MATLAB clone Octave.

But I don't understand reason B. What are these DLL or COM object? Never came across before.
 

Similar threads

  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
Replies
2
Views
2K
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 31 ·
2
Replies
31
Views
8K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 14 ·
Replies
14
Views
3K