3 ms·
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,
by chongli 4y ago
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 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.
- paulpauper 4y agoWolfram Alpha is free alternative for most uses. Good enough for most people.
- abdullahkhalids 4y agoVariable 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.
- loa_in_ 4y agoIt's possible to get the same result in sympy with some metaprogramming, and it does absolutely support longer names for variables!
- geysersam 4y agoSubscripts 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.
- anigbrowl 4y agoYour 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.
- whyever 4y agoYou can leave out the assignment, `var` already injects the variables into the local scope. IIRC, the commas are redundant.
- jwilk 4y agoInto global scope.