Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

flat6

macrumors regular
Original poster
Oct 24, 2004
244
0
I'm looking for suggestions on which type of environment I should be doing a physics simulation in - basically electricity & magnetism equations. It'll probably have to be 'pure' programmming, so the more graphical-interface applications such as FEMLAB or Maxwell 2/3D probably won't be on the menu.

Right now I'm thinking it's either Mathematica (which I already have) or C/C++ (which I don't have). I found a nice webpage to compare the two (http://octavia.zoology.washington.edu/Mathematica/MathTutorial/Links/index_lnk_1.html); the only concern I have with Mathematica is the fact that it's proprietary software - I'm not sure if I can make a stand-alone executable out of my simulation.

For C/C++, I don't have any experience with it on a Mac, but did do it, extensively, in a Linux environment at school two years ago; I've forgotten the specific details of the linking and compiling and all that, so if I am to pick C/C++, I'd really appreciate an intuitive environment.
 

Arbiter

macrumors newbie
May 23, 2006
29
0
To be honest I would probably recommend Matlab as you can setup things so fast... But you dont want these kind of apps it seems. Other than that I guess C. But you need to tell me more about what kind of application you want to simulate. Is it very processor intensive? Does it use a lot of RAM? Are you interested in parallelizing the application?
 

flat6

macrumors regular
Original poster
Oct 24, 2004
244
0
Arbiter said:
To be honest I would probably recommend Matlab as you can setup things so fast... But you dont want these kind of apps it seems. Other than that I guess C. But you need to tell me more about what kind of application you want to simulate. Is it very processor intensive? Does it use a lot of RAM? Are you interested in parallelizing the application?

No, it's not too serious in terms of RAM/processor intensiveness, so no need for parallelizing. The focus for the simulation would probably be 'ease-of-programming', as in, the faster I can get this simple simulation programmed, the better. Oh, and graphics output is key, so bonus points to Mathematica/Matlab type programs for having that capability so easily available. Due to the lab's preference/licenses for Mathematica, Matlab seems to be out of the running though.
 

Arbiter

macrumors newbie
May 23, 2006
29
0
What kind of graphics do you want to output? Charts of some sort? Or something else? I believe in your case JAVA is probably better than C/C++.. It is a compromise... not as easy to setup as Matlab/Mathematica, but easier than C/C++ especially for graphics... Not as memory/process efficient as C/C++ but moreso than Matlab/Mathematica.

JAVA with Swing(for 2D graphics) should handle most of the tasks I would think. It also has an extensive standard library that is beyond C/C++ standard libraries in terms of functionality and especially documentation.

You have experience in C/C++, so getting JAVA up and running should not be too complicated for you. Getting to know Swing properly would probably be the hardest part. But there are so many well documented examples on the net that I would not worry about it too much.
 

flat6

macrumors regular
Original poster
Oct 24, 2004
244
0
Speaking of which, I know this isn't a Mathematica help forum, but perhaps someone here knows this off the top of their head. I'm looking to put a FOR loop inside the PLOT command; not quite sure how to do it, my try with concatenating strings didn't go too well.

I'm trying to avoid this...
 

irbdavid

macrumors regular
Mar 27, 2006
154
0
I'm starting a research project in mathematica in a couple weeks. From what I gather at this stage is that its only really useful for people who can't/wont do maths, and much less useful for anything remotely resembling procedural programming, e.g for loops etc.

For a couple years now I've been using PGPLOT, available here:http://www.astro.caltech.edu/~tjp/pgplot/, which works well on a mac once it's installed. You need aquaterm from sourceforge to provide a graphics device for pgplot, but from there it provides a nice and simple way to plot everything from simple functions to fractals from within C. I really wouldn't suggest that it's sensible to use something like mathematica/matlab solely on the basis of it's ability to plot functions easily, the problems you will run into, like the one you described above, will probably end up taking more time to solve than to get PGPLOT.

fractals-small.jpg


Plenty of similar java packages exist too (JFreeChart ?), and java does have some major advantages for this kind of work if you're more interested in getting results quickly rather than spending time polishing code, and as Arbiter mentioned it's not too much a leap from C, and is far simpler than C++ imho.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.