5 ms·
SymPy's problem is that it is based on an object-oriented language. This results in SymPy (and friends) demanding that users abandon hundreds of years of math n
by abdullahkhalids 6y ago
SymPy's problem is that it is based on an object-oriented language. This results in SymPy (and friends) demanding that users abandon hundreds of years of math notation, to conform to the whims of a programming language.
In SymPy you do M.diagonalize(), which makes no sense. The matrix M does not have a property diagonalize. Rather, you should apply a choosen diagonalization algorithm like Diagonalize(M) to produce a new matrix.
Mathematica wins, and will continue to win, because the language is functional and conforms to how Mathematicians think, rather than how (EDIT: certain) programmers like to code.
- vanderZwan 6y ago> Mathematica wins, and will continue to win, because the language is functional and conforms to how Mathematicians think, rather than how programmers like to code. Or maybe Python "will win" because it conforms to how programmers think, rather than forcing them to think like mathematicians (also, why capitalize "mathematicians" in your sentence?), letting them get their shit done. More importantly, "win" what exactly? It makes no sense to talk about "winning" if you don't even properly define a victory condition and context first.
- joshuaissac 6y agoIt depends on who the intended users of SymPy are. If they are programmers, then conforming to how programmers would think would be useful. If it is targeted at mathematicians, then confirming to how programmers think would just be another unnecessary hurdle to using the library, and would hurt adoption (which is what "win" means here).
- Koshkin 6y ago> conforms to how programmers think Python is an important tool in general, it allows to automate many tasks that otherwise would have to be done manually. I wish more non-programmers knew how to use it.
- billfruit 6y agoMay be the way mathematicians notate is frankly ambiguous and confusing, and recent decades of programming experience have given good insight into more expressive methods of notation.
- enriquto 6y ago> recent decades of programming experience as opposed to recent millennia of mathematical experience?
- whimsicalism 6y agoLet's not pretend math notation has remained constant for millennia.
- enriquto 6y agoOf course it has evolved. But some landmarks of it (e.g., using single letters for "variables") have been used since 2500 years ago. Now I laugh when programmers tell me to be "civilized" and name my matrices with full words.
- snakeboy 6y agoExactly, it has been refined over millennia.
- creata 6y agoRight, and it's important to remember that mathematics is sharply optimized for human understanding, whereas programming languages strike a careful compromise between human understanding and efficient execution by machines. I don't think anyone could seriously argue that programming languages are "more expressive" than mathematical notation, which has the powers of ambiguity and hand-drawn graphics.
- Koshkin 6y agoYou are not wrong. Replace 'efficient execution by machines' with 'efficient processing by a compiler' and you will be even more correct.
- ByteJockey 6y agoThere's no reason you can't do this. Python has free functions. It was an intentional style choice to do it this way. You can also make a diagonalize function that just calls the method if you like that style better, half of python's generic functions (e.g. len) just call methods anyways.
- deleted 6y ago[deleted]
- leephillips 6y agoThis is problem I have with Python in general; that even if you prefer to use it in a functional style, most libraries are written by real Python programmers, and using them will force you to grapple with the object-oriented inversion of common sense (https://lee-phillips.org/pythonhate/ https://lee-phillips.org/pythonhate/). My favorite example is: ','.join(['a', 'b'])
- creata 6y agoWhat's wrong with (','.join(['a', 'b']))? If it's the order of arguments, then I want to point out that the order has two big advantages: * partial application is actually useful: I've actually used (','.join) before, but (lambda sep: sep.join(['a', 'b'])) seems relatively useless. That's why Haskell also uses this order with (intercalate sep listOfStrings). * it accepts any iterable, rather than just lists.
- leephillips 6y agoWhat strikes me as weird about this is that our intent is to do something to the array of strings, so we are looking for a function that takes this array and transforms it into something else. But we are obligated to invert our intuition here, and write this as if we are doing something to the punctuation that we want to insert between the array elements. It’s backwards, and causes us (me, anyway) to keep forgetting how to use this method. I must have gotten this wrong a dozen times. The sensible way would be something like join(array, separator). That is straightforward, and would be hard to get wrong. It could even be written in a way where the order of arguments didn’t matter, so you wouldn’t even have to remember that. Why is the separator privileged as the implicit first argument of `join`? I accept that you’ve identified some advantages of the Python version; it’s always possible to find cases where object.method() notation gets you something.
- hakuseki 6y ago> It could even be written in a way where the order of arguments didn’t matter Well, 'hello'.join(', ') does not produce the same output as ', '.join('hello'), so the order of the arguments does matter.
- deleted 6y ago[deleted]
- unionpivo 6y agoSympy is great for people who occasionally need such programs. Any serious mathematician will have his or her preferred software that he uses daily anyway. Sympy works for people who know programming (not just programmers, but researchers in general) who need to use it occasionally.