![]() |
Bizarre TI-89 matrix algebra error (not language specific)
I am trying to write a Basic program for my TI-89 calculator to solve matrices. For some weird reason this function is not built-in to the calculator, which has stuff to do mostly everything else.
I don't think this is language-specific; I think that if you know other programming languages you may be able to help. I haven't done BASIC in five years, and this is my first go at TI-89 BASIC, and it didn't take me very long to start from scratch. If you know about matrixes and you can program then you probably can help. The matrix I am trying to do is 1 -1 0 5 -1 1 5 2 0 1 1 0 The solution of this matrix is 1 0 0 18/5 0 1 0 -7/5 0 0 1 7/5 But my function, solvemat(x), spits this out instead 1 1/4 0 13/4 0 5/4 0 -7/4 0 -1/4 1 7/4 So far you're thinking, he just made some stupid error in his code that he'll catch in a minute before I even reply. But I don't think so. Point 1: Applying the function twice, solvemat(solvemat(x)) returns the correct result Point 2: The key value, where it seems to be screwing up, is on the number at position [2,2] (indexing in BASIC starts from 1). Altering that number in any way causes the program to function perfectly correctly. If I put .5 or 2 instead of 1 in that position, or even 1.0001 or 9999/10000 instead of 1, it gives the right answer. WHAT THE HELL IS GOING ON? Here is my code, with Java-style comments (the TI-89 comment character is unprintable): :
solvemat(x) // the name of the function. x is the matrixPlease help! It's driving me nuts. I suppose I could just make another function solvemat2(x) that is just solvemat(solvemat(x)) but I'm doing this for fun anyway and I want to know what's happening. Maybe it's a calculator bug. |
| All times are GMT -5. The time now is 11:33 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC