r/Python • • Aug 05 '19

Python's response to MATLAB

Post image
4.3k Upvotes

372 comments sorted by

View all comments

Show parent comments

6

u/Alexanderdaawesome Aug 05 '19 edited Aug 05 '19

Do you like to play with your environment? Doing write-ups on jupyter is bar none an excellent way to show off your work.
Here is an example of how something you write up may work. It also supports markdowns with Latex syntax, so you can make your findings even more pretty. adding a library is as simple as opening up a terminal and typing

pip3 install **some library**

Debugging:
Lets say you want a file of functions. Call it func.py. Now on func.py you import numpy (for the love of god learn numpy) for any numpy funcs. You write each function with inputs and outputs. Save it. On your main project, say the jjupyter file, you can simply say

from func import *

(there is more syntax to this but it is basically that easy)

Now say you type in a problem and it is giving unexpected results, and you think it may be a problem in one of the functions.

I am not sure how much time you have to learn things, but in this case I really, really recommend Pycharm. You can set up your whole environment on there. (A lot of people recommend anaconda, but for specific environments I have encountered issues). Debugging is as simple as setting a marker and pushing 'run', then stepping through to find the bug. That takes time to learn but it is insanely helpful once you understand how to use it.

Anyway Matlab has better 3d plotting than python, but overall python has a hell of a lot more libraries and open source tools to use. In the long run python will be better for you to know, assuming an engineering company you end up at is not stuck using it.

1

u/I_Feel_It_Too Aug 06 '19

Matlab has better 3d plotting than python

I am curious to know why you say that. I can embed an interactive 3D plot in a web page in Python in the time it takes me to load Matlab. The aliasing and default color scheme of Matlab's make them look like they are from 1994.

1

u/Alexanderdaawesome Aug 06 '19

I rarely use it, so lack of experience?

1

u/I_Feel_It_Too Aug 07 '19

I don't use it that much, either, so I was wondering if I was just missing something obvious.

A counterargument to my pro-python argument is, trying to do something even slightly different from the defaults of the user-friendly Python plotting libs requires magic matplotlib-fu which is a huge pain in the butt. I still feel like I get superior output to any of the alternatives, but it's the plotting equivalent of assembly language. The R people tell me that it's only slightly easier in R, but I haven't done enough R to evaluate that comparison first-hand.