12 ms·
Ask HN: I've never met someone who uses Mathematica, I imagine its users are even rarer outside the academic circles. I've met many who use Matlab, R, Python, E
by rayxi271828 3y ago
Ask HN: I've never met someone who uses Mathematica, I imagine its users are even rarer outside the academic circles. I've met many who use Matlab, R, Python, Excel, etc.
If you're using it, what are you using it for exactly? In what way is it irreplaceable by other tools out there, if at all?
- auggierose 3y agoIt is a very integrated environment with access to lots of mathematical tools. It is just a very nice and polished tool. I often just start it up to use it as a calculator!
- adamnemecek 3y agoSymbolic computation. Yeah, I guess you can do it in SymPy, but it's more painful. It's a really pleasant environment for certain type of work. The only thing missing is better type systems.
- Zambyte 3y agoHow does it compare to Lisp for symbolic programming?
- myhf 3y agoA lot of Lisp constructs like map and apply and macros have dedicated syntax in Mathematica, so they feel more like a fluent language. And the standard library is very large and impressively self-consistent. The default format is notebooks which helps make your work presentable.
- krackers 3y agoMathematica is basically the M-Expression version of lisp that never developed. The real power isn't just in the symbolic capabilities but the mathematical library.
- aragilar 3y agoMy understanding (from people who properly learnt Mathematica, and understood the language) is it is a lisp, but it's never taught that way, never explained, you're just searching for the magical function that does the thing you want.
- jabl 3y agoWhen people speak of "symbolic computation" in the context of mathematica, it's usually not about the Mathematica programming language itself, but rather about using Mathematica to do symbolical mathematics. A bit like how you did math with pen and paper in high school or university, except having Mathematica do all the hard stuff.
- lispm 3y agoLisp is at its core an evaluator for expressions. The routine for that is called EVAL. Mathematica is a computer algebra system at its core and is a rule-based rewrite system for expressions. An example in Lisp notation: In a computer algebra system (CAS) one may enter 5a - 2a > (- (* 5 a) (* 2 a)) The CAS would answer with: (* 3 a) It has used rules to simplify the expression and uses some default form. It could have printed a + a + a or 3 * a. It sees that it can't further simplify it, because a has no value and thus returns this simplified expression as it is. In Lisp things are differently. It takes an expression and tries to compute a value: > (- (* 5 a) (* 2 a)) The result in Lisp is "Error: unbound variable a". It can't compute a value, because during evaluation it sees that the variable a has no value. Evaluation of the unbound variable a is an error. Now you could write an expression simplifier in Lisp: let's call it simplify. Lisp has a quote operator, which returns the embedded thing as it is -> it is not evaluated. We can embed an expression inside quote and thus call simplify with that unevaluated expression as an argument. > (simplify (quote (- (* 5 a) (* 2 a)))) The result then could be (* 3 a) One then could write a input loop in Lisp (loop (print (simplify (read))) which then would not be a read-eval-print-loop, but a read-simplify-print-loop. (defun read-simplify-print-loop () (loop (print (simplify (read)))) This interactive loop would read expressions and print simplified expressions... Actually something like that has been done with computer algebra systems written in Lisp, like Macsyma/Maxima and Reduce. But they also then switched to infix syntax for input/output to make it easier for humans to enter mathematical expressions. Peter Norvig gave in his book "Paradigms of AI Programming, Case Studies in Common Lisp" extensive examples how to implement such a thing in Lisp: https://github.com/norvig/paip-lisp/blob/main/docs/chapter8.md https://github.com/norvig/paip-lisp/blob/main/docs/chapter8.... and https://github.com/norvig/paip-lisp/blob/main/docs/chapter15.md https://github.com/norvig/paip-lisp/blob/main/docs/chapter15... The advantage of the Mathematica language compared to Lisp is that it can compute with expressions via rules out of the box. Additionally Mathematica is so much more than that: it is an environment, a collection of mathematical knowledge, a cloud service, a specific product on can buy/rent, ... The drawback is that the semantics are murky and Mathematica is a two-language system: the fast internal code (and much of the environment) is written in C++ and the expressive language is on top. Lisp OTOH is often much more efficiently compiled with clear(er) semantics.
- 3y ago
- tomcam 3y agoI’m big on types and am sympathetic to your last point, but wouldn’t introducing types in any nontrivial way break compatibility on a catastrophic scale?
- adamnemecek 3y agoI mean it can be gradual. There already are ways of compiling functions which require type annotations, just make those less of a pain in the ass.
- qbit42 3y agoFind it pretty helpful as a math-adjacent academic. It's great at coming up with counterexamples to inequalities with FindInstance. I don't know how irreplaceable it is, but in general I find the UI for manipulating symbolic equations nicer to use than anything else I've tried.
- tnecniv 3y agoIt’s certainly the best of the symbolic computational tools that I’ve tried. However, my problem with such tools is that that they work great for simple examples in my experience but scaling them to work with non-trivial systems is rough. It may be user error on my part, but the path between simple and complex is non-obvious.
- peatmoss 3y agoI wonder if LLMs will provide a robust path from the solid symbolic computation of Mathematica to production or productionizable code. I've seen stories show up on HN about using LLMs to e.g. transform Cobol -> Java, and have my suspicions about how and where that kind of translation could fall down with today's LLMs. Nevertheless, I assume LLM enabled translators will improve rapidly, and that a product like Mathematica could be very well suited for translating from a prototype to a robust implementation for e.g. HPC.
- nxobject 3y agoIts "batteries included" philosophy (well, more like the entire power plant) – for example, very convenient and broad visualization and declarative UI libraries; very good online documentation as well; of course, the OG interactive notebook interface, too. If the cost of that is shining Stephen Wolfram's dome, well, what can you do.
- primitivesuave 3y agoI'm a software developer and use it for one-off tasks like image processing (create an SVG from a folder of images), quick visualization of data (read a giant JSON file and create bar charts from certain keys), file preparation, and much more. It's taken me several years to really feel like a power user, where I intuitively know which functions to use and how to compose/customize them. When I worked at Wolfram Research (over a decade ago), I even made a proof-of-concept for programming Arduino microcontrollers and controlling them directly from the notebook interface. It's a powerful tool with a steep learning curve - hopefully the LLM assistant will help with this.
- jiggawatts 3y agoI used to use it when I was at University and I kept a copy around for nostalgic reasons. Once in a blue moon I get an excuse to use it for work related reasons, and then I gleefully spin it up just so I can pretend to be a real mathematician / scientist type person. Generally this is superfluous, but I do it anyway, otherwise my tertiary education feels like a waste of time and money. Other times I use it as a replacement for a calculator app, which feels exactly like cracking a walnut with a 500-ton industrial press. It does have some reasonably unique capabilities that I did use more heavily in the past. E.g.: - Simplifying the vector/matrix mathematics used in 3D graphics. It can eliminate redundant expressions, which is especially useful when you know that some of the inputs are constants such as 0 or 1. - Non-linear curve fitting. If you have some complicated mathematical model you want to fit to noisy data, Mathematica will "just do it". With every other tool out there, this is... sss... hard. - It missed the AI boat, but it has mostly caught up and could now be a viable alternative to the Python-based AI ecosystem, especially for certain areas of research. - Complicated plotting requirements where I just can't be bothered spinning up some dedicated log analytics "tool" or subscribing to a "cloud service" and learning an entire query language just to draw a 3D histogram or whatever.
- aragilar 3y agoI've seen some people use it like you would use Matlab, R or Python (I wouldn't recommend it...), but it can (mostly) do symbolic stuff quite easily. I've seen it used in maths and physics, mostly by theorists. If you've made it part of your workflow, I suspect it's irreplaceable, but the best way to think about it is its one of those tools that gets used because the topic is small/bespoke enough that it's hard to build a replacement without having all the existing features (there a number of these in physics/engineering). Its biggest flaw is how much it wants to act as a black box, which means when something goes wrong, or isn't exactly what you want, you spend more time trying to fix it than solving the original problem.
- kccqzy 3y agoI do. I started using Mathematica in middle school and continued from there. My initial use case was simply double-checking I did my math homework correctly. A lot of Solve, DSolve, FindInstance, Reduce, FullSimplify, etc. I did a lot of plotting to visualize things: not just plotting functions of one variable, but parametric curves, inequalities, functions of multiple variables. When I studied linear algebra, I implemented Gaussian elimination myself as a learning exercise and I was very proud of it: the nice thing was that although the algorithm worked on matrices containing known numbers, it automatically worked for matrices containing unknowns thanks to its symbolic computation. When I studied basic image processing tasks like edge detection or the like, it was again of great help. When I got into personal investing, I did yet more calculations using the FinancialData function to retrieve financial time series and backtested many kinds of portfolio. When I got into trading options, it was of tremendous help to learn options from first principles, starting from the log-normal distributions, implementing Black–Scholes modeling, and then implemented the option greeks (delta, gamma, theta, etc) from scratch. Even as a regular software engineer, when I needed to work on algorithms, Mathematica is great help when I needed to do complexities analysis more sophisticated than interview-level big-O notations. I even used it as a SAT solver in a pinch, or a linear programming solver, when I knew there are other tools, but they won't be as nice as Mathematica or have higher learning curves than Mathematica's builtin documentation.
- NetOpWibby 3y ago[flagged]
- wenc 3y agoI used a bit of Mathematica but settled on Waterloo Maple because it had a cheaper academic license. Mathematica has stronger algorithms than Maple (like cylindrical algebraic decomposition), but for what I was using it for, they were both equally capable. I was working on mathematical models (large scale optimization). These are usually solved numerically, and in numerical mathematics, how you write an equation matters tremendously (for instance, the equality x/y = z is much worse than x = y * z for solvers especially if y is a variable that can take on 0 as a value because during iteration this might create a lot of NaNs in your Jacobian or Hessian matrices). I was using symbolic math to find better (but mathematically equivalent) ways to pose equations that would be numerically expedient. One example is using Groebner bases to do the equivalent of Gaussian elimination on a system of polynomial, which produces a row-echelon form and has many nice properties.
- latkin 3y agoI use it for hobby tinkering, it's quite fun to play around with. Excellent documentation, best-in-class symbolic capabilities, great visualizations/charting, everything you need is in the box (no fussing with dependencies). And once you get the hang of it, you feel very crafty doing complex functional-style transformations with minimal code. For example, my house experienced some flooding last year after exceptionally heavy rainfall. But how exceptional was it, really? I pulled out Mathematica and in a few minutes I had an interactive chart showing historical rainfall stats for my city over different time periods. The charting, interactivity, and weather APIs were all just built in.
- krackers 3y agoCan you post a code snippet for that plot, if you still happen to have it?
- latkin 3y agoI don't have that one handy right this minute, but I just remembered that I did a different weather exploration with Mathematica about a year ago. I had a hunch that Ironman triathlon was advertising their races as having cooler weather than they actually do. Turns out I was right -- here's my [slowtwitch post](https://forum.slowtwitch.com/forum/Slowtwitch_Forums_C1/Triathlon_Forum_F1/Ironman's_%22avg_air_temp%22_forecasts_are_whack_--_here's_the_data_P7854855/ https://forum.slowtwitch.com/forum/Slowtwitch_Forums_C1/Tria...), and the [associated code](https://gist.github.com/latkin/470a2f06056ee0a8e3f4da837af10741 https://gist.github.com/latkin/470a2f06056ee0a8e3f4da837af10...).
- xgstation 3y agoAFAIK physicists use it very heavily, but I barely know any mathematicians use it. To me this is a great tool for people who use Math heavily as a tool but not study Math itself. I use it for symbolic calculation, solve differential equations, and many complicated integrals, and its visualizaion build upon those with easy parametrize support is very nice. Starting from my ungrad sophomore year as physics major, we have courses require us to finish some homeworks with Mathematica. I can hardly find any other tool to replace mathematica in terms of symbolic calculation and doing complicated integrals (there is a joke by calling mathematica "large-scale integral table")
- slow_typist 3y agoAgree, Wolfram Alpha is heavily used by some students of physics to do their homework. We sometimes joked that was the main purpose of the service. Mathematicians probably have trust issues and use tools with a code base that is 3 orders of magnitude smaller.
- baq 3y agoImagine jupyter notebooks with a nice lispish language and the most complete standard library ever developed. Haven’t used it for almost 15 years, it was great back then, nowadays when I need something more than a simple calculator I go to wolframalpha - it’s basically Mathematica, but with one line of input instead of a notebook.
- mr_mitm 3y agoIt's noteworthy that Mathematica invented the notebook UI that Jupyter ended up popularizing. It has some strengths, but since its syntax highlighting is coupled to the kernel state it didn't have an undo function for the longest time. Also as big vim fan it's disappointing to not being able to use your favorite editor.
- v9v 3y agoEmacs has EIN which allows you to edit and run Jupyter Notebooks. Combining that with a vim keybindings mode like Evil, you can use vim bindings on notebooks. Edit: The github page for EIN says that development has stopped. Despite this, I was able to edit a notebook with only minor inconveniences very recently.
- struanr 3y agoAn actively developed alternative is emacs-jupyter, which allows you to use an org file similarly to a notebook.
- noneoftheabove 3y agoNo. Incorrect. There was a precursor that had the idea Of notebook but didn’t call it that. By your logic Wolfram invented symbolic computation, Computational complexity and many other things. Let’s Not go down that route please.
- rsecora 3y agoMathcad has the notebook metaphor (calculations embedded in live formatted documents) by 1986. Mathcad predates Mathematica by 1 year. [1] [1] Mathcad 2.0 Ad from 1987, the oldest I have found in 10 min. https://books.google.es/books?id=sc4TnHAYBSUC&pg=PA42 https://books.google.es/books?id=sc4TnHAYBSUC&pg=PA42
- dsign 3y agoIt's a great tool when you are a jack of all trades, master of none, though oftentimes better than master of one. You can use to decode phase-modulated signals, calculate stress distribution in some mechanical part, get an idea of how the orbit of a particular asteroid will look two hundred years for now, or just make a diagram of a set of events, among many, many other things.
- jabl 3y agoBackground: I did a PhD in computational physics. Starting as an undergrad, I extensively used mathematica to help or double check homework problems, plotting functions etc. For more "numerical" type of work, we extensively used matlab, so typically we used mathematica for more symbolical type problems. Later on, when working in physics, I often used mathematica, again mostly for doing things like symbolical integration, or things like quickly calculating symbolical gradients that I could copy-paste into some numerical software etc. I no longer work in academia so I don't have access to a mathematica license, but similar free tools are Sympy, Maxima, which are good for basic stuff but in my experience are not nearly as good as Mathematica for more complicated stuff. Or just the online wolframalpha.
- bryango 3y agoWolfram would like to say that he invented Mathematica all by himself, but in its core, it is basically a lisp: everything is an expression, and mathematics are just transformations of the expressions. Afaik this makes it the best tool (conceptually and practically) for generic symbolic manipulations. For example, `1 + 1` in Mathematica is just syntactic sugar for `Plus[1, 1]`, and `a = 1` is `Set[a, 1]`. I am a PhD student in theoretical physics and almost everyone in our field has no choice but to use it (I do know one or two people that use maple, but the overwhelming majority chooses mathematica). Despite its elegant design, many people hate it with a passion, as it has grown to be a huge bloated mess that takes forever to run. Also, due to the closed source nature, it is very hard to debug when something goes wrong. For example, it is quite often for the basic functions like `Simplify` and `Integrate` to get stuck running forever, but there is no way to keep track of the internal transformations that mathematica is doing, since everything is sealed up.
- funaculi 3y agoRe "it is a lisp" and "everything is an expression", I would like to add a bit of clarification.Or, given that you use Mathematica regularly while I was just reading surface docs (for purposes of doing some stuff with Wolfram Alpha), rather a question if my perspective is well-founded. Based on my understanding of how expression evaluation works, the slightly more revealing statements would be "it is a lot of lisp macros" and "everything is an s-expression". Which means, a big mess. Let me expand: As a functional programmer, "everything is an expression" sounds comforting, and I would expect there are clear transformation rules on how expressions are evaluated (and, maaybe, type signatures). Instead, what you get is, "you can throw in some random form of expressions into this function, and it will do something with them". As in, it takes an AST input, and transforms them in some loosely specified way. There doesn't seem to be a type system, so you don't have types to guide you, rather you likely need to figure what kind of expressions work with which functions. Now, if I'm wrong about this, and the functions behave consistently in what they take and how they transform it, then I'm more than open to be corrected. It is just that my high expectations (based on marketing of the lang) and the subsequent realization left me a bit bitter.
- 3y ago
- seanhunter 3y agoYou could replace the symbolic solving capabilities with wxmaxima[1] (which is free and opensource) and you would also find the linear algebra is waaay faster than mathematica, but the downside is maxima is weird and a bit user-hostile and its visualisation capabilities are kinda janky by comparison to mathematica which produces really nice visualisations. [1] https://wxmaxima-developers.github.io/wxmaxima/download.html https://wxmaxima-developers.github.io/wxmaxima/download.html
- Fbnkigffb66tfbj 3y agoI know that Citibank's foreign exchange market making desk was using Mathematica, at least they were 15 years ago. It's unusual in the quant world though. I think they had hired a bunch of PhDs who had spent too much time in academia.
- jampekka 3y agoFor solving math symbolically when Sympy and Maxima fail. I don't like it at all though.
- jan_Inkepa 3y agoI used it a lot in maths grad school for manipulating wretchedly large algebraic expressions. Just maths notation being well-supported and the interface for editing everything being nice made it the best tool for me. And it wasn't hard to use, not at all - bearing in mind I was just doing algebra. (This was all more than ten years ago).
- Smaug123 3y agoThe MIT Mystery Hunt starts today, and Mathematica is my go-to language and environment for puzzle hunts. As the saying goes, it's the second-best tool for everything. Fast iteration on ill-specified problems, trivial visualisation and interactivity and so on, an unparalleled range of built-ins to perform extremely complex tasks, building up huge blobs of personal state that you're going to throw away entirely in an hour.
- pclmulqdq 3y agoI love Mathematica and I use it a lot. It's like what happens if you take Matlab, R, or Python (ie any programming language primarily used for math), and turn it into a real functional programming language. It's not irreplaceable at all, but it's a lot nicer than the alternatives. It's generally pretty nice for any sort of mathematical programming, from designing control systems to statistics to simple graphing. It's also a pretty good language for basic scripting and data manipulation. Most of the mathematical work on my blog is done in Mathematica.
- deleted 3y ago[deleted]