# Python Matlab and Python

1. Mar 9, 2016

### DiracPool

I'd appreciate it if someone can give me a little guidance here. I'm slated to be entering a Ph.D. program in the fall where I'll be working on a machine intelligence project under a DARPA grant designed to create autonomous rovers. They want me because of my background in understanding the chaotic dynamics of cortico-cortical interactions in human and non-human brains and the manner in which these processes translate into motor routines expressing goal-directed behavior. The problem is that I'm a biologist, but in order to work on the project I'm slated for and to fulfill the core requirements for the Ph.D., I'm going to have to learn how to program again! I was one of the original computer whiz kids in the early 80's but I haven't written any code in 30 years. I have no idea how things have changed.

All they told me was that I was going to have to learn how to program in Matlab with a new interaction it has with Python. I don't think its a toolbox, I don't really know what it is. But what I'm looking for is someone who is in school and is working maybe in an ECE (electrical and computer engineering) department and has some experience in what tools are used there. I'll be entering the program in the fall so I've got six months to get a head start and want to jump on this now. The first thing I want to know is do I have to buy the $250 single use version of Matlab or can I get away with buying the$99 student version. Or can I get away with buying the even more stripped down $49 version that doesn't come with the suite of toolboxes that comes in the$99 version. Or is it absurd to not take advantage of that suite of toolboxes for an extra 50 bones?

Am I losing any important functionality by buying the student version? I remember years ago I was going to buy the student version for a project that I was going to do but that fell apart so I didn't buy it. I think the only restriction of functionality was the size of the arrays you could create with it or something like that but that was a long time ago. I'm not trying to do anything fancy, I'm just trying to learn the computer language. I'm sure I'll be working with the full institutional version once I get to the university.

As far as Python, what's going on here? Is Python free? I think I can download it for free but is this the real deal? And, importantly, what's the difference between visual Python, or vPython, and the regular Python? I've seen some great graphics displays using vPython and I'd like to learn that language, but if I just learn vPython is that the same as learning the actual Python language? Or is vPython just a stripped down version?

Finally, what are some good learning resources for an old-timer like me that likes to watch educational videos on youtube instead of cracking open a book? I mean, I'm not against cracking open a book if I need to, but please give me some easy user-friendly tutorial links that I can use to learn these programming languages.
Thanks.

I've already found one, the guy from mathtutordvd.com.

http://www.mathtutordvd.com/products/Learning-Matlab-Essentials-Skills.cfm

I like this guy. VERY easy and straightforward. Just as I like it. If you can think of any others that might help, please do tell.

2. Mar 9, 2016

### Staff: Mentor

There's a good book by Hahn and Valentine on Matlab called Essential Matlab:

https://www.amazon.com/Essential-MA...d=1457581139&sr=8-1&keywords=essential+matlab

and for Python there are really two language variants Python 2.7+ and Python 3.4+. The community did a switch with many new features in the newer python but had to support the legacy stuff that broke hence the Python 2.7+ versions.

As far what one to learn, I'd go with iPython and the notebook interface. It comes loaded with all the necessary numerical libraries that you'll need to do simulations and various computational tasks. Most shops will use either Matlab or iPython.

http://ipython.org/notebook.html

Some shops may also be looking at Julia, language not unlike Matlab but more modern and faster. There is a similar distribution that supports Julia, Python, C/C++ and R library mixing called iJulia. You can get a distribution here if you're interested:

http://quant-econ.net/python_or_julia.html

and here's a youtube video to get you started (there are a lot others so search on python or ipython):

For Julia, there are a couple of excellent ones by Dave Sanders using iPython notebook.

For Matlab calling python, here's a mathworks link:

http://www.mathworks.com/help/matlab/call-python-libraries.html?s_tid=gn_loc_drop

Lastly, there's a free clone of Matlab called Freemat freemat.sourceforge.net that does basic stuff (core language) to get your feet wet.

Eventually though you'll probably want to get the Student version \$99. Let your PhD advisor/program pay for the fancier Matlab.

Hope this helps.

Last edited by a moderator: May 7, 2017
3. Mar 9, 2016

### Staff: Mentor

in general they don't work exactly the same at matlab and don't support the matlab toolboxes. I heard most shops that shy away from matlab go with numerical python distributions like ipython.

Orielly has many good book on python too. I have a couple of the pocket editions. They also have a Python cookbook which useful when you need to do a specific task.

Another resource is rosettacode.org where many different languages are used to solve a large collection of tasks. Its good for comparative language studies.

I forgot to mention that processing.org IDE has a python mode and some samples of drawing cool graphics.

4. Mar 9, 2016

### DiracPool

Great. Thanks for the info and resources, jedishrfu. I think I'm just going to buy the official Matlab version. I've already got a steep climb ahead of me and don't want to complicate it by trying to cut corners. Which reminds me, I'm not going to skimp and get the stripped-down version without the toolbox suite. It's 50 bucks. This is my future, how cheap can I get?

5. Mar 9, 2016

### Staff: Mentor

Pretty cheap :-)

6. Mar 9, 2016

### FactChecker

MATLAB has many extensions, each of which cost money. I don't think they would expect you to pay for specific extensions. You should find out what would be needed on the project and ask it you can use their version. They may already have site licenses that you can use.

7. Mar 9, 2016

### DiracPool

Thanks FactChecker, but we're not even there yet. I know I can bring something useful and important to the project but I have no idea how it's going to play out practically. Right now I'm not worried about extensions and licenses, I'm worried that I don't know how to program a computer. So I'm going to try to start there. I'll worry about the licenses later

8. Mar 10, 2016

### websterling

If you could code 30 years ago, you can still code. On some level (unless it's a really weird language) programming is programming. Just learn the new syntax and keep a reference (or the Web) close by.

My first experience programming was a bit before yours- late '70's through 81 or so. It was using an eclectic mix of BASIC, MicroFORTH, and assembly language. Having only 16k of memory to work with we had to be somewhat creative! My next programming was in the late '90's using PERL. I didn't have any problems getting started again. A couple of years ago, it was harder moving to Python from PERL, mostly because Python looks so different- for example blocks of code are delineated by indentation, rarther than curly brackets. But once I got used to the differences, Python is just as easy as PERL.

When I started again in the '90's the biggest obstacle that I had to overcome was because my previous experience was in a very resource limited environment. It took a while to get comfortable using long, descriptive variable names and using whitespace to enhance readablity.

9. Mar 10, 2016

### cosmik debris

We use both Matlab and Python. The cost of Matlab and it's toolboxes is driving more and more of our researchers to Python. With Numpy, Scipy and Sympy addons Python is very powerful. If you are in some very specialist field you can still find free code developed by other researchers. I would look around and see what is available in your field. Matlab is still very good and may well be worth the cost if it has toolboxes that suit you discipline.

10. Mar 11, 2016

### MrAnchovy

Depending on exactly what you were doing in the early 80s, some things will be new to you or have changed a lot.Concepts that you should get/update knowledge of include:
• Object Oriented Programming (OOP)
• Unit testing
• Software version control systems (find out which one is used in your project, or learn Subversion and one of Git/Mercurial)
• Integrated Development Environments (IDE - again find out which one people tend to use in your project (if it is Eclipse then I feel sorry for you); if you are keen on vPython then it is designed to be used with VIDLE)
• SQL - although the database wars still rage it is no longer about the mutually incompatible Ingres/Oracle for big systems and dBase/FoxPro for micros, and the "roll your own" solution is now irrelevent. Microsoft SQL Server and the free PostgresSQL and MySQL are pretty much interchangeable.
Yes Python is free. But these days most serious programming goes on in Integrated Development Environments (IDE), some of which are free and some of which aren't. IME the best free IDE for Python (which also has a commercial version) is PyCharm Community Edition.
That's interesting - many old-timers like me much prefer the random access self-paced nature of a book to the serialized spoon-feeding experience of YouTube. For the best of both worlds I'd go for CodeAcademy every time.

11. Mar 11, 2016

### Staff: Mentor

Having been a programmer for a long time, I tend to just read examples for new languages and figure stuff out from there. Sometimes the books aren't there or are dated.

In Python's case, there's two flavors Python 2 and Python 3 which causes problem during crossplatform script development ie develop it using 3 and then running it on a system supporting 2 only.

Anyway, cookbooks are great that way where you can look up a specific task and get an example of how to code it.

Also the Rosettacode.org site a good resource for some tasks.