Live data from Hacker News

SymPy: Symbolic Mathematics in Python

sympy.org

101–110 of 137 posts

Re: SymPy: Symbolic Mathematics in Python

#101

Symbolic mathematics is severely underexplored in undergraduate studies, and the little exposure I had was generally tied to proprietary software such as Mathematica and MATLAB. I learned to use it as an imperfect extension of pen-and-paper thinking, and source code for more advanced stuff gets shaky the deeper into abstraction one goes. For example, I work in a field of mathematics/engineering that requires heavy us…

For great justice, does anyone know of any applications (other than Maple) that support WYSIWYG typeset input (not output) like Maple does? As far as I know, Wolfram/Mathematica, LaTex, SymPy, Jupyter, Sage etc all rely on typewriter text for composing and inputting math. For this (and only this) reason, Maple is the only application that ever resonated with me, because input may be written in the same form it's writ…

There's a lot of them. In principle every CAS that has a TeXmacs interface can do it (FriCAS, Maxima, Reduce ... oo). E.g. https://news.ycombinator.com/item?id=19465270.

Re: SymPy: Symbolic Mathematics in Python

#102

As an aside - I have a bunch of logical expressions and I need to see if they are mutually exclusive. As in, if one is true given some combination of the variables, none of the other expressions must be true for the same combination. For example Country="US" and Type="Sales" is not exclusive with Type in ("Sales", "Purchase") What would be an approach to solving this?

If your logical expressions aren't too strange, and there aren't too many, that's well suited to an SMT solver, such as Z3.

You might, for example, create a new logical expression for each pair of your original expressions, joining each pair with AND, and then join those AND pairs with OR. Then ask the SMT solver to generate an unsatisfiability proof.

Re: SymPy: Symbolic Mathematics in Python

#104
post #11

Working in the field of robotics, I often have to write big vectors ( usually computed as the result of 3D transformations ) and then compute their Jacobian ( their derivative with respect to several state-variables ), which quickly becomes very nasty equations. I use sympy to (i) compute these big vectors, expressed in a very declarative way, (ii) compute the jacobian and (iii) export the results in C-code, immediat…

Yes, back in the day I saw people doing this with Maple, glad there's open source options now. There's a cool library (also using Sympy) to do this kind of thing in robotics and computer vision applications, symforce https://github.com/symforce-org/symforce

Re: SymPy: Symbolic Mathematics in Python

#105
post #39

There is a benchmark of Sympy vs Mathematica at https://www.12000.org/my_notes/CAS_integration_tests/reports... The results were Mathematica failed to solve 1,523 problems, Sympy failed to solve 48,529. So it has some catching up to do.

Although super interesting, the website you mention is only about integrals...

I mean, integrating is one of the operations you might want particular help with. Especially for integrands without elementary function integrals.

Re: SymPy: Symbolic Mathematics in Python

#106
post #82
post #46

Earlier quoted context omitted.

Do you know why there's such a big difference ? For example, is the way sympy does its job fundamentally flawed ?

I mean, literally people with Math PhDs are being paid to work on the product, full-time. And they have a financial incentive to address feedback from customers and try to solve as many problems as possible. By comparison, open source projects are developed by people with a wide range of knowledge level and commitment, and you simply can't expect the quality to be the same. I find that discussions on HN often fail to…

Yep. Know a few in the math department that have worked on Mathematic. Don’t know any who have worked on SymPy.

Re: SymPy: Symbolic Mathematics in Python

#107
post #93

Earlier quoted context omitted.

SymPy is open source, mathematica is not. Additionally, SageMath (which depends on SymPy) is the more comparable product (and is open source).

> SymPy is open source, mathematica is not. Why does that matter?

1) free

2) able to be around if a single CEO isn't around (Wolfram)

3) able to continue if the supporting company is not profitable anymore

4) possibility of greater oversight if popularity rises

5) extensible if one puts the effort into it

Re: SymPy: Symbolic Mathematics in Python

#108
post #11

Working in the field of robotics, I often have to write big vectors ( usually computed as the result of 3D transformations ) and then compute their Jacobian ( their derivative with respect to several state-variables ), which quickly becomes very nasty equations. I use sympy to (i) compute these big vectors, expressed in a very declarative way, (ii) compute the jacobian and (iii) export the results in C-code, immediat…

I tried to use SymPy for a similar problem: computing the Jacobian of a complicated integral using quaternion rotations.

Problem was that the symbolic results were way too complicated and the simplify function didn't help much. So, I got back to manual differentiation.

Re: SymPy: Symbolic Mathematics in Python

#109

SymPy is awesome indeed! I've been using it as a teaching tool for many years. IMHO, it's the best option as compared to Mathematica/Maple/etc. because the API functions match exactly the verbs students use when learning math (solve, expand, factor, etc.). Here is a little tutorial for anyone looking to get started: https://minireference.com/static/tutorials/sympy_tutorial.pd... Also available in runnable notebook fo…

Glad to see some tutorials!

Re: SymPy: Symbolic Mathematics in Python

#110
post #107
post #93

Earlier quoted context omitted.

> SymPy is open source, mathematica is not. Why does that matter?

1) free 2) able to be around if a single CEO isn't around (Wolfram) 3) able to continue if the supporting company is not profitable anymore 4) possibility of greater oversight if popularity rises 5) extensible if one puts the effort into it

And that matters if you are mostly worried about value, to a large extent. If you are evaluating "better" as in "supports more symbolic operations," none of those really enter into it? Right?

This is like opining that the best "car" out there is a gokart you can get complete schematics on, for all of these reasons. I think most of us would accept the argument that the better cars are the ones that pass metrics aimed at cars. In this analogy, the better algebra system is the one that does the most algebra.

Post reply on HN