Live data from Hacker News

SymPy makes math fun again

wordsandbuttons.online

41–50 of 96 posts

Re: SymPy makes math fun again

#41
post #29

I've solved some Math assignments using SymPy on my sophomore year in uni. One time instead of writing them down to paper (the assignment was like “you have 24 hours to take these 20 integrals”), I've just shown the script I coded to my teacher and got an A. (And I have dropped out the very same year then :-)

You got an A for translating the problems into computer form? I'm glad you dropped out of that useless program.

This is a surprisingly toxic take. The goal of a program is to teach you real world skills grounded in understanding theory. If someone understands how to take a complex math problem and turn it into a computer program, and knows to reach for sympy - that feels far more useful and implies a solid enough understanding of the problem at hand.

Re: SymPy makes math fun again

#42

I like sagemath. They have integration with sympy, and they also have many features making python simpler when you want to do mathematical things. There's latex display feature when in notebook. It looks good, can even have symbolical matrices and display them as you would've expected. It's on par with Wolfram notebook, but you get to program in python instead of some propietary language. If you got some really long…

As someone who does research with computer algebra systems (mainly Wolfram Mathematica) many hours a day, I think that SymPy is still far behind Mathematica. The fundamental design of Mathematica based on replacement rules and a style of functional programming is quite difficult to beat in terms of ease of use. A few weeks ago I gave SymPy another try, and tried to implement a nested sum of the type 1 <= a_1 < ... <…

SymPy is a great tool but there isn't a dedicated team of mathematicians and programmers working on it full time. I believe it has potential to compete with Mathematica someday.

Re: SymPy makes math fun again

#44
post #14

Earlier quoted context omitted.

Just write: a, b, c, d, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u, v, w, x, y, z = var('a, b, c, d, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u, v, w, x, y, z') At the top of your Jupyter notebook, right after your import lines, and copy and paste it everywhere else. It's really not a big deal! You can always redefine these variables to other things later, if you need to. Mathematica costs $387 for the "home deskto…

Variable names are not arbitrary. They have meaning. Single-letter lower-case variables hardly cover all possible names. Mathematica, just like, real mathematics, allows you to have variable names with subscripts/superscripts/greek-letters etc. E.g. a_g is distinct from a_f (which are both rendered in rich text) My recommendation is not that everyone buy Mathematica, but that sympy figures out a way to allow every se…

It's possible to get the same result in sympy with some metaprogramming, and it does absolutely support longer names for variables!

Re: SymPy makes math fun again

#47
post #14

The fact that you have to declare every single variable makes it a non-starter for me. In Mathematica, I have written calculations that involve dozens of variables. In sympy that will be very annoying.

Just write: a, b, c, d, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u, v, w, x, y, z = var('a, b, c, d, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u, v, w, x, y, z') At the top of your Jupyter notebook, right after your import lines, and copy and paste it everywhere else. It's really not a big deal! You can always redefine these variables to other things later, if you need to. Mathematica costs $387 for the "home deskto…

Your points are valid and the workaround is indeed easy, but it is strangely clumsy and inelegant. I put up with it because I like SymPy a lot, while not needing to use it so often that the awkwardness really chafes. But if I was doing more serious math work or doing it professionally I'd probably spring for the Mathematica license despite finding Wolfram personally annoying.

Re: SymPy makes math fun again

#48
post #16

The fact that you have to declare every single variable makes it a non-starter for me. In Mathematica, I have written calculations that involve dozens of variables. In sympy that will be very annoying.

You can start a REPL with `isympy -I`, which is an IPython REPL but with some preprocessing magic that wraps any unknown variable into a sympy symbol and any integer into a sympy integer, which makes it closer to Mathematica: In [1]: 22/7*foobar Out[1]: 22⋅fo̅o ────── 7

Underrated suggestion - thanks a lot.

Re: SymPy makes math fun again

#49
post #14

Earlier quoted context omitted.

Just write: a, b, c, d, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u, v, w, x, y, z = var('a, b, c, d, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u, v, w, x, y, z') At the top of your Jupyter notebook, right after your import lines, and copy and paste it everywhere else. It's really not a big deal! You can always redefine these variables to other things later, if you need to. Mathematica costs $387 for the "home deskto…

Variable names are not arbitrary. They have meaning. Single-letter lower-case variables hardly cover all possible names. Mathematica, just like, real mathematics, allows you to have variable names with subscripts/superscripts/greek-letters etc. E.g. a_g is distinct from a_f (which are both rendered in rich text) My recommendation is not that everyone buy Mathematica, but that sympy figures out a way to allow every se…

Subscripts on symbols you can do in sympy as well. Also multiple subscripts.

In your formulas you can have Greek letters in sympy. But you'll have to give the symbols valid python names.

Re: SymPy makes math fun again

#50
post #12

Nice article. I totally agree about SymPy making math fun. I used Mathematica a lot in college, but stopped once it wasn’t free to me anymore. Here’s a blog post I made recently showing some fun SymPy calculations. https://www.swied.com/posts/make-a-ringtone-sound/make-a-rin...

Wolfram Engine + VS Code (notebook plugin), anyone?
Post reply on HN