5 ms·
I now use python, but Python is not even half the language Mathematica is for scientific computing. If only Mathematica was free, I think it would become the d
by abdullahkhalids 4y ago
I now use python, but Python is not even half the language Mathematica is for scientific computing.
If only Mathematica was free, I think it would become the defacto language for scientists.
The most important feature of Mathematica is that it is functional and not object-oriented. Mathematics is functional, not object-oriented. So thinking in Mathematica is as easy as thinking in maths. Thinking in python is to force yourself to think in an unnatural way.
- pharmakom 4y agoThere is Octave and Julia
- baq 4y agoMathematica is so much more it’s hard to even describe. It’s free on a raspberry pi, so if you have time and access to hardware, take a look.
- jrumbut 4y agoI think the so much more/hard to even describe is sort of a problem? There is a lot to it, and in my experience it's a very long road to getting your first problem solved. There are a lot of very cool pieces but I want it to be something I can pull off the shelf once in a while and be productive rather than something that I need to be an expert in before I can get started.
- prepend 4y ago> If only Mathematica was free, I think it would become the defacto language for scientists. Of course. It’s one of the few languages that I think are worth it. I’ve been waiting for Wolfram to open source it for 10 years as I can’t afford it, or really justify why my org should use it.
- ur-whale 4y ago> I’ve been waiting for Wolfram to open source it for 10 years as I can’t afford it, Wolframscript is free (not guaranteed to stay that way, as it isn't Open Source, but free for now). It can AFAIK do pretty much all Mathematica can. Only part missing is the Mathematica IDE/GUI/Notebook which I personally dislike profoundly anyways. Best of all, since it's a batch tool, it can be integrated in a Makefile and/or data processing pipeline without that nasty GUI showing up at all. https://www.wolfram.com/wolframscript/ https://www.wolfram.com/wolframscript/
- abdullahkhalids 4y agoI believe this is only the language. Not the set of libraries that come with Mathematica. Without those, one cannot do a lot in terms of scientific computation.
- pdonis 4y ago> The most important feature of Mathematica is that it is functional and not object-oriented. Python has object-oriented features but there is nothing that requires you to use them; you certainly don't have to express every Python program in terms of classes and methods, the way you do in Java. Doing functional programming in Python is common. Is there a particular aspect of doing functional programming in Python that you find to be a roadblock?
- abdullahkhalids 4y agoIt's more of the fact that all popular scientific libraries in python are written in an object-oriented way. That kind of forces you to write your own code in an OO way. I am guilty of this as I am writing a library myself. But users have to use, say numpy, along with my library. It would be suboptimal to force the user to constantly switch between functional and OO, so now my library is OO. On the other hand, all the code I wrote in Mathematica during my PhD was functional, because it is just easier to write functional in Mathematica.
- pdonis 4y ago> It's more of the fact that all popular scientific libraries in python are written in an object-oriented way. That kind of forces you to write your own code in an OO way. I'm not sure I see why. The object orientation in libraries like numpy or scipy is to provide the user with fast implementations of the kinds of mathematical objects they will need to do computations. But unless you are defining additional such objects in your own code, there's no reason why your own code needs to be object oriented. You can just write ordinary functional programs that use the mathematical objects the library provides. For example, say you are doing matrix computations. You are of course going to use the matrix objects provided by the library; but your own code shouldn't need to define any new matrix objects. Your own code can just be straightforward computations using the existing matrix objects in the library.
- v3ss0n 4y agoIt doesn't matter how libraries are written, in py you can use in functional way. I don't get what do you mean by forcing you to code in OO? I Had used pandas, scikit-learn, numpy, pytorch in production and I had never wrote them in OO way. Are we from same universe?
- klyrs 4y ago> Mathematics is functional, not object-oriented. I beg to differ. If by "math" you mean arithmetic and calculus, then sure. Combinatorics, graph theory; probably most of discrete math is very much object-oriented.
- abdullahkhalids 4y agoConsider a graph G, with vertices (a,b,...,z). Say, we want to find the shortest path between vertices a and m. A mathematician might write an algorithm called shortest_path(G, a, m) which might call the algorithm breadth_first_search(a) etc. Functions are called on objects to determine their properties. Or to modify them into other objects. This is what you see in math or theoretical CS papers. In python, in popular libraries, the above will be attained by something like G.shortest_path(a,b) which seems to imply as per OO that graph G has a property shortest_path. In mathematics we don't think like this. Because it prevents mathematical abstraction. An abstract algorithm, like say Eigenvalues can be applied to a matrix M or to a graph G. In a functional language, the user would just do Eigenvalue(M) or Eigenvalue(G) as needed. In python, these would be M.eigenvalues() and G.eigenvalues(), which makes them distinct.
- klyrs 4y agoWhat you're saying is not true of the most popular graph package in Python (networkx). Graphs there are objects with attributes (edges, nodes, etc) and methods (add_edge, etc), but algorithms such as shortest paths are functions as you have called most natural: shortest_path(G, a, b)
- abdullahkhalids 4y agoWell, I am glad that at least this library is being functional, rather than object oriented. I wish all the others did as well.
- klyrs 4y agoIt's still object-oriented, though. The graphs themselves are objects, which helps with ergonomics. There are also functions that operate on graphs, because the alternative would be to stuff perhaps thousands of methods into the graph class -- which would be extremely annoying to maintain as well as abysmally slow.
- Heston 4y agoHow does the speed of Mathematica compare to python or C?
- cycomanic 4y agoI think you're regarding Mathematica from a purely "theory/analytics" point of view, however I think you're missing the fact for a lot of scientific computing you want to interact with other things apart from numerics/analytics etc.. I believe that is really where Python shines and why it's also eating Matlab's lunch (more so than Mathematica's). It's incredibly easy to write a gui to interface with e.g. a scientific instrument do some reasonably fast analytics with numpy and possibly even produce publication ready plots. This is not really possible with Mathematica and while you can do this in Matlab, you need several toolboxes which are expensive, but more over are of extremely varying quality (let's not even talk about the horror of writing GUIs in Matlab). With Python, you have all of that for free, with a single tool (remember most scientists don't want to learn lots of programming languages).
- bee_rider 4y agoOctave/matlab is a little more enjoyable to use for matrix stuff in the REPL though. The game of “is this in Numpy or Scipy and why won’t it autocomplete” is kind of annoying, IMO. On the other hand, the non-mathematical functionality of Python of course is much better developed!
- analog31 4y agoI like Mathematica a lot, but a couple of issues limit its usefulness for me. First, I'm an experimental scientist, so a lot of programming is in the lab, automating experiments, running tests, etc. Makers of specialized software tend to choose their battles in terms of the application of their product, justifiably, but this means no single app is general purpose enough to serve me in the office, lab, and at home. Second, unless an organization is enlightened enough to approve a site license, specialized software tends to create a "silo" of people who can use it, and forces it to be used in a centralized fashion. With Python, I can literally install my tools on every computer that I touch -- in the office, multiple labs, at home, etc. It makes it more likely that a tool will be woven into "how I think." I can also share things and/or encourage others to try them out with minimal friction. Almost as easy as sharing an Excel spreadsheet within an organization that has purchased a site license. Free means free site license. The friction of approving a license also discourages people from learning a tool by just giving it a try on some trivial project, or taking it home.
- shanebellone 4y agoThis is great commentary.
- prpl 4y agoMathematica (and matlab for that matter) is effectively free at most national labs, and it’s still a tiny market share. That’s because scientific computing is rarely just scientists, but often includes engineers, SWEs, system admins, theorists, grad students, and more, solving lots of problems. If you can’t get wide adoption at a national lab, where are you going to get it? Similar problem with Julia and Fortran even. They all have their niches and are great at certain problems, but Python (and C/C++) rule the overall landscape. in HEP, for example, it’s even the case that a full batteries-included C++ environment (ROOT) has slowly given way to python.
- _yb2s 4y agoI was amused to notice that the Google trends map for Fortran was essentially a map of the US national labs.
- PeterisP 4y agoI feel that choosing the language based on how close it is to thinking in maths is putting the cart behind the horse, because in all scientific and applied scientific code I've seen, the actual math models is something like 10-20% of the code, and the majority is all the data management and plumbing around that; so you should pick the language based on how easy and maintainable the majority of the code will be, which is not the 'mathy' part of it.
- steve1977 4y agoI often like to compare Python and Mathematica to English and Latin. English is not really a beautiful language - it’s a wild mess of different influences, but it’s easy to get to a basic level of fluency as there are few rules (but many exceptions due to the many influences). And it’s in use by large parts of the world. On the other hand, Latin is beautiful and pure. It has more rules, but very few exceptions. You can also see how it influenced other languages (hello Jupyter notebooks…) But it’s simply not a very practical language today, as there are few people who use it.
- 411111111111111 4y ago> It has more rules, but very few exceptions. ... That we know about. It's a dead language, so the exceptions would've been lost to time as it hasn't been spoken in ages. Your point stands regardless, just felt like being nitpicky