The advantages of several programming languages for evaluating the behavior of n-body systems

Posted Apr 11, 2009 by ori_sonata / comments 0 comments / Print / Font Size Decrease font size Increase font size

There are a lot of programming languages and mathematics application that could be used to evaluating the behavior of n-body systems. Each of these programming languages have their own advantages and disadvantages.

Maple

This particular mathematics application have a great database of mathematics functions. It is possible for users to make a program to make the n-body differential equation. The application already have several functions intended for evaluating differential equations. You don't have to do anything about the numerical method since the evaluation function is going to take care about it. All you have to do is providing the n-body rule of interaction and the required initial conditions. If your expected result is three dimensional, the plot and display function can handle it as well.

The disadvantage lies in the fact that said built-in evaluation function is already coupled with the plotting function. If you decide to use this evaluation function, each object in the system have to be evaluated independently. This is going to lead to extremely wasteful and long computational cycle. If you want all the objects to be evaluated in one go, you will have to write your own evaluation function. Nevertheless this programming language is advised for complete noob in n-body science.

Matlab

Matlab have an extensive library capable of handling basic multimedia files. This could really help you when you need to write your simulation result in either video or graphical format. There is however no built-in function available in Matlab for evaluating either differential equations or difference equations. You will have to take care about the numerical algorithm all by yourself.

You will also need to provide the object-to-object rule of interaction as standard programming syntax in *.m files. However the imread, imwrite, aviwrite and aviread function is really a boon when you need to produce the plot-result in video or image format. Moreover, the 3D plotting function could be coupled with the aviwrite via something called gcf, so you don't really need to take care about the 3D. I would recommend this programming language for intermediate students.

C and C++

These programming languages are very good if you need your simulation to run fast. The resulting GUI however is not going to look good unless you bother to create one from scratch. N-body application made using this languages usually work as something like a server software. Make the GUI using other programming language such as Delphi and connect it to your C program via a signalling file.

Another advantage for using these programming languages is the fact that it is relatively easy for you to make an application capable of running in multi-processing environment and taking the advantages from it. Very useful if your are trying to simulate something with exceptionally high number of objects. I would recommend this programming languages for advanced students.

Borland Delphi

Delphi is very good for someone who want their software to have pretty GUI. You can pack a lot of things in the GUI by using the very useful tabbed-notebook. Creating GUI with Delphi is really a piece of cake. All you have to do is literary picking down what you need and drop it in your form. It is also comparatively easy to make your application for Japanese and Chinese audience using the IME and WideChars functions.Things are going to be a little bit hard if you want your users to be able to drag and drop the objects, but it is far easier than other programming languages already mentioned above.

The disadvantages are you have to take care of the numerical algorithm, present the mathematical equations in standard programming syntax and the 3D environment is a bit harder to program. For the 3D engine, you will have to download add-on called DelphiX. DelphiX module than author of this article aware of only include auto installer for Delphi 3, 4 and 5. Installing DelphiX for Delphi 6 and above is a bit complicated process. I would recommend this programming language for intermediate students.

HTML, PHP and JavaScript

This is truly the nightmare of gravity simulator programmers. To develop a full-fledged web-based n-body simulation application, you have to know about a great deal of programming knowledge. The PHP and Javascript part is actually easy since the syntax looks like C++. However you will also have to understand things are organized in HTML documents, how to write SQL syntaxes and how HTML objects could be accessed and manipulated via JavaScript.

Creating the GUI is actually trivial since HTML codes are already designed for that purpose. With a little knowledge about coordinate transformation, you could even make the simulation three dimensional. However, you will have to write the numerical algorithm, write the object-to-object interaction in standard programming syntax and write the coordinate transformation algorithm. Those are comparatively easy once you realize that you have to design the database tables to store the object information as well. I would recommend these programming languages for expert students.

Fortunately for us, such simulation is already available for use somewhere in the internet.

Rate this Article:

Be the first to rate me.


* You must be logged in order to leave comments, please login or join us.

Comments

No comments yet.



Bookmark and Share
Sign up for our email newsletter
Name:
Email: