The interactive js visualizations are super cool, I didn’t know SymPy could do that Lately I’ve been using SymPy and Pluto.jl together, it’s been great for deriving results and making interactive visualizations for numerical code at the same time
SymPy makes math fun again
11–20 of 96 posts
Re: SymPy makes math fun again
#12Here’s a blog post I made recently showing some fun SymPy calculations. https://www.swied.com/posts/make-a-ringtone-sound/make-a-rin...
Re: SymPy makes math fun again
#13There'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 formula, it's easier to see you got it correctly by displaying it symbolically in latex.
They have other things to smooth out the parts of python which are annoying in math, like exponentiation works with ^, and dividing integers returns a rational number instead of floating point or an integer.
Re: SymPy makes math fun again
#14The 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.
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.
Re: SymPy makes math fun again
#15Regarding 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.
Re: SymPy makes math fun again
#16The 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.
In [1]: 22/7*foobar
Out[1]:
22⋅fo̅o
──────
7Re: SymPy makes math fun again
#17Re: SymPy makes math fun again
#18The 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…
Re: SymPy makes math fun again
#19Re: SymPy makes math fun again
#20I 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…
SageMath also has a multivariate inequality solver IIRC. `*` is repeated multiplication (exponentiation) in Python. If you require preprocessing to translate ^ to *, you don't have valid Python code that'll run with any other interpreter.
Is it easier to import SageMath from a plain Python script now; with conda repackaging?
Type promotion in Python:
from rational import Rational
assert Rational(1, 4) / 2 == Rational(1, 8)
Python 2 had a __future__ import to do floatdiv instead of floordiv: from __future__ import division
assert 3 / 2 == 1.5
assert 3 // 2 == 1
assert 4 / 2 == 2.0
Python 3 returns floats from ints or decimals IIRC: assert 3 / 2 == 1.5
assert 3.0 / 2 == 1.5
assert 3 // 2 == 1
assert 4 / 2 == 2.0