Join 3,496 readers in helping fund MetaFilter (Hide)


The use of Linear Algebra in Programming.
December 23, 2012 10:46 AM   Subscribe

I just finished my first course in Linear Algebra. I know a fair amount of Python. Please help me come up with a project that combines the two.

This past Fall semester, I took Linear Algebra I, a 200-level Math class at my school. (The next class, sequentially, is Linear Algebra II -- a 300-level class which is much more proof based.) I don't want to list everything that I learned, but I will say that the course covered a lot of material, and was quite rigorous.

Through the lectures, my professor would frequently reference Linear Algebra's application to computer science/computer graphics (e.g. how each pixel in an image can effectively be manipulated as an entry in a matrix).

Likewise, I want come up with a project that combines my newly acquired knowledge of Linear Algebra, with my ability to program.

A couple of notes with regards to the type of project that I am looking for:

1. I'm not really interested in game design or computer animation (and I know that both are predicated on Linear Algebra).
2. I really like databases. In addition to Python, I know/am learning SQL -- I would love something of the sort that combines matrix manipulation with querying a database (if this is even a thing.)
3. I'm learning Django, so any idea that involves building a (not too complex) web app would be great.

Thanks a lot!
posted by lobbyist to Technology (11 answers total) 13 users marked this as a favorite
 
Well, I reviewed Khan Academy's Linear Algebra videos. I don't know if they're less rigorous than the course you took (probably), but then I started playing around with this in Python.

I didn't really understand what I was doing but more or less got it to work. Perhaps it's a starting point.
posted by dfriedman at 10:51 AM on December 23, 2012 [1 favorite]


3d graphics is most easily done with 4x1, 4x4 and 1x4 matrices, and implementing a simple ray tracer is a great way to play with algebra and transforms. You can do it with high school algebra, but it's easier with 4x4 matrices. The only problem is that there are already a gazillion implementations.

But if you start to look at matrices as collections of data, there are a lot of analysis techniques in genomics, things like protein expression analysis, that work on matrics with a thousand or ten thousand rows and columns. Finding a data set that'd be useful for computational biology that you can explore Principal Component Analysis or similar on could be a lot of fun!
posted by straw at 10:54 AM on December 23, 2012


Unsupervised machine learning is basically all linear algebra with a coating of stats for reliability statistics, and like all languages python has its share of machine learning packages.

Two things I personally have been poking around with recently are non-negative matrix factorization (NMF) and hidden markov models (HMM). Scipy and numpy get you pretty far. I understand orange is the best-regarded generalized machine learning packages, though I'm still at pretty preliminary stages in my fiddlings. Natural language toolkit NLTK is good if you want to look at corpus/document based things.

Edit to add: The reason I mention corpus/document based things in particular is that depending on scale you might have some reliance on databases/database-like things. Some general problems are topic identification/classification, author identification, and preference classification.
posted by PMdixon at 11:16 AM on December 23, 2012 [1 favorite]


There are a number of network analysis techniques that use linear algebra - Google's PageRank, for instance, is computed as an eigenvector. One of the standard ways of representing a network is the adjacency matrix.
posted by obvious at 11:29 AM on December 23, 2012


How about implementing something like this online matrix calculator?

And, if you do, I'd appreciate if you could let me know.
posted by aroberge at 11:37 AM on December 23, 2012


Face recognition algorithms are all about eigenvectors. OpenCV is a great computer vision library with pretty good Python support. Here are two tutorials on face recognition in OpenCV. It's a lot of fun to feed in your webcam video and detect your own face, but it works on static images too. Building a web app login system that uses face recognition (like face unlock on Android devices) would be a pretty cool project.
posted by ecmendenhall at 11:47 AM on December 23, 2012


1. I'm not really interested in game design or computer animation (and I know that both are predicated on Linear Algebra).
2. I really like databases. In addition to Python, I know/am learning SQL -- I would love something of the sort that combines matrix manipulation with querying a database (if this is even a thing.)


There's an infant startup in Estonia working on putting together a database of math problems for school teachers to use for classwork and homework. I didn't fully understand what they're exactly trying to do but I did understand they are building a database of math problems. Can I put you in touch with them ?
posted by infini at 1:50 PM on December 23, 2012


"tensor algebra" is related to JOIN in SQL as in this patent.

i'm pretty sure the "relationship" between tensor algebra and relational databases is standard stuff but it's not my field and i'm too lazy to dig something up. tensor algebra is a logical continuation of what you learned in linear algebra, where you define "products" on vectors which produce a new construction called a tensor rather than a vector. so vector spaces are subsumed in tensor spaces.

anyway, tensors are pretty standard mathematics which you could learn from a ton of books (you may have had an intro in your linear algebra class) and a logical continuation of linear algebra and i bet in some advanced DB book you can find the relationship between them and relational databases explained...
posted by ennui.bz at 2:56 PM on December 23, 2012


Get up on a kaggle challenge! You could use scikit-learn which makes use of numpy, scipy, and matplotlib, all of which are things that combine Python with Linear Algebra, and much more.
posted by oceanjesse at 2:19 AM on December 24, 2012


I came in to suggest a simple raytracer too.
posted by aeighty at 8:14 AM on December 24, 2012


You may also wish to explore the APL family of languages (APL, J, and K) - they're based on linear algebra. K's killer app, kdb+, combines vector/matrix operations with databases for a high-performance finance database. (K/kdb+ is rather expensive, though there is a demo version of q, the new commercial K, at Kx.)

Two free, open-source options are J (recently open-sourced) and kona, a sort-of clone of K that I've contributed to.
posted by silentbicycle at 9:21 AM on December 24, 2012


« Older My shower runs hot, then cold,...   |  How can I unlock an iphone tie... Newer »
This thread is closed to new comments.