Particle Tracking Code - MATLAB vs. C++
First some background, I am a mathematician by training with very little formal training in programming. I am most comfortable in MATLAB and have been working with it for a long time. My second choice would be C++. But in either language the longest most complicated code I have written is maybe between a hundred and two hundred lines.
I will soon start writing some code for tracking charged particles in various electromagnetic field configurations, at first in 2D and then in 3D. This sparked a debate with my friend if I should write this in MATLAB or C++.
My questions to this community it, what exactly (if any) are the benefits of doing computations like this in C++ over MATLAB? Considering all of the functions/toolboxes available in MATLAB
1.I can do in MATLAB in one line what might take dozens in C++ (old classic argument I know)
2.I don't have to implement any ODE solvers for example (like RK45). All such things I will need are already efficiently tested and implemented so one less thing for me to code/debug/worry about.
3.Same thing for interpolation routines, interpolation in 2D-3D gets very messy, super super easy in MATLAB
4.Same thing for visualization. 373
Once I have the data, super easy to just look at it.
5.A big chunk of this can be vectorized so MATLAB code would be very efficient I think. Not too many loops or anything.
6.I only need small scale shared memory parallelization (in C++ I would use OpenMP) and MATLAB already has a nice easy to use parallel toolbox.
7.MATLAB scripts can be run from command line and our local super computer has it installed (with more than enough licenses) so I can actually run my MATLAB scripts on our super computer. Just invoke multiple instances, each with 6-8 threads if necessary.
So is there any real reason why I should use C++ instead of MATLAB? I will be the only one developing and then the only one using it. I'll be using it for the next year or two for sure and after that I don't know yet. All "real" programmers tell me that all "real" programming should be done in "real" programming languages (i.e. FORTRAN or C). But today it just seems very archaic and outdated opinion at least for mathematical/scientific computation problems. Is there a real reason which I just didn't consider or is it just historical irrational bias? 373