In Mathematica, I have written calculations that involve dozens of variables. In sympy that will be very annoying.
In Mathematica, I have written calculations that involve dozens of variables. In sympy that will be very annoying.
In [1]: 22/7*foobar
Out[1]:
22⋅fo̅o
──────
7 In [1]: (foo + 1) ** 7
Out[1]:
7
(foo + 1)
In [2]: expand(_)
Out[2]:
7 6 5 4 3 2
foo + 7⋅foo + 21⋅foo + 35⋅foo + 35⋅foo + 21⋅foo + 7⋅foo + 1
In [3]: diff(_)
Out[3]:
6 5 4 3 2
7⋅foo + 42⋅foo + 105⋅foo + 140⋅foo + 105⋅foo + 42⋅foo + 7
In [4]: expand((cats+dogs)**5)
Out[4]:
5 4 3 2 2 3 4 5
cats + 5⋅cats ⋅dogs + 10⋅cats ⋅dogs + 10⋅cats ⋅dogs + 5⋅cats⋅dogs + dogs
In [5]: hip + hip + hooray
Out[5]: 2⋅hip + hooray 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 desktop" version, or $194/year for the online version. Pretty steep for anyone doing math as part of their hobby. Maybe it would be fine if math itself is your hobby, but even then I'd rather spend that on books.
Of course this is all moot if you're an academic and your school pays for all the licenses to any software you need.
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.
In your formulas you can have Greek letters in sympy. But you'll have to give the symbols valid python names.
(it puts things in the global namespace, but for the typical calculator use case that's probably fine)
(Sage seems to work like this too - it may use sympy under the hood)