Enter two matrices and get a resulting answer....


Code:

Prompt [A],[B]
dim([A]->LIST1:dim([B]->LIST2
Delvar LIST31->C:Ans->A    //Delvar LIST3:1->C
For(Z,1,LIST(1
1->B
Seq([A](A,X),X,1,LIST1(2->LIST4
For(Y,1,LIST(2
Seq([B](X,B),X,1,LIST2(1->LIST5
Sum(LIST4LIST5->LIST3(C   //Sum(LIST4*LIST5->LIST3(C
B+1->B:C+1->C
End:A+1->A:End

The elements of the multiplication are stored in LIST3
Now time to sort it in to a matrix....

Code:

1->A
{LIST1(1),LIST2(2->dim([C]
For(Z,1,LIST1(1
For(Y,1,LIST2(2
LIST3(A->[C](Z,Y
A+1->A
End:End
Pause [C]->Frac


I know that it would be simply [A]*[B], but since European History was too easy and boring, i figured that it might be possible to replicate two matrices being multiplied together.... Laughing

Please optimize this code b/c I got way over my head over this.... (If possible...) Wink
[quote="QuinnZhao"]Enter two matrices and get a resulting answer....


Code:

Prompt [A],[B]
dim([A]->LIST1:dim([B]->LIST2
Delvar LIST31->C:Ans->A    //Delvar LIST3:1->C
For(Z,1,LIST(1
1->B
Seq([A](A,X),X,1,LIST1(2->LIST4
For(Y,1,LIST(2
Seq([B](X,B),X,1,LIST2(1->LIST5
Sum(LIST4LIST5->LIST3(C   //Sum(LIST4*LIST5->LIST3(C
B+1->B:C+1->C
End:A+1->A:End

[quote]


hmm, I'm not quite sure what you are doing with B & A, endlessly clearing list3 and never using the Mat-->List function =D

Code:

Prompt [A],[B]
0-->dim(List3
dim([A]->LIST1
dim([B]->LIST2
1->C
For(Z,1,LIST(1
Seq([A](Z,X),X,1,LIST1(2->LIST4
For(Y,1,LIST(2
Seq([B](X,Y),X,1,LIST2(1->LIST5
Sum(LIST4LIST5->LIST3(C  //Sum(LIST4*LIST5->LIST3(C
C+1->C
End
End


it would be nice if you wrote an input system for the matrices... cuz inputting them manually is kinda a P.I.T.A.
What about just having the user use the built-in matrix input interface? That would be a heck of a lot easier and quite a bit more elegant.
KermMartian wrote:
What about just having the user use the built-in matrix input interface? That would be a heck of a lot easier and quite a bit more elegant.

Try giving this another read Razz :
QuinnZhao wrote:
I know that it would be simply [A]*[B], but since European History was too easy and boring, i figured that it might be possible to replicate two matrices being multiplied together.... 0x5
No, read mine more carefully. I was responding to rthprog's comments about the awkwardness of inputting matrices at a prompt and suggesting using the built-in editor to enter the matrices, then run this program to perform the multiplication.
..well yes, it would be simpler, but come on... writing your own matrice input code would be pretty shweet =D I mean seriously, if hes wasting time doing this then he might as well...
It wouldn't be overly hard... I could probably come up with something, if I didn't have 10 other projects poking me in the back with sharp objects.. :S
tifreak8x wrote:
It wouldn't be overly hard... I could probably come up with something, if I didn't have 10 other projects poking me in the back with sharp objects.. :S


what would be really interesting is if you made it ala celledit, allowing true spreadsheet functionality in a subroutine =D wow I think Im going to try that once I get some free time =D
That was exactly what I was thinking to do, which would make it fairly easy to accomplish. Then again, now I am workin on pokemon purple again, I think someone might hunt me down if I stopped... Razz
tifreak8x wrote:
That was exactly what I was thinking to do, which would make it fairly easy to accomplish.


how is that fairly easy? In tibasic its a pain to update all the values for formulas particularly when they reference eachother =( How would you do it cuz all I do is store the numeric value to a list, the formula to a string, and solve through y-vars... which takes a good 30 seconds to go through 3 times or so...
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement