The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

Interesting TI Nspire CAS CX programming features
Message #1 Posted by Namir on 14 Apr 2012, 5:04 p.m.

Hi All,

I decided to tinker with the TI Nspire CAS CX calculator and do some programming. The first feature that caught my attention is the ability to prompt for an equation (as a function of x). This allows one to write numerical analysis routines (e.g for solving roots and calculating the area under the curve) for equations that the user enters at run-time!

The other feature is the creation of matrices and vectors by a program. Here, I had to use a trick to first create an identity square matrix and then over-writing its elements with different values. To create a vector that has the same number of rows as a square matrix, I first create a vector made up of the diagonal elements of the square matrix and then assign new values to the vector.

Interestingly, the TI Nspire programming model regards vectors as either column matrices or row matrices. This means that when you access the elements of a vector you have to specify both the row and column indices. This dual orientation has to be monitored during the program development phases so you can correctly access the elements of a vector either as a row or a column matrix.

Namir

      
Re: Interesting TI Nspire CAS CX programming features
Message #2 Posted by Joerg Woerner on 14 Apr 2012, 6:38 p.m.,
in response to message #1 by Namir

Namir,

Watch it out! Working too long with the CX makes you addicted and you quit using HP calculators...

Have a great weekend and happy programming!

Cheers, Joerg

            
Re: Interesting TI Nspire CAS CX programming features
Message #3 Posted by Namir on 14 Apr 2012, 11:53 p.m.,
in response to message #2 by Joerg Woerner

The worse part is that I am working with the Teacher version of the CAS CX emulator. So typing in the source code is a easier than on the machine.

The ability to declare variable and parameter names that are longer than one or two letters is also addictive!!!

Namir

            
Re: Interesting TI Nspire CAS CX programming features
Message #4 Posted by Namir on 15 Apr 2012, 4:22 p.m.,
in response to message #2 by Joerg Woerner

I did find the newMat command to create matrices of any size and with zeros as initial value for the matrix elements. The TI Nspire has the construtMat function that creates a matrix of any size and fill its values based on a user-defined expression that uses the indices of the rows and columns. For example,

constructMat(1/(i+j),i,j,3,4)->A

creates a matrix, A, with 3 rows and 4 columns. The value of each element A(i,j) is based on the values of row index i and column index j using the expression 1/(i+j).

Finally, the function randMat creates a matrix of any size with random values in its elements.

Namir

Edited: 15 Apr 2012, 4:23 p.m.

      
Re: Interesting TI Nspire CAS CX programming features
Message #5 Posted by Alexander Oestert on 15 Apr 2012, 3:16 a.m.,
in response to message #1 by Namir

The equation prompting part has been possible on the 50g for ever. Like so:

<< "Y=" PROMPT 'EQ' STO >>

Then you can go on solving or whatever you like to do with that equation.

            
Re: Interesting TI Nspire CAS CX programming features
Message #6 Posted by Namir on 15 Apr 2012, 4:11 p.m.,
in response to message #5 by Alexander Oestert

Way super cool Alexander!!! Thanks for the tip!

Namir


[ Return to Index | Top of Index ]

Go back to the main exhibit hall