Best Language for Applied Mathematics

In summary, it seems like C++ is a good choice for someone modeling systems and trying to learn another language for more powerful manipulation of matrices. It has a lot of the same features as MATLAB, and a learning curve that's not too bad. Being able to visualize data with GNU Plot or another appropriate plotting library is also beneficial.
  • #1
TRF86
3
0
I am currently in graduate school and I work on modeling. The systems I model rely heavily on stiff ODE solvers (i.e. ode15s in MATLAB) and non-linear solvers as well for solving non-linear reaction and diffusion equations.

So far I have typically used MATLAB for my work, but I feel like this will limit me when I apply for a job, since companies may not be willing to shell out 1000's in licensing fees if they can just use open source products. So, I want to learn another language that will be useful for my modeling work. I have considered C using the GSL, but I want to make sure that what I invest time in will be the best choice.

What do you guys recommend I should pick? It's not really necessary to have solvers in place. I could write my own if need be. What's really important is being able to manipulate matrices as easily as it's done in MATLAB, and that the language is powerful with a learning curve that's not too bad. I have a fair amount of experience already in C.

Thanks.
 
Technology news on Phys.org
  • #2
For something like applied mathematics, I think its very beneficial to be multi-lingual in your coding. Everyone who wants to get respect should know C/C++ well; it sounds like IDL might be another good thing to look into for your situation; but it has essentially the same draw backs as MATLAB (e.g. cost).

See what kind of libraries/packages there are for vector manipulation in C++.
 
  • #3
zhermes said:
For something like applied mathematics, I think its very beneficial to be multi-lingual in your coding. Everyone who wants to get respect should know C/C++ well; it sounds like IDL might be another good thing to look into for your situation; but it has essentially the same draw backs as MATLAB (e.g. cost).

See what kind of libraries/packages there are for vector manipulation in C++.

It seems that BLAS (http://www.netlib.org/blas/) along with LAPAC (http://www.netlib.org/lapack/) is pretty much the standard for vector/matrix manipulation in C. It has a lot of the same functions/features that MATLAB has.

Maybe I will just start with that and learn the basics in there. Then I can develop that some more and maybe write some of my own solvers.

What about visualizing the data? Is GNU Plot the best for graphing my data? Or is there a better alternative? I would like 2D/3D graph support, and the ability to create animated plots (to step through time).
 
Last edited by a moderator:
  • #4
Besides GSL, NAG and ROOT also have decent numerical libraries. Nag costs money, but ROOT is free. Oh and there is of course the Numerical Recipes library (which also costs money), but comes with a nice book. All of those are in C/C++. In fact I'm pretty sure I've searched around and found lots of others, but haven't checked many of them out. Mathematica, like Matlab and Maple, is also popular, but not C based.
 
  • #5
A few years ago I knew a math wiz-kid who swore by Haskell.

Then there's the stats languages like R -- soon all math will be statistics, no?
 
  • #6
R is a nice language, I guess even though its focused on stats you could probably use if for finite difference equations and other numerical methods -- linear algebra is still linear algebra, and stats definitely use linear algebra. But it has some issues with looping that would probably make it non-ideal (plus if the methods you write aren't compiled they are going to be slow).

Haskell looks interesting -- surprisingly large number of libraries for it.
 
  • #7
TRF86 said:
...So far I have typically used MATLAB for my work, but I feel like this will limit me when I apply for a job, since companies may not be willing to shell out 1000's in licensing fees if they can just use open source products...

Most companies I know of will shell out the $$ for licensing fees as opposed to using open source, for example my employer will not allow us to use open source codes so that they avoid licensing issues down the road.
 
  • #8
Dr Transport said:
Most companies I know of will shell out the $$ for licensing fees as opposed to using open source, for example my employer will not allow us to use open source codes so that they avoid licensing issues down the road.

However, for someone learning there is an open source version of MATLAB. For windows users install cygwin first and then use the installer to install octave. You can also run it in a virtual machine but the virtual machine approach would be better for users who are good at installing things from source.
 
  • #9
Well, I don't know what applied mathematics is, but since I hear linear algebra and I hear familiar software like Matlab, I figure I chime in.

By the way, I thought the brains of the linear algebra of MATLAB was written in Fortran 90.

I already heard Octave as a possible replacement for Matlab; well, there is also Freemat and Scilab.

Of course, there is also Python with numpy/scipy/matplotlib...this is what I have been doing lately.

Recently, I discovered Re-Interact which on top of Python/numpy/scipy/matplotlib, it adds some a-la-Mathcad kind of capabilities where you have worksheets that include the operations and the results and plots all at the same time...you can also go back, change a value and everything gets updated.

my 2 cents
 
  • #10
The original post is a bit old, but it was bumped. So I'll add my two bits.
gsal said:
By the way, I thought the brains of the linear algebra of MATLAB was written in Fortran 90.
The original Matlab was written in Fortran at Stanford. It didn't do much beyond a few matrix calculations plus access to a few LINPACK subroutines. The Matlab we know (and love and hate) now not only does math, it does graphics (very nicely!), it parses M-files (try that in Fortran!), plus a host of other things. One of the very first things the founders of MathWorks did was to rewrite Matlab in C, finishing the task in 1983.

I already heard Octave as a possible replacement for Matlab; well, there is also Freemat and Scilab.
Nothing compares to Matlab. Yes, Matlab is ridiculously pricey and proprietary, but nothing compares. Nothing.
Enough about Matlab, except for one final comment: If a employer is so cheap that they won't buy a Matlab license for someone whose job is applied math, guess how cheap they'll be with you, the employee, come raise time? A Matlab license costs a few thousand. You cost the company a hundred thousand, easy. Your salary might not even be close to $100K, but your salary + benefits + employer's share of social security + office space and equipment + other costs almost certainly exceeds $100K/year if you have a bachelor's degree or higher in science, technology, engineering, or math.

Job interviews are two way streets. Candidates of course need to sell themselves as a good fit and an asset, but they should also be asking themselves if this where they really want to work. Will their 35 to 60 or more hours per week be performed in a nerd's paradise (thank God it's Monday!) or in some kind of purgatory (OMG! It's only Tuesday!) ? Finding out what kind of technical productivity tools a potential employer provides is a litmus test that helps distinguish between the two.
zhermes said:
For something like applied mathematics, I think its very beneficial to be multi-lingual in your coding.
I agree. Selling oneself to a potential employer is the candidate's #1 job in their resume, during the pre-interview, and during the interview. Being multi-lingual is a huge asset if technical programming is to be a part of the job.
 
  • #11
The original Matlab was written in Fortran at Stanford. It didn't do much beyond a few matrix calculations plus access to a few LINPACK subroutines. The Matlab we know (and love and hate) now not only does math, it does graphics (very nicely!), it parses M-files (try that in Fortran!), plus a host of other things. One of the very first things the founders of MathWorks did was to rewrite Matlab in C, finishing the task in 1983.

Yes, I know, I wouldn't write a parser in Fortran; but...

Like I said: "I thought the brains of the linear algebra of MATLAB was written in Fortran 90"...I just went ahead and confirmed that...


Matlab Version 5.3 was the last one to use a few Fortran linear-algebra subroutines translated to C...after that, http://www.mathworks.com/company/newsletters/news_notes/clevescorner/winter2000.cleve.html?s_cid=wiki_matlab_4 set of subroutines which is written in Fortran-90.

Yes, MATLAB is very, very nice; but not everyone works for a big company. Programmers are getting younger and younger and starting to program at home before they care for a job.

Like any other open source projects, the python/numpy/scipy/matplotlib combination lacks a marketing engine with profit in mind...nevertheless, it is gaining popularity, slowly but surely.
 
  • #12
Hi, I'm new here. Although I'm not a scientist, I did program professionally. So maybe I can post some helpful thoughts sometimes.

I agree with our friend here who says it's good to know more than one programming language, because for some applications, some languages are better than others. In general, though, I suggest functional programming languages for mathematical applications, the Haskell language, say. Functional programs usually are much shorter than their procedural counterparts, C programs, for instance, and much easier to understand. In fact, functional programming makes program specifications easy translate program specifications into programs because programming in Haskell is much like doing mathematics on paper. Functional programs even prevent many kinds of bug that you may find in procedural programs.

A functional program makes the computer evaluate expressions. It doesn't tell the machine to change the values of variables. Instead, it replaces an expression with its value. So functional programming languages are great when computations need to happen at the same time, because the language won't let the computer change anything by accident.

The best feature of functional programming languages may be that compared to the correctness of procedural programs, the correctness of functional programs is easy to prove inductively.

Here's the surprise: To program in Haskell, you need to be very comfortable with recursion because in that language, there's no way to write a loop.

Here's an excellent article about Haskell.

http://www.haskell.org/haskellwiki/Why_Haskell_matters
 
Last edited:
  • #13
Oh, yes, I have heard of functional programming; but I don't know much about it.

Code:
In fact, functional programming makes program specifications easy translate
a program specifications into programs because programming in Haskell is 
much like doing mathematics on paper.
Really? At the risk is sounding totally stupid, I don't think the way most of us do math on paper directly translates into functional programming which, again, I don't know what is like or looks like...all I know is that my math very nicely can be easily typed 'as-is' into, say, fortran or C...and I don't think I am doing functional programming...am I?

I thought I heard functional programming, as nice and safe as it might be, requires a paradigm shift for non-functional programmers...which, again, it seems to indicate that the usual way in which we deal with math in engineering school and on paper might not be "functinoal".

Anyway, not trying to start a flame war or anything, just commenting and would welcom enlightening comments.

By the way, no need to learn Haskell...functional programming can be done in the versatile programming language of Python :-)

Here are just a few links

http://docs.python.org/howto/functional.html
http://www.ibm.com/developerworks/linux/library/l-prog/index.html
http://dan.bravender.us/2009/8/23/Purely_Functional_Programming_for_Python.htmlgsal

P.S. Oh, by the way, Bill, welcome to the forum...looking forward to your contributions.
 
  • #14
Gsal, thanks for welcoming me. I'm happy to be here, and I look forward to your contributions, too.

You can write functional programs in Fortran and in C. I've written some functional programs in Python, too. Here's a trivial example.

Code:
def number_of_integers_in(this_list):
   return len(filter(is_an_integer, this_list))

def is_an_integer(something):
   return type(something) == type(0)

def sum_of_squares(from_here, to_here):
   return [n * n for n in range(from_here, to_here + 1)]

I love Python, but Python programs crawl. JavaScript may be even slower in some respects. Take Javascript. There's no inbuilt integer data type in it because its only numeric data type is double precision floating point. So to compute with integers, you probably need to do plenty of type conversion behind the scenes.

By the way, everyone, don't expect me to say much about physics now when I'm much more familiar with logic, programming, analytic Thomism and Catholic dogmatic theology.
 

1. What is the best language for applied mathematics?

The best language for applied mathematics depends on the specific problem you are trying to solve. Some popular options include MATLAB, Python, and R.

2. What are the advantages of using MATLAB for applied mathematics?

MATLAB has a built-in library of mathematical functions and tools for data analysis, making it efficient and user-friendly for solving complex mathematical problems.

3. Is Python a suitable language for applied mathematics?

Yes, Python is a versatile language with many libraries for scientific computing and data analysis. It is also open-source and has a large and active community of users.

4. How does R compare to other languages for applied mathematics?

R is a specialized language for statistical computing and data analysis, making it a top choice for solving problems in applied mathematics that involve large datasets.

5. Can I use multiple languages for applied mathematics?

Yes, it is common for scientists and mathematicians to use multiple languages for different parts of their research. For example, you may use MATLAB for data analysis and Python for creating visualizations.

Similar threads

  • Programming and Computer Science
Replies
8
Views
875
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
12
Replies
397
Views
13K
  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
16
Views
2K
  • Programming and Computer Science
2
Replies
54
Views
3K
  • Programming and Computer Science
Replies
10
Views
2K
Back
Top