replacing Matlab with python

前端 未结 8 1589
小蘑菇
小蘑菇 2020-12-23 12:30

i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university compute

相关标签:
8条回答
  • 2020-12-23 12:56

    Try Sage - it is designed as an open source replacement for Matlab, Mathematica etc. It is implemented in Python and can be scripted with Python, but it also adds a lot of maths-specific features. There is an installer for the Mac, so you will not need to download lots of individual packages.

    There is also GNU Octave - another open source alternative to Mathematica/Matab that has its own programming language. However I have not found any information on a Mac version (though I have not looked very hard).

    0 讨论(0)
  • 2020-12-23 12:59

    I've been programming with Matlab for about 15 years, and with Python for about 10. It usually breaks down this way:

    If you can satisfy the following conditions: 1. You primarily use matrices and matrix operations 2. You have the money for a Matlab license 3. You work on a platform that mathworks supports

    Then, by all means, use Matlab. Otherwise, if you have data structures other than matrices, want an open-source option that allows you to deliver solutions without worrying about licenses, and need to build on platforms that mathworks does not support; then, go with Python.

    The matlab language is clunky, but the user interface is slick. The Python language is very nice -- with iterators, generators, and functional programming tools that matlab lacks; however, you will have to pick and choose to put together a nice slick interface if you don't like (or can't use) SAGE.

    I hope that helps.

    0 讨论(0)
  • 2020-12-23 13:02

    python(x,y) is quite powerful, but only for Windows or Linux so you'll have to use bootcamp or Linux. A more lightweight package for mathematics is Matplotlib, which basically adds plotting abilities to the Python language (better used together with IPython).

    0 讨论(0)
  • 2020-12-23 13:09

    It would be great if the matlab to python conversion mat2py project at sourcefourge took off..

    0 讨论(0)
  • 2020-12-23 13:12

    Maybe you like sagemath, which 'combines the power of many existing open-source packages into a common Python-based interface'. Here is a feature tour.

    0 讨论(0)
  • 2020-12-23 13:13

    There are three aspects to consider when replacing Matlab with Python; the core language capabilities, the IDE and the Price.

    Capabilities Comparison

    This section outlines all of the capabilities of each platform. In short everything Matlab can do, Python can also do plus much more. However, things like linear algebra and rapid prototyping Matlab does more cleanly.

    Matlab

    Everything in Matlab is ready bundled and toolboxes are seamlessly integrated. It is also much more mature - but was not designed for general purpose programming meaning anything not linear algebra related is painful to implement.

    • Toolboxes: The Matlab toolboxes are very good and python implementations often struggle to compete with them (even for not so specialised things like optimisation algorithms).
    • Linear Algebra: Matlab has concise linear algebra capabilities which are easier to read and interpret.
    • Visualisation Capabilities: Has very good and very broad range of visualisation capabilities.

    Python

    Python will require a number of additional modules for it to become a good Matlabreplacement.

    • General Purpose Programming: Python is a proper programming language which offers a lot more flexibility over Matlab.
    • Numpy: Provides arrays and linear algebra routines, however has more awkward syntax than Matlab. I have fallen in love with the broadcasting feature however, no more repmat rubbish.
    • SciPy: Stats, optimization and other useful mathematical stuff.
    • MatPlotLib: Provides, in my opinion, higher quality plots than Matlab. Furthermore it is designed to be syntactically similar to Matlab so should be easy to pick up.
    • SymPy: Good symbolic programming package.

    IDE Comparison

    This is where python is lacking in my opinion. I simply find algorithm development (particularly involving a lot of linear algebra) less painful in the Matlab IDE.

    Matlab

    Here are some key Matlab features which will be hard to live without as an engineering student. Note that Python IDEs do have some of these capabilities also, but are more sloppily implemented.

    • Powerful Debugging: Can easily explore functions in a very non-restrictive manner. Python also allows for debugging but is often not as cleanly implemented in the IDEs.
    • Variable Explorer: MATLAB has a good variable explorer which always good for viewing of many supported data types. Some python IDEs struggle to display numpy arrays which can be annoying.
    • Variable Survival: If code breaks during runtime, the variables still persist which helps debugging. Furthermore it is easier to run different scripts in a row assuming persistent variables. In Python you will have to manually save variables in a script to have them available for other scripts.
    • Profiler: Very good for a breakdown of where your algorithms are bottlenecking.
    • Command Line Single line instructions can be executed on the command line. Python is full support for this also in all good IDEs.
    • GUI Plotting Tools: Results and variables can be quickly and painlessly plotted from the user interface. Most Python IDEs are geared towards software development and so don't support this (although sypder does have limited support through matplotlib).
    • Documentation: All functions have native documentation within the IDE.

    Python

    There are some new python IDEs which are starting to compete with some of MATLAB's key advantages. I personally like PyCharm which was recently released as a free community version. It has the following capabilities and is very well designed from a UI perspective.

    • Bebugging
    • Variable Explorer
    • Command Line
    • Documentation

    Price Comparison

    Python is free and has an active support community. Matlab also had a good support community too, but is anything but free.

    0 讨论(0)
提交回复
热议问题