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

Related Stories

Why Python is Slow: Looking Under the Hood 20 comments

We all know that python is slower than compiled languages like C. But what can you do about it? Jake VanderPlas, director of research in the physical sciences for the university of Washington's eScience institute, digs into python's internals to explain how it works and what program design choices you can make to use python efficiently.

You Want MatLab on Your Resume to Get a Job at Google 39 comments

Jim Edwards writes at Business Insider that Google is so large and has such a massive need for talent that if you have the right skills, Google is really enthusiastic to hear from you - especially if you know how to use MatLab, a fourth-generation programming language that allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Java, Fortran and Python. The key is that data is produced visually or graphically, rather than in a spreadsheet.

According to Jonathan Rosenberg, Google's former senior vice president for product management, being a master of statistics is probably your best way into Google right now and if you want to work at Google, make sure you can use MatLab. Big data — how to create it, manipulate it, and put it to good use — is one of those areas in which Google is really enthusiastic about. The sexy job in the next ten years will be statisticians. When every business has free and ubiquitous data, the ability to understand it and extract value from it becomes the complimentary scarce factor. It leads to intelligence, and the intelligent business is the successful business, regardless of its size. Rosenberg says that "My quote about statistics that I didn't use [last night] but often do is, 'Data is the sword of the 21st century, those who wield it [are] the samurai.'"

GNU Octave - Open Source Answer to Matlab - Hits 4.0.0 34 comments

I wasn't aware of the GNU Octave project until I saw a post on Reddit that it had hit version 4.0.0. If you're not familiar with it either, here's a brief overview:

GNU Octave is a high-level interpreted language, primarily intended for numerical computations. It provides capabilities for the numerical solution of linear and nonlinear problems, and for performing other numerical experiments. It also provides extensive graphics capabilities for data visualization and manipulation.

So why is this exciting? Aside from a Windows installer for all you people too lazy to switch to GNU/Linux, it apparently finally got a GUI (kind of a must for "modern" software):

Octave 4.0 is a major new release with many new features, including a graphical user interface, support for classdef object-oriented programming, better compatibility with Matlab, and many new and improved functions.

You can also get the full list of user-visible changes here.

Share and enjoy!

What's Today's Top Language? Python... no, Wait, Java... no, C 28 comments

Among developers, Python is the most popular programming language, followed by C, Java, C++, and JavaScript; among employers, Java is the most sought after, followed by C, Python, C++, and JavaScript.

Or so says the 2017 IEEE Spectrum ranking, published this week.

IEEE Spectrum, a publication of the The Institute of Electrical and Electronics Engineers, a technical advocacy organization, says it evaluated 12 metrics from 10 sources to arrive at this conclusion.

It claims to have culled data from Google Search, Google Trends, Twitter, GitHub, Stack Overflow, Reddit, Hacker News, CareerBuilder, Dice, and its own digital library.

https://www.theregister.co.uk/2017/07/21/python_java_c_programming_languages/


Original Submission

Python's Guido van Rossum Steps Down 93 comments

On a python developers' mailing list for the core developers, Python Committers, Benevolent Dictator for Life Guido van Rossum has announced that he is stepping down effective immediately and with out appointing a successor.

Now that PEP 572 is done, I don't ever want to have to fight so hard for a
PEP and find that so many people despise my decisions.

I would like to remove myself entirely from the decision process. I'll
still be there for a while as an ordinary core dev, and I'll still be
available to mentor people -- possibly more available. But I'm basically
giving myself a permanent vacation from being BDFL, and you all will be on
your own.

After all that's eventually going to happen regardless -- there's still
that bus lurking around the corner, and I'm not getting younger... (I'll
spare you the list of medical issues.)

I am not going to appoint a successor.

[...] I'll still be here, but I'm trying to let you all figure something out for
yourselves. I'm tired, and need a very long break.


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.
(1)
  • (Score: 0) by Anonymous Coward on Thursday September 12 2019, @07:34AM (8 children)

    by Anonymous Coward on Thursday September 12 2019, @07:34AM (#893081)

    Make sure you migrate to Python 2.7 so you can re-write everything when it goes away [soylentnews.org].

    And since the Python guys seem to want to obsolete stuff all the time, you'll probably get to re-write it again in a few years too.

    Talk about self-serving drivel. Sigh.

    • (Score: 1, Funny) by Anonymous Coward on Thursday September 12 2019, @08:10AM (4 children)

      by Anonymous Coward on Thursday September 12 2019, @08:10AM (#893085)

      Make sure you migrate to ...

      Javascript. It will be around when COBOL and Perl have long died. Or at least when they are only running on a JS engine.

      Python and Ruby have already died and are legacy.

      • (Score: 2, Insightful) by Anonymous Coward on Thursday September 12 2019, @01:47PM (3 children)

        by Anonymous Coward on Thursday September 12 2019, @01:47PM (#893154)

        Realmen(tm) use Fortran.

        • (Score: 0) by Anonymous Coward on Thursday September 12 2019, @03:13PM (1 child)

          by Anonymous Coward on Thursday September 12 2019, @03:13PM (#893186)

          Realmen enter in their code by front panel switches

        • (Score: 2) by UncleSlacky on Thursday September 12 2019, @08:20PM

          by UncleSlacky (2859) on Thursday September 12 2019, @08:20PM (#893312)

          I can write Fortran in any language!

    • (Score: 1, Informative) by Anonymous Coward on Thursday September 12 2019, @12:53PM (1 child)

      by Anonymous Coward on Thursday September 12 2019, @12:53PM (#893139)

      While Matlab has never "gone away", Mathworks do change things around and break older code by removing or changing functionality. Another annoying thing Mathworks does is take perfectly good functions out of the mainstream Matlab and move them into specialized toolboxes, clearly a money grab.

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

        by Anonymous Coward on Thursday September 12 2019, @06:29PM (#893262)

        They also allow single precision and complex numbers, however 1/2 the functions barf if you use those types. Any they will not fix it - just template the underlying C++ for CHRISSAKES.

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

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

      "All the time"

      Python 3 was introduced in 2008, so you should have at least a good solid 12 years before it goes EOL after they release Python 4 (for which there aren't yet plans).

      Are we going to be upset that they aren't still supporting Python 1 as well?

  • (Score: 2) by corey on Thursday September 12 2019, @07:48AM (8 children)

    by corey (2202) on Thursday September 12 2019, @07:48AM (#893083)

    Just reading through it and it goes into using Anaconda and conda and then IDEs and all this other junk.

    When I used to write in python, it was make a text file in whatever editor and then python blah.py

    I guess now everyone and his dog are pythonistas, judging by all the ads on LinkedIn and online courses and blah blah.

    • (Score: 3, Interesting) by corey on Thursday September 12 2019, @08:00AM

      by corey (2202) on Thursday September 12 2019, @08:00AM (#893084)

      Forgot to mention, despite my criticism above, the article is pretty good in achieving its aims.

    • (Score: 2) by Freeman on Thursday September 12 2019, @03:04PM (4 children)

      by Freeman (732) on Thursday September 12 2019, @03:04PM (#893181) Journal

      You can still use notepad++ / notepad, then do python blah.py to run your program, but you're missing out on some very nice things. I went hunting for a decent IDE for Python a couple years ago and settled on PyCharm. It has a dark color theme, syntax highlighting, auto-indentation, code completion (auto-complete for code), and a few more bells and whistles. You get all that in the free community edition. You can also upgrade to the professional version for a few extra bells and whistles that are much more useful for large productions. As far as I remember, the professional edition, isn't obscenely expensive, either.

      --
      Joshua 1:9 "Be strong and of a good courage; be not afraid, neither be thou dismayed: for the Lord thy God is with thee"
      • (Score: 2) by Freeman on Thursday September 12 2019, @03:08PM (1 child)

        by Freeman (732) on Thursday September 12 2019, @03:08PM (#893185) Journal

        Ahh.., I forgot to mention, projects. It's easy to be working on multiple projects, with multiple versions of python, and various packages when using something like PyCharm. It just makes your life easier, so you can get to coding, instead of managing your code / project.

        --
        Joshua 1:9 "Be strong and of a good courage; be not afraid, neither be thou dismayed: for the Lord thy God is with thee"
        • (Score: 2) by corey on Thursday September 12 2019, @10:54PM

          by corey (2202) on Thursday September 12 2019, @10:54PM (#893404)

          Thanks, that sounds like a good reason to use an ide.

      • (Score: 2) by toddestan on Friday September 13 2019, @01:49AM (1 child)

        by toddestan (4982) on Friday September 13 2019, @01:49AM (#893471)

        PyCharm can be a bit overwhelming for new users. One of the things I see people who are trying to learn Python and jump into PyCharm struggle with is how PyCharm sets up all kinds of virtual environments behind the scenes with every project, and if you aren't used to Python's versioning headaches then you may not know what it is doing, or why.

        The other issue I had with PyCharm is that it is written in Java and the performance is about what you would expect. Though today with 8 cores and 32 GB of ram, it may not matter.

        If you are used to Matlab, Spyder is probably a better choice.

        • (Score: 2) by Freeman on Friday September 13 2019, @02:25PM

          by Freeman (732) on Friday September 13 2019, @02:25PM (#893653) Journal

          Spyder+Anaconda is definitely geared towards the same things as MATLAB. Yet, Python is much more popular and has better community support. Spyder's home page shows off their white theme, which leaves much to be desired. Also, you essentially need to use their Spyder+Anaconda package. I prefer sticking with plain-old Python with a decent IDE. Thus, why I settled on using PyCharm. I may have made a different decision, if I was using Python strictly as a Scientific tool.

          Caution

          While we offer alternative Spyder installation options for users who desire them, we currently lack the resources to offer individual assistance for problems specific to installing via these alternative distributions. Therefore, we recommend you switch to Anaconda if you encounter installation issues you are unable to solve on your own.

          https://docs.spyder-ide.org/installation.html

          --
          Joshua 1:9 "Be strong and of a good courage; be not afraid, neither be thou dismayed: for the Lord thy God is with thee"
    • (Score: 2) by Thexalon on Thursday September 12 2019, @03:39PM (1 child)

      by Thexalon (636) on Thursday September 12 2019, @03:39PM (#893194)

      Emacs is the closest thing to an IDE I've used in ages. Whether we're talking Python or other languages.

      I understand why they use IDEs in articles like this though: A lot of programmers not only like them but also think that means their language is "modern", whatever that means.

      --
      The only thing that stops a bad guy with a compiler is a good guy with a compiler.
      • (Score: 2) by sgleysti on Thursday September 12 2019, @11:48PM

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

        but also think that means their language is "modern", whatever that means.

        Good support for structured programming ;)

  • (Score: 1, Informative) by Anonymous Coward on Thursday September 12 2019, @10:53AM

    by Anonymous Coward on Thursday September 12 2019, @10:53AM (#893107)

    Certain reductions in numpy discards singleton dimensions when they are needed further down the line. For example, batched inner products might be needed for calculating certain quantities to be matrix-multiplied further down the line, so you would use `sum' across some axis e.g. to get a column vector [n,1]. This can't be done unless you also pass keepdims=True to the reduction, or reshape. In octave, you'd get the correct dimension directly.

    Painful lesson is never use shapes of type (n,) in numpy and always keep singleton dimensions unless you know explicitly that you will never need them.

  • (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.

    • (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.

  • (Score: 5, Funny) by DeathMonkey on Thursday September 12 2019, @05:21PM

    by DeathMonkey (1380) on Thursday September 12 2019, @05:21PM (#893234) Journal

    I've got some math for you!

    expensive and proprietary
      vs
    free and Free

  • (Score: 5, Informative) by rylyeh on Thursday September 12 2019, @05:59PM (1 child)

    by rylyeh (6726) <reversethis-{moc.liamg} {ta} {htadak}> on Thursday September 12 2019, @05:59PM (#893244)

    Those wanting an excellent Python replacement for Matlab need look no further - http://www.sagemath.org/ [sagemath.org]

    SageMath is a free open-source mathematics software system licensed under the GPL. It builds on top of many existing open-source packages: NumPy, SciPy, matplotlib, Sympy, Maxima, GAP, FLINT, R and many more. Access their combined power through a common, Python-based language or directly via interfaces or wrappers.
    Mission: Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab.

    --
    "a vast crenulate shell wherein rode the grey and awful form of primal Nodens, Lord of the Great Abyss."
    • (Score: 2) by Freeman on Friday September 13 2019, @02:33PM

      by Freeman (732) on Friday September 13 2019, @02:33PM (#893656) Journal

      The color scheme on that website hurts my eyes.

      --
      Joshua 1:9 "Be strong and of a good courage; be not afraid, neither be thou dismayed: for the Lord thy God is with thee"
  • (Score: -1, Spam) by Anonymous Coward on Thursday September 12 2019, @09:23PM (2 children)

    by Anonymous Coward on Thursday September 12 2019, @09:23PM (#893358)

    APK annihilated that STUPID lying deluding itself it is a real woman (when it never can be) "TrAnSteSticLe" monstrosity aberration abomination of desolation https://soylentnews.org/comments.pl?noupdate=1&sid=33430&page=1&cid=889582#commentwrap [soylentnews.org] that made technical errors galore vs. him and lied saying apk started it when proof quoted proves otherwise!

    • (Score: 0) by Anonymous Coward on Thursday September 12 2019, @09:57PM (1 child)

      by Anonymous Coward on Thursday September 12 2019, @09:57PM (#893383)

      Whoops! Looks like you posted this to the wrong site. I think you want that green site, not this one!

      • (Score: 2) by corey on Thursday September 12 2019, @10:59PM

        by corey (2202) on Thursday September 12 2019, @10:59PM (#893407)

        He just posted exactly that to another article. Sounds like a cryptic field spook message back to headquarters as reported in another article a while back.

  • (Score: 1, Funny) by Anonymous Coward on Friday September 13 2019, @02:34AM

    by Anonymous Coward on Friday September 13 2019, @02:34AM (#893488)

    I have 2 python t-shirts.

(1)