Oscar Benjamin writes: > On Mon, 17 Aug 2020 at 07:14, Stephen J. Turnbull > <turnbull.stephen...@u.tsukuba.ac.jp> wrote:
> > SymPy. > > > > Except that in this conversation, "linear algebra" is likely neither > > restricted to linearity nor so much algebraic as computational, so > > SymPy likely won't do. :-/ > SymPy is exactly what I would recommend for the OP use case of high > school students doing basic linear algebra (although perhaps as > maintainer I would say that...). SymPy's matrix class doesn't have the > complicated broadcasting rules of numpy's ndarray and uses exact > calculations rather than floating point (or limited precision > integers). I'm not sure why it would be considered unsuitable for > this. I didn't say it was unsuitable for high school students. It is, that's why I suggested it. My point was that most of the folks in this conversation don't really want linear algebra, they want fewer comprehensions and 'for' statements and maybe numerical stability (although Ricky's boring friction example doesn't need any special care for stability). Take broadcasting. It is really convenient, for example in computing central moments: vector = [ ... ] # known non-empty mean = sum(vector) / len(vector) variance = ((vector - mean) @ (vector - mean)) / len(vector) I'm not sure you want to allow that in a linear algebra class (although it's a mild and straightforward generalization of scalar multiplication, so maybe a little deemphasis on the "linear"?) > Here's a demonstration: Very nice! <img src="che.png" alt="clapping hands emoji"> > If your high-school students are okay with using Python then I would > certainly recommend SymPy for this kind of calculation. Sure. I just think they should write their own programs for four functions (3 binary operations and inversion, or 2 binary operations and both inversions) first. Once they've got that it's not obvious to me that at that level they need SymPy. (Although it's easy to imagine that in a class of junior high students the ones getting into it will run into numerical instability issues pretty quick, and of course anybody can mess up on conformance.) > On the other hand adding something like this to the stdlib is a very > slippery slope. SymPy's matrices package has 30k lines of code and > counting even though it leverages much of the rest of the sympy > codebase to do the calculations it does. There are a lot of different > features you can add once you have a matrix class. Thank you for pointing that out! Steve _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/22BQLC42M4HXYVWLS6LNIALM5HMHK2L5/ Code of Conduct: http://python.org/psf/codeofconduct/