Dec 4, 2006

NXT: Meeting Your Algebra Needs

Recently in algebra, I learned about matrices and how to solve equations with them. One of the excerices I had to do was write a computer program that would solve two equations with two variables in the form ax + by = c (where a, b, and c are constants) using matrices. The user would input the 6 constants (a, b, and c for both equations), and the program had to solve the equation and give the x and y values.

My brother had done this last year with his game programing software. Not wanting to be outdone, I put together a program over thanksgiving break that succesfully solves the equations. Using the NXT buttons, a user inputs the 6 constants, whereupon the NXT instantly displays the x and y values (unless the equations were inconsistent or dependent, of course).

It's really neat - especially because I now have an excuse to have my NXT during schooltime! ;)

You can download the main program here, and a zip file with the needed My Blocks here (you'll need to put the My Blocks in the Mindstorms folder for My Blocks).

Here's a picture of inputting the constants (the 6th one is currently being input).

And here's a picture of the solution set (x and y).



Jim Kelly said...


GREAT job!! I haven't had a chance to look at the program yet, but I'm very interested to see your code.

It's easy to forget that the NXT brick is really a small computer, capable of doing much more than directing motors and receiving input from sensors.


Jonathan said...

Thanks Jim. It was pretty easy to do, after I got the inputting code down.

And yeah, I think that's what I like best about the NXT - it's computer-like capabilities.


Michael said...

Cool. Can't wait to get my NXT!


Related Posts Plugin for WordPress, Blogger...