Live data from Hacker News

SymPy makes math fun again

wordsandbuttons.online

31–40 of 96 posts

Re: SymPy makes math fun again

#31
post #17

As a mathematician, the least fun I have is when interacting with a CAS. The degree to which one needs to do this tends to be field specific, but the tedium of calculations seen is most undergraduate courses is negligible.

What is most fun for you?

Re: SymPy makes math fun again

#32
post #21
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...

I do wonder how many have just never been exposed to Mathematica and Matlab. I don't think they were perfect, by any measure; but a lot of the things people find amazing about modern open source tooling were near table stakes for advanced tooling decades ago.

Not entirely sure why you are downvoted; it seems to have taken decades to get to where we are with Jupyter/sympy/numpy/scipy and similar setups.

I left matlab behind years ago, but I still use mathematica occasionally.

Though I haven't made a serious effort to try out Maxima, Reduce, or Sagemath.

Re: SymPy makes math fun again

#33
In case anyone is interested to learn more about SymPy, check out this printable tutorial: https://minireference.com/static/tutorials/sympy_tutorial.pd... It covers basic fundamentals (high school math like solving equations), calculus, mechanics, and linear algebra.

The tutorial is also available in notebook form: https://github.com/minireference/sympytut_notebooks/tree/mas... Binder link: https://mybinder.org/v2/gh/minireference/sympytut_notebooks/...

Re: SymPy makes math fun again

#34

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 < ... < a_k <= n over a complicated summand f(a_1, ... ,a_k), where k and n are integer arguments, and it took me ages to figure out how to implement this in SymPy, whereas I in Mathematica I can write this in a minute.

Re: SymPy makes math fun again

#35

Learning how to derive the taylor series or memorizing the formulas with some rough understanding of how to derive them sounds easier than learning a programming language Regarding his low exam performance , this is why classes are sometimes graded on a curve. Intro calc. is pretty easy, and the author def. seems smart enough to do well. Likely his class was unusually hard. Sometimes that happens..luck of the draw.

See my post on HN a few weeks back: https://news.ycombinator.com/item?id=34734412

Re: SymPy makes math fun again

#36

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

Is that maybe because you are familiar with Mathematica?

Re: SymPy makes math fun again

#37
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…

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 sequence of letters and numbers (that start with a letter) to automatically become a variable without declaration.

Re: SymPy makes math fun again

#38

Earlier quoted context omitted.

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

Is that maybe because you are familiar with Mathematica?

I don't have experience with SageMath, but if they are really running on Python, then they are surely giving up on some of the nice rewriting that Mathematica is based on, as I would expect then a library call is needed instead in Python.

Re: SymPy makes math fun again

#39

Earlier quoted context omitted.

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

Is that maybe because you are familiar with Mathematica?

No. In Mathematica important operations like mapping functions over sets (arrays/tensors) at various depths have simple operators such as (/@, @, @@, @@@). You can do functional composition using @*, etc. You don't need to define your variables and functions before being able to write them in expressions. Often you want to have intermediate terms that have some temporary name, and which get substituted later on. The replacement rules in Mathematica are very powerful for this.

As another example, I googled some project Euler solutions in Mathematica and (pure Python) and found this: https://www.nayuki.io/page/project-euler-solutions. Compared to the pure Python solutions, the Mathematica code is typically much smaller. Of course this is not Sympy, but a lot of the Python syntax carries over to SymPy as well.

Re: SymPy makes math fun again

#40
SymPy is very powerful, and at times, a little infuriating, but that is probably my own noob-ishness. On the whole, I am extremely glad it exists, we've been using it inside the PyTorch compiler for dynamic shapes, and it has been an overall great time.

I strongly encourage interested folks to pull it down and give it a spin. The printing/printer system, which the author touches on briefly with `jscode` is a brilliant way of converting sympy expressions into whatever you like. I found it a pretty smooth experience to write my own little printer.

Post reply on HN