32
$\begingroup$

I have a background in economics and I'm very interested in learning Mathematica but I'm afraid of starting out because I have seen that most programmers already have a good background in some kind of procedural language, and I don't! My goal is to start learning Mathematica, and take it as my Swiss army knife. I don't want to spend time to become good in another language first, and start to study to be a good software developer in Mathematica only after that.

So, my question is: Is it strictly necessary to have a prior knowledge in another kind of language, or one can master, from level zero, and be a great Mathematica programmer just starting programming through Mathematica? It seems to me that there aren't any efforts (books, tutorials, documentation) in this sense directed to the self learner. What do you think? Is there a way?

$\endgroup$
8
  • 6
    $\begingroup$ Nobody could deny you the right to learn something and the possibility of being very good at it. At least without prior knowledge of your abilities and limitations. What you already know (learning Mma as a first language is unusual and that some mathematical abilities are needed) is more than enough as a precautionary note. The rest is up to you. Cheers and May the Force be with You. $\endgroup$ Jul 20, 2012 at 1:44
  • 2
    $\begingroup$ From my perspective as a non-CS, there is overwhelmingly enough information available for self-learning, in most programming languages. As with anything worth doing, your skills will depend on how much effort you put into it, how much you practice. With resources like this site, you won't be stuck on beginner problems for too long. $\endgroup$
    – CHM
    Jul 20, 2012 at 2:12
  • 3
    $\begingroup$ I think one can make a very good case that if you want to use a programming platform to help you do economics or anything else quantitative start with Mathematica. I believe quantitative knowledge and skills that you already have will apply more directly to Mathematica than any procedural or object orient language. You'll do more faster with Mathematica than with any other language you could use. $\endgroup$
    – Jagra
    Jul 20, 2012 at 2:26
  • 3
    $\begingroup$ One of the reasons for the existence of this site is the fact that Mathematica isn't used solely by programmers. Neither do you have to be a mathematician. You'll be in the company of other non-programmers and non-mathematicians here. Don't be put off by the amazing and impressive posts from the experts - they can sometimes make their Mathematica code look like an alien language that you'll never be able to write yourself. But it doesn't take long to master the basics, and perhaps your code will be impressing them one day. $\endgroup$
    – cormullion
    Jul 20, 2012 at 13:28
  • 2
    $\begingroup$ I think that the most difficult thing about having Mathematica as a first programming language is that you get too much freedom. If you don't have good self discipline, this huge advantage can bite you $\endgroup$
    – Rojo
    Jul 20, 2012 at 22:35

5 Answers 5

30
$\begingroup$

Short version

I think mathematica is a good first programming language, and Stephen Wolfram has dropped some hints in a few places that it should get even better at being a beginner programming language soon:

It'll probably be related to my goal in the next year or two of making Mathematica definitively the world's easiest to learn language...

More detail

There are a few things that, in my opinion, contribute to Mathematica being a good first language:

  1. High quality interactive environment suitable for exploration
  2. Support for several different programming paradigms
  3. Good documentation

Let's take these in order.

1. High quality interactive environment suitable for exploration

Of all of the programming languages that I've learned the fastest, I've had some way of entering some code and getting immediate feedback on what the result was. Even as far back as my first programming language, Atari BASIC, I could type in a single line and see immediately what its impact was, or if the syntax was even correct.

Don't underestimate the power of being able to type ??Table in the Mathematica front end to immediately get a quick reminder of what it does and how to use it. Or even better, something like ?String* to get a list of all of the things Mathematica knows that begin with "String".

2. Support for several different programming paradigms

You'll hear over and over (and it's probably one of the things that have you presently intimidated) that Mathematica code should be written functionally whenever possible. But the fact is that none of us are born thinking like Functional Programmers do. Recipes and procedures are ubiquitous and even deeply ingrained by school and other institutional experiences that we all have.

One thing Mathematica is very good at is letting you program as procedurally or as functionally (or with constraints, or logic, or term rewriting, or a host of other programming paradigms).

This enables you to stick with what's comfortable, but to push yourself in exploring new techniques and pushing yourself to learn to use new tools to get the job done better and faster.

3. Good documentation

The Mathematica help is almost tuned for exploring the system. With each help article featuring the Scope section that'll quickly run you through the whole gamut of things that a given function is capable of, and ending off with a Neat examples section of things to get you imagining what else is possible. Not to mention strong hyperlinking among help topics to get you lost in a wave of exploration almost like what happens on Wikipedia.

I should also shout out to the many book authors who hang out on this site, and say that Mathematica has an array of "how to get started" and "how to go deeper" tutorial-style books that give the much more popular programming languages a total run for their money. I'm not the most qualified to recommend any books, but there are other questions on this site that do a good job of listing some gems.

Other thoughts

The Mathematica community doesn't seem as good as other programming language communities at sharing code with each other. I think there are a couple of reasons for that, but the biggest one is probably that the price of admission keeps almost all hobbyist-tinkerer types away using the freely available languages like Python, Ruby, Java, and even C#, leaving mostly the I've-got-real-work-to-do crowd with access to a Mathematica license.

Finally, Mathematica 8 (and beyond) have begun to include some promising features that allow you to type what you'd like to do in plain English and have Mathematica (with Wolfram|Alpha's help) craft the actual code that you'll need. I haven't found this to be a very good way to learn how to do new things, but it seems like it could be someday.

$\endgroup$
5
  • 2
    $\begingroup$ +1 Great cover! I would add that Mathematica has 1000s of built in function all consistently full-named and proper capitalized so it is easy to read and guess what those functions do. Another thing is free linguistic input which helps novice people to get the right syntax from plain English. Numerous built-in and curated data are gems for applied fields. Also it is important to understand that Mathematica runs "Hybrid Symbolic-Numeric" arbitrary precision engine which makes many computing tasks much easier. Graphics is awesome. If you like any of these feel free to add to your post ;-) $\endgroup$ Jul 20, 2012 at 3:58
  • 2
    $\begingroup$ Point 1. That, and only that. Everything else follows. +1 $\endgroup$
    – CHM
    Jul 20, 2012 at 4:09
  • $\begingroup$ +1. Not sure about your "sharing code" theory, though: Matlab has a similar price tag, but you can find Matlab code samples for everything. $\endgroup$ Jul 20, 2012 at 10:46
  • $\begingroup$ @nikie, interesting point. There's an open source equivalent to Matlab, but I'm having trouble convincing myself that resolves your point. $\endgroup$
    – sblom
    Jul 20, 2012 at 15:34
  • 2
    $\begingroup$ @nikie I think the long history of MATLAB's FileExchange and the more recent coding challenges involving sharing of code played an important part in fostering such a culture. In comparison the Wolfram Demonstration Project is relatively new. Also it seems to be geared more towards the output and presentation of cool topics and ideas rather than a piece of code or program that gets some job done. Even now, the WDP is perhaps the last place I look for a code sample simply because I never think of it that way. $\endgroup$
    – rm -rf
    Jul 21, 2012 at 5:38
15
$\begingroup$

The course material I used to learn Mathematica myself is directed at beginners. You should have no problem following it even if you have next to zero prior programming experience. It is a bit outdated (it was written for an old version of Mathematica), but I think that it is still a very useful learning resource today. Most importantly, it includes homework exercises that you can try to solve on your own (to verify your progress).

Please take a look at Programming Paradigms via Mathematica (A First Course).

To summarize: Mathematica has been used in university courses to introduce first year student to programming. The course materials are available, so I suggest you jump in right away and start learning!

$\endgroup$
14
$\begingroup$

I'm a bit late to this party, but I can assure you that it is possible to learn Mathematica as your first and only programming language. I know because I did it. It is also most certainly possible to use Mathematica as your calculation “Swiss Army knife” if you are an economist. I know because I am an economist, too, and I have been successfully using it as my main tool for around 15 years. I used it for my Masters and PhD dissertations, covering both theoretical and empirical applications, and have been using it fairly consistently ever since. (It's more than ten years since I submitted my PhD.)

If anything, I think it is easier to start in Mathematica than to switch from something else. That way, you start off thinking in functional and rule-based programming. You can tell the users who have recently switched from other languages by the nested For loops.

But I won’t pretend it is easy. Mathematica is very much a minority taste in economics. You will find that Matlab dominates in macro and Stata in micro. There are also some other specialist tools, e.g. for DSGE modelling and limited-dependent-variable stuff. Economists seem unusually unwilling to switch from the package that already has lots of custom functions they can download from somewhere rather than implementing themselves. As a result of that inertia, Mathematica has not gained much traction in the profession, though perhaps it will in finance given the functionality in that field that was added in version 8.

It's also worth noting that Mathematica is not an econometrics package and you will probably find yourself needing to use eViews or Stata for the canned econometrics routines. It is certainly possible to do this in Mathematica if you have the patience to code things yourself. But I don't think it would be a good use of anyone’s time if the routine is coded in eViews already, e.g. VARs.

At the risk of self-promotion, you may find some useful links at my web site: http://www.verbeia.com/. However it has been some time since I updated it.

$\endgroup$
8
$\begingroup$

In a comment you asked about learning algorithm development and functional programming basics. Take a look at the courses at http://www.wolfram.com/training/ . Wolfram offers many of them as free videos that you can watch any time.

Check out the "General Mathematica" section for some introductory courses. There is also a free Functional Programming: Quick Start. The longer paid course called Programming in Mathematica was really helpful to me when I took it, and also covers functional programming.

$\endgroup$
3
$\begingroup$

I have written with John Kennedy an introduction to Mathematica programming that is suitable for self study or use in a classroom. It takes a hands on approach by introducing interesting problems from the outset and then introducing Mathematica programming in order to solve the problem at hand; then other problems are introduced and more programming is provided to solve them, etc. By the end the student learns quite a bit of Mathematica and is ready to tackle their own problems. To download this introduction see here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.