Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Thursday September 12 2019, @07:16AM   Printer-friendly
from the switching-gears dept.

MATLAB and Python are both rather popular languages. Real Python has an overview of the two with an eye towards encouraging use of Python. There is a lot to say when comparing languages, so this is a long read.

MATLABĀ® is widely known as a high-quality environment for any work that involves arrays, matrices, or linear algebra. Python is newer to this arena but is becoming increasingly popular for similar tasks. As you’ll see in this article, Python has all of the computational power of MATLAB for science tasks and makes it fast and easy to develop robust applications. However, there are some important differences when comparing MATLAB vs Python that you’ll need to learn about to effectively switch over.

In this article, you’ll learn how to:

  • Evaluate the differences of using MATLAB vs Python
  • Set up an environment for Python that duplicates the majority of MATLAB functions
  • Convert scripts from MATLAB to Python
  • Avoid common issues you might have when switching from MATLAB to Python
  • Write code that looks and feels like Python

Earlier on SN:
Python's Guido van Rossum Steps Down (2018)
What's Today's Top Language? Python... no, Wait, Java... no, C (2017)
GNU Octave - Open Source Answer to Matlab - Hits 4.0.0 (2015)
You Want MatLab on Your Resume to Get a Job at Google (2014)
Why Python is Slow: Looking Under the Hood (2014)


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 4, Insightful) by VLM on Thursday September 12 2019, @11:44AM (3 children)

    by VLM (445) on Thursday September 12 2019, @11:44AM (#893122)

    My experience with Matlab / Octave / R is you can show a script to a non-CS person and they won't (immediately) vomit.

    On the other hand, show them some Python and they'll WTF and yeet you right outta their office. Its like taking a DnD spellbook into an evangelical Christian's office, its just not gonna work no matter what you say.

    Non-CS people LOVE their excel spreadsheets.

    MAYBE taking all of the above into consideration, IF there exists an open source or SAAS implementation of a spreadsheet that also understands embedded python... Python can be encourages to talk to google sheets or read some SS file formats, but I'm talking about a direct embed into the spreadsheet itself. Likely some performance issues as some moron will try to prove the TSP in a cell or P=NP or something and the calc will hang or timeout, but a guy can dream, I guess.

    Starting Score:    1  point
    Moderation   +2  
       Insightful=2, Total=2
    Extra 'Insightful' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   4  
  • (Score: 3, Informative) by sgleysti on Thursday September 12 2019, @01:53PM

    by sgleysti (56) Subscriber Badge on Thursday September 12 2019, @01:53PM (#893156)

    Microsoft has your back. Enter HPC Services for Excel:

    https://docs.microsoft.com/en-us/powershell/high-performance-computing/hpcpack-excel-vba?view=hpc16-ps [microsoft.com]

  • (Score: 0) by Anonymous Coward on Thursday September 12 2019, @05:32PM

    by Anonymous Coward on Thursday September 12 2019, @05:32PM (#893239)

    IF there exists an open source or SAAS implementation of a spreadsheet that also understands embedded python...

    You mean something like this:
    https://help.libreoffice.org/6.3/en-US/text/sbasic/python/main0000.html [libreoffice.org]

  • (Score: 2) by sgleysti on Thursday September 12 2019, @11:55PM

    by sgleysti (56) Subscriber Badge on Thursday September 12 2019, @11:55PM (#893429)

    I wrote a monte carlo simulation for estimating the worst-case measurement error of an electronic circuit given a bunch of input parameters in C++ and showed it to a coworker who jokingly replied, "Why are you messing around with C++? Everyone knows math is done in spreadsheets."

    I did a lot of MATLAB/Octave at my last job, but Octave was very slow for some routines, so I rewrote the critical bits as C++ modules against the Octave API. That worked pretty well. I used numpy to compute analytic derivatives for Jacobian matrices in various nonlinear solvers. It was super handy. At my present job, I used to use Octave for plotting, but it's pretty glitchy on Windows, so I learned enough python to use matplotlib, which can produce some beautiful graphs.

    Anymore, if I need to write a numerical routine, my default is C++ with Eigen.