I now use python, but Python is not even half the language Mathematica is for sc... (2024)

abdullahkhalids on Dec 30, 2022 | parent | context | favorite | on: Why I'm still using Python


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.

I now use python, but Python is not even half the language Mathematica is for sc... (1)

cycomanic on Dec 30, 2022 | next [–]


I 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).

I now use python, but Python is not even half the language Mathematica is for sc... (2)

bee_rider on Dec 31, 2022 | parent | next [–]


Octave/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!

I now use python, but Python is not even half the language Mathematica is for sc... (3)

analog31 on Dec 31, 2022 | prev | next [–]


I 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.

I now use python, but Python is not even half the language Mathematica is for sc... (4)

shanebellone on Dec 31, 2022 | parent | next [–]


This is great commentary.

I now use python, but Python is not even half the language Mathematica is for sc... (5)

prpl on Dec 31, 2022 | prev | next [–]


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

I now use python, but Python is not even half the language Mathematica is for sc... (6)

UniverseHacker on Dec 31, 2022 | parent | next [–]


I was amused to notice that the Google trends map for Fortran was essentially a map of the US national labs.

I now use python, but Python is not even half the language Mathematica is for sc... (7)

pdonis on Dec 30, 2022 | prev | next [–]


> 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?

I now use python, but Python is not even half the language Mathematica is for sc... (8)

abdullahkhalids on Dec 30, 2022 | parent | next [–]


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

I now use python, but Python is not even half the language Mathematica is for sc... (9)

pdonis on Dec 31, 2022 | root | parent | next [–]


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

I now use python, but Python is not even half the language Mathematica is for sc... (10)

v3ss0n on Jan 1, 2023 | root | parent | prev | next [–]


It 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?

I now use python, but Python is not even half the language Mathematica is for sc... (11)

prepend on Dec 30, 2022 | prev | next [–]


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

I now use python, but Python is not even half the language Mathematica is for sc... (12)

ur-whale on Dec 31, 2022 | parent | next [–]


> 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/

I now use python, but Python is not even half the language Mathematica is for sc... (13)

abdullahkhalids on Dec 31, 2022 | root | parent | next [–]


I 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.

I now use python, but Python is not even half the language Mathematica is for sc... (14)

steve1977 on Dec 31, 2022 | prev | next [–]


I 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.

I now use python, but Python is not even half the language Mathematica is for sc... (15)

411111111111111 on Dec 31, 2022 | parent | next [–]


> 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

I now use python, but Python is not even half the language Mathematica is for sc... (16)

PeterisP on Dec 31, 2022 | prev | next [–]


I 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.

I now use python, but Python is not even half the language Mathematica is for sc... (17)

klyrs on Dec 30, 2022 | prev | next [–]


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

I now use python, but Python is not even half the language Mathematica is for sc... (18)

abdullahkhalids on Dec 30, 2022 | parent | next [–]


Consider 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.

I now use python, but Python is not even half the language Mathematica is for sc... (19)

klyrs on Dec 30, 2022 | root | parent | next [–]


What 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)

I now use python, but Python is not even half the language Mathematica is for sc... (20)

abdullahkhalids on Dec 31, 2022 | root | parent | next [–]


Well, I am glad that at least this library is being functional, rather than object oriented.

I wish all the others did as well.

I now use python, but Python is not even half the language Mathematica is for sc... (21)

klyrs on Dec 31, 2022 | root | parent | next [–]


It'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.

I now use python, but Python is not even half the language Mathematica is for sc... (22)

osigurdson on Dec 31, 2022 | root | parent | prev | next [–]


Since you capitalized it, it looks like a static method on the “G” class. There is nothing OO about static methods - this is purely and organizational construct.

I now use python, but Python is not even half the language Mathematica is for sc... (23)

cft on Dec 31, 2022 | root | parent | prev | next [–]


I think it's the superclass A of both G and M that defines the eigenvalue() function. Then when both G(A) and M(A) inherit from A, it captures the mathematical relationship. The subclasses indeed should implement the eigenvalues computations differently, like in real mathematics.

Funcional programming is used in Coq because it captures logical chains, for theorem PROOFS, but not for specific COMPUTATIONS, such as eigenvalues.

I now use python, but Python is not even half the language Mathematica is for sc... (24)

abdullahkhalids on Dec 31, 2022 | root | parent | next [–]


I understand that this is possible. But this is not how mathematicians think. If you got together a bunch of mathematicians and asked to invent a programming language to do mathematics, they would never ever invent the concept of a class.

Mathematics (outside of stuff like category theory etc) is simply sets and mappings between sets. Anything more complicated is forcing the user to think in a way that mathematics does not.

I now use python, but Python is not even half the language Mathematica is for sc... (25)

klyrs on Dec 31, 2022 | root | parent | next [–]


> But this is not how mathematicians think. If you got together a bunch of mathematicians and asked to invent a programming language to do mathematics, they would never ever invent the concept of a class.

Hi, mathematician here. Please read the source of SageMath: written by mathematicians, for mathematicians. Therein, you will find thousands of classes. Almost all computer algebra systems, written by mathematicians for mathematicians, have a notion of classes.

> Mathematics (outside of stuff like category theory etc) is simply sets and mappings between sets.

This is an extremely narrow-minded view of mathematics. Mathematicians thrive on abstraction, (category theory is literally mathematics; that's a very strange exception for you to carve out), and if we were to boil everything down to "simply sets and mappings between sets" then we'd be bogged down in utter tedium and nothing would ever get done. Object-oriented programming, specifically class hierarchies and inheritance, are extremely valuable for doing all sorts of math at high levels of abstraction.

Hell. If I were to be especially pedantic, I'd point out that category theory itself is "simply sets and mappings between sets" except that sets aren't quite large enough so it's actually "categories and mapping between categories".

I now use python, but Python is not even half the language Mathematica is for sc... (26)

CuriouslyC on Dec 31, 2022 | root | parent | prev | next [–]


Since the eigen decomposition is specifically a property of the matrix representation of the graph, but other things like shortest path distance between two nodes are naturally enough computed on graphs formed by objects with pointers, perhaps the correct interface is G.adjacency_matrix().eigenvalues().

I now use python, but Python is not even half the language Mathematica is for sc... (27)

agumonkey on Dec 31, 2022 | parent | prev | next [–]


object orientation here means boxing side effects behind methods, math doesn't seem to bother with implicit mutable state

I now use python, but Python is not even half the language Mathematica is for sc... (28)

weakfortress on Dec 31, 2022 | parent | prev | next [–]


"Most discrete math is object oriented"

...what?

I now use python, but Python is not even half the language Mathematica is for sc... (29)

klyrs on Dec 31, 2022 | root | parent | next [–]


There are a lot of hierarchies in the families of objects that discrete mathematicians are interested in. Inheritance is extremely natural in such settings.

I now use python, but Python is not even half the language Mathematica is for sc... (30)

Heston on Dec 30, 2022 | prev | next [–]


How does the speed of Mathematica compare to python or C?

I now use python, but Python is not even half the language Mathematica is for sc... (31)

pharmakom on Dec 30, 2022 | prev [–]


There is Octave and Julia

I now use python, but Python is not even half the language Mathematica is for sc... (32)

baq on Dec 30, 2022 | parent [–]


Mathematica 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.

I now use python, but Python is not even half the language Mathematica is for sc... (33)

jrumbut on Dec 30, 2022 | root | parent [–]


I 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.

I now use python, but Python is not even half the language Mathematica is for sc... (2024)

FAQs

Is SymPy better than Mathematica? ›

I'm not arguing that SymPy is going to beat Mathematica on benchmarks. But if both of them meet your needs, and you like having money and/or control of the code, SymPy wins. So, in this we don't really disagree. But, I would only agree that it is an objectively better choice for you.

Is wolfram mathematica easy to learn? ›

How difficult is it to learn? The Wolfram Language is broad and deep, but it's built on a small number of principles that are easy to learn. It's also got highly responsive predictive user assistance that's always suggesting what to do next. It's got hundreds of thousands of live examples.

Is Sagemath better than Mathematica? ›

Sagemath is a Python library (and a rather large one at that). It's vastly superior to Mathematica and Maple at some things (e.g., number theory and algebraic combinatorics) and inferior at other things (e.g., symbolic integration).

Is Mathematica the same as wolfram language? ›

The Wolfram Language is the programming language used in Mathematica. Mathematica 1.0 was released on June 23, 1988 in Champaign, Illinois and Santa Clara, California.

Is Mathematica a high level language? ›

Mathematica's very high-level character and unified scalable architecture makes it possible to start creating sophisticated programs almost immediately, and then smoothly transition to full production systems deployed in enterprise, web and other environments—with long-term stability and automatic seamless algorithm ...

Do mathematicians use Mathematica? ›

Engineering emerges as the single most common use of Mathematica. Within engineering, electrical engi- neering is the most common subfield, followed by mechanical engineering. mathematicians, the number of math- ematicians in the world is small rela- tive to the total number of scientists and engineers.

Why is Maple better than Mathematica? ›

Maple includes interactive tutors for integration, differentiation, finding limits, and more. Students can solve problems on their own step-by-step, and Maple will provide a hint or the next step when asked, so students can practice and learn. Mathematica has nothing like these step-by-step tutors. Programming syntax.

Is SageMath faster than Python? ›

The timing for SageMath kernel is 1 loop, best of 5: 186 ms per loop , while that for Python is 1 loop, best of 5: 7.07 s per loop .

Is Mathematica license forever? ›

No. While your subscription is active, you will have both desktop and cloud access to Mathematica. If your subscription lapses, you will retain perpetual desktop access but will lose access to Mathematica in the cloud, upgrades and advanced technical support (if previously included with your subscription).

Can I get Mathematica for free? ›

Try Mathematica for Free

Sign in or create a Wolfram ID to get your free 15-day trial of Mathematica.

What is better than Mathematica? ›

Explore other competing options and alternatives. Other important factors to consider when researching alternatives to Mathematica include user interface and functionality. The best overall Mathematica alternative is MATLAB. Other similar apps like Mathematica are Scilab, GNU Octave, Maple, and SageMath.

Who owns wolfram Mathematica? ›

Stephen Wolfram is the creator of Mathematica, Wolfram|Alpha and the Wolfram Language; the author of A New Kind of Science; and the founder and CEO of Wolfram Research.

What are the advantages of SymPy? ›

The real power of a symbolic computation system such as SymPy is the ability to do all sorts of computations symbolically. SymPy can simplify expressions, compute derivatives, integrals, and limits, solve equations, work with matrices, and much, much more, and do it all symbolically.

What is faster than SymPy? ›

Try symengine (https://github.com/symengine), which is much faster than sympy but less functionalities (only basic functions of sympy). It also has python wrappers (https://github.com/symengine/symengine.py).

Is SymPy slow? ›

As one point of comparison, SymPy is comically slow compared to Sage.

Top Articles
Latest Posts
Article information

Author: Aracelis Kilback

Last Updated:

Views: 5406

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Aracelis Kilback

Birthday: 1994-11-22

Address: Apt. 895 30151 Green Plain, Lake Mariela, RI 98141

Phone: +5992291857476

Job: Legal Officer

Hobby: LARPing, role-playing games, Slacklining, Reading, Inline skating, Brazilian jiu-jitsu, Dance

Introduction: My name is Aracelis Kilback, I am a nice, gentle, agreeable, joyous, attractive, combative, gifted person who loves writing and wants to share my knowledge and understanding with you.