# 2D variables and Matrices in Snap! #1031

Closed
opened this Issue Nov 29, 2015 · 4 comments

Projects
None yet
3 participants

### awangenh commented Nov 29, 2015

 I was toying with the idea of making an experiment in using Snap! to teach Linear Algebra/Basic Numeric Methods for either: a high school level maths class or an engineering freshmen numeric methods course; This would include basics such as Matrix Inversion and Determinants and, in the college case, go up to things as Newton-Raphson, Gauss-Seidel, Gauss-Jacobi, etc. I thought: someone must have had this idea before! So I searched: this list, the joy of Computing, scratch.mit and scratched.harvard and what I found was extremely disappointing: (a) A few projects in Scratch that employ, in the best case, clumsy lists-of-lists, which are all, without exception, unclearly programmed, complicated and inadequate as "good teaching examples" and all much more difficult to understand than a simple FORTRAN or C++ program that does the same thing (should be the opposite...): (b) A discussion thread about how making lists-of-lists easier to use as representations of matrices in Scratch that ends with the suggestion of a dirty hack in JSON in order to allow passing the name of a list of lists as a parameter (really not a solution): Concerning Snap! I was unable to find anything. In order to elegantly be able to be used as a platform to teach linear algebra, Snap! should be able to represent matrices in a way that allows: to visualize the variables as real matrices and not as nested lists of lists; to use and address them as any other variable; Isn't this an interesting goal to pursue? Snap! has a lot of features that makes it much better in implementing math problems than Scratch. But this part I was unable to find. Yours, Aldo

Collaborator

### brianharvey commented Nov 29, 2015

 Let me try to tease apart several issues here. Scratch does not have lists of lists. In Scratch, you have to use some complicated mechanism or other to work around that, either C-style index arithmetic or some kind of list-of-names-of-lists kludge. Snap! does allow lists of lists, so it's not hard to implement array operations: or my favorite: You ask for to use and address them as any other variable. Lists are first class in Snap!. We already do what you want. On visualization, it's true that list watchers are currently one-dimensional, exposing the list-of-lists implementation. But you'll be pleased to know that we are already planning (pretty soon) to add a two-dimensional watcher capability. So, we already do 2/3 of what you want, and the rest is coming!

Author

### awangenh commented Nov 30, 2015

 Dear Prof. Harvey, these are real good news! I was imagining the following situation: You use Snap! to make maths classes more interesting for high school students (and in order to show immediate applications of the theory). Now you have this 16-year-olds class in front of you and you have told them that they can either: learn everything about determinants or forget about going to college ...and then you present the image below as an "easy to understand representation of a 2x2 matrix"... ...you'll probably be in your best way to become the most hated teacher in the school... Matrices muts be showable in a simples and easy to understand way if Snap! is to become a tool that you can use to integrate and make STEM classes more interesting. Thanks! Em 29/11/2015 18:48, Brian Harvey escreveu: Let me try to tease apart several issues here. ``````Scratch does not have lists of lists. In Scratch, you have to use some complicated mechanism or other to work around that, either C-style index arithmetic or some kind of list-of-names-of-lists kludge. Snap/!/ does allow lists of lists, so it's not hard to implement array operations: arrayitem or my favorite: transpose `````` ``````You ask for to use and address them as any other variable. `````` Lists are first class in Snap/!/. We already do what you want. On visualization, it's true that list watchers are currently one-dimensional, exposing the list-of-lists implementation. But you'll be pleased to know that we are already planning (pretty soon) to add a two-dimensional watcher capability. So, we already do 2/3 of what you want, and the rest is coming! — Reply to this email directly or view it on GitHub #1031 (comment). "It is difficult to get a man to understanding something when his salary depends upon his not understanding it." Upton Sinclair Prof. Dr. rer.nat. Aldo von Wangenheim Executive Director National Research Institute on Digital Convergence - INCoD Universidade Federal de Santa Catarina - UFSC 88049-200 Florianopolis - S.C. Brazil Phone: +55-48-3721-4715 (INCoD/LAPIX) +55-48-3721-4714 (Telemedicine) E-Mail: awangenh at: inf.ufsc.br Skype: awangenh Personal: http://www.inf.ufsc.br/~awangenh INCoD: http://www.incod.ufsc.br/ Coordinator: Cyclops Group Brazil http://www.cyclops.ufsc.br/ `````` Image Processing and Computer Graphics Lab http://www.lapix.ufsc.br/ Telemedicine Lab/UFSC University Hospital http://www.telemedicina.ufsc.br/ ``````
Collaborator

### brianharvey commented Nov 30, 2015

 On 11/30/15 12:53 AM, Aldo von Wangenheim wrote: they can either: learn everything about determinants or forget about going to college Surely that's not really true. Maybe if they want to go to college in STEM fields.
Owner

### jmoenig commented Feb 18, 2016

 dear @awangenh , sorry to get back to you so late. I wanted to let you know that the next major Snap release (v4.0.5) will feature a table view widget for 2D lists. I've written up some preliminary documentation (mostly screenshots) here: http://snap.berkeley.edu/snapsource/jens/Tables%20in%20Snap.pdf And there is a live dev version you can play with here: http://snap.berkeley.edu/snapsource/dev/snap_dev.html I'm curious whether this addresses some of your suggestions. Thanks!