I'm looking to create a 6x6 matrix in a program and then add data to the individual cells. How can the matrix be created? I want the matrix in the program; I do not want to create the matrix in calculator mode. I've used the following to create a matrix with 3 columns of 6 rows; is there an easier way? I'm starting to think that it's a terrible calculator to try to program.

a:=augment(n_x, n_y) 'join two columns as list (x and y coords)
b:=list▶mat(a, 2) 'convert list to matrix of 2 columns
c:=list▶mat(n_z, 1) 'convert third column list to matrix of 1 column (z coord)
b:=augment(b, c) 'join third column to 2 column matrix
Disp b 'test to see that there are 3 columns in matrix (x, y, and z coords)
Disp b[2, 2] 'display element of matrix; third column of matrix has 0 values

I assume that you can use M01[4,3]:=27 to place 27 in [4,3] location.

Dik
Your problem is not the calculator, it's the language. Nspire basic has been summed up in a nutshell as 'awful'.

I believe that you will have a much easier time learning C for this. Although I'm not sure what differences there are programming C on Nspire vs the 84 Plus CE, Cemetech already has several great C programmers to help you with this. Nspire Basic on the other hand, it just doesn't have the community support that 84 Basic and C/ ASM do.

If you really feel like you want to learn a different Basic, I (and most others) would highly recommend getting the TI-84 Plus CE. It's Basic language is incredibly well documented, and can be optimized pretty easily. Remember that 'Resource' that was pretty empty I told you about earlier? Well this is where that site shines, everything you need to know about 84 Basic is right there. If you really wanted, you could also get a Programming the TI-83/84+ book written by Cemetech's creator Cristopher "Kerm Martian" Mitchell. Although it focuses on the monochrome calculators, all the basics and syntaxes you learn are carried over to the CE.

Wow, I just felt like a salesman there.
I'm sorry for your troubles with the Nspire. But even after a half hour of Google searching, I couldn't find anything to help you.
Thanks for the response... the TI Nspire is badly crippled... great for just calculations... but, that's it.

Dik
Nspire-Basic is only awful if you want to makes games (or stuff with graphics), basically. For such interactive content, you have Nspire-Lua.
For math/science related stuff, Nspire Basic is pretty great (but not perfect, sure, and so are any other calculator languages)

TheLastMillennial wrote:
Nspire Basic on the other hand, it just doesn't have the community support that 84 Basic and C/ ASM do

That's pretty much only true for Cemetech though Razz

___

Oh and for your new matrix question, take a look at the newMat(numRows,numColumns) and constructMat(Expr, Var1, Var2, numRows, numCols) functions.
Thanks for the info; I hadn't encountered those functions before and I've not seen them referenced except for the reference guide (just now). I've tried the following:

local a 'with and without
disp "Matrix" 'just to provide a heading
a:=newmat(6,6) 'also tried newmat(6,6)->a
a[2,3]:=5
disp a

and both approaches end up with an error message and do not execute. Any suggestions? Is it possible to construct this from within a program? The functions may be fine for using the calculator in calculator mode, but, not for programming. Tried both and neither seem to work. I want to construct a matrix from within a program so that I can fill the cells.

Any suggestions on how to call a function or another program from within a program; this is fundamental to nearly all programming languages. I can write a function and access it readily from a new math app, on a page within a problem, but cannot access it from a program on a different page within the same problem. The function shows up as a variable name and not a 'bold' function name. Function can be saved as public, private or neither.

My exposure to Nspire basic it that it's terrible... simple programming is not straightforward, and partially due to my lack of experience with it. There are just so many issues.

Thanks Dik
Can anyone provide a solution?

Dik
Calling newMat in a program works fine for me, as expected.



(I took this screenshot a few days ago but wasn’t able to post)
Thanks, I can do that from a new page from within the same problem, but, if I include the command from within another program as below, I get an error. Nearly all programming languages I've encountered allow you to make these commands or function calls from within the program you are writing.


Code:
Define rigidframe()=
prgm
  Local counter, i, j, jk, a          'fails with and without a as Local'

 © Bunch of Code

 ©Determine Degree of Freedoms
  a:= newMat(2,3)
  a[2,3]:=2
  disp a

© Bunch of Code

EndPrgm


and end up with the following error message:


Argument must be a variable name.

Make sure that the name:
◆ does not begin with a digit
◆ does not contain spaces or special characters


I have the same problem in calling a function from within the program, I cannot call the following either as a libpub or libpriv. It works OK from a new page, but, not from within a program.



Code:
Define LibPriv str_fill(strvar,numchars)=
Func
   Local counter,strng
   strng:=""

   For counter,1,numchars
      strng:=strng&strvar
   EndFor
EndFunc


Dik
Protip #1: type "[code]" before your code, and "[/code]" after it!

Result:

Code:
Lorem ipsum dolor sit amet, novum saperet ne eam, nullam utroque efficiantur no pro. Aliquid salutandi vix in, in sit fugit indoctum voluptatum. Eirmod virtute platonem no vis, etiam convenire salutandi id ius. Ut platonem consetetur vis.


Protip #2: go into "edit profile" (should be on the left side of your page, towards the top), and scroll down to "edit signature". In the box, you can type something, and it will appear on the bottom of every one of your posts!
iPhoenix:

Thanks very much... Dik
  
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 GMT - 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