Author Topic: TI - Npsire, CAS; many programming questions  (Read 7466 times)

0 Members and 2 Guests are viewing this topic.

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: TI - Npsire, CAS; many programming questions
« Reply #15 on: May 12, 2011, 04:04:59 am »
To get all the row cells in a columns, the best way is to flip the matrix using the 'transpose' command:
disp mstmT[3]
This should give you the data you want.

Then, about the indirection thing (#), it works like this:
Code: [Select]
"hello"->var1
"test"->#var1
var1 will then contain "hello", and hello will contain "test".
This will also work with values in a matrix ("test"->#mat[1,1]).

For the string searching, I assume you want too look through a list and or matrix?
As far as I know, you can't search matrixes and lists. You will have to make your own routine to do that:

This is for a matrix:
Code: [Select]
"findme"->searchstr
0->result
rowdim(matrix)->rowsize
coldim(matrix)->colsize
for yyy,1,rowsize
  for xxx,1,colsize
    if matrix[yyy,xxx] = searchstr then
      1->result
      exit
    endif
  endfor
endfor

searchstr is the string (it can also be a number) you want to search for.
If it is found, result will be 1, and the coordinates will be in yyy and xxx.
It might be that I switched rowsize and colsize, but thats easy to fix if its wrong.
You only need one for loop if you are searching a list.
Another way to check if something is in your matrix and/or list, but you don't need to know the position is this:
Code: [Select]
instring(string(matrix),"searchme")->result
If result is not 0, is means that "searchme" is in the matrix. This will also be faster than the above routine, but you don't have an accurate index.
« Last Edit: May 12, 2011, 04:06:48 am by jimbauwens »

Offline dduce

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +0/-0
    • View Profile
Re: TI - Npsire, CAS; many programming questions
« Reply #16 on: May 12, 2011, 01:06:56 pm »
jimbauwens, that's brilliant!

It took a little work, but I got it working. Here's the section of code. It stores the row and column index in separate variables. I can certainly work with this. Thank you, and thank you for covering the indirection portion as well. This is very helpful, being that row1 of my matrix has all my variables stored in it as a string.

Thank you all for everything!

here's the working code:
Code: [Select]
{ion,charge,sznm}→mstm
Request "For which Ion?",searchstr
rowsize:=rowDim(mstm)
colsize:=colDim(mstm)
For xxx,1,rowsize
For yyy,1,colsize
If mstm[xxx,yyy]=searchstr Then
rowHERE:=xxx
colHERE:=yyy
Exit
EndIf
EndFor
EndFor

Thanks again!
« Last Edit: May 12, 2011, 01:08:17 pm by dduce »

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: TI - Npsire, CAS; many programming questions
« Reply #17 on: May 12, 2011, 02:26:02 pm »
I'm glad you found it helpful :)

If you need any other help, I'll be here ;)

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: TI - Npsire, CAS; many programming questions
« Reply #18 on: June 15, 2011, 09:00:49 am »
Uses the TI-Nspire CX CAS the same language as the TI 84+ or is it a different one??
*insert supercool signature*

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: TI - Npsire, CAS; many programming questions
« Reply #19 on: June 15, 2011, 09:04:06 am »
Uses the TI-Nspire CX CAS the same language as the TI 84+ or is it a different one??
It uses a different one - the Nspire variant of TI-BASIC, and also Lua.

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: TI - Npsire, CAS; many programming questions
« Reply #20 on: June 15, 2011, 09:04:30 am »
All models of Nspire CAS support a BASIC language similar to that of the TI-68k (89, 92+, V200, 89T) series, which is quite different from the TI-Z80 (73, 76, 80, 81, 82, 83, 83+, 84+, 85, 86) BASIC.
The Nspire CAS's BASIC does not support drawing pixels or reading from the keyboard, though.
The latest versions of the Nspire CAS support a stripped-down version of the Lua programming language.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: TI - Npsire, CAS; many programming questions
« Reply #21 on: June 15, 2011, 09:08:43 am »
 :'( :(
Do you know where I can get a guide which tells me all differents between TI83-Basic and this one?












Do you mean from education.ti.com ??
« Last Edit: June 15, 2011, 09:13:47 am by p2 »
*insert supercool signature*

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: TI - Npsire, CAS; many programming questions
« Reply #22 on: June 15, 2011, 09:11:48 am »
At least in the respective documentations of the TI-Z80 series, of the TI-68k series and of the Nspire series, which can be downloaded freely from TI :)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
*insert supercool signature*

Ashbad

  • Guest
Re: TI - Npsire, CAS; many programming questions
« Reply #24 on: June 15, 2011, 09:25:09 am »
Here's a good overview for Nspire programming:

http://tibasicdev.wikidot.com/nspire

Offline Ghost

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 5
  • Rating: +0/-0
    • View Profile
Re: TI - Npsire, CAS; many programming questions
« Reply #25 on: October 11, 2011, 10:24:34 am »
hello guys, I am also new to the forum and am a complete rookie with the TI Nspire CX CAS. I have had it 48 hours, primary purpose is college math but I will eventually be using it for science as well. I have some very basic questions that I was hoping to get answered but as time goes on I'm sure they will develope into more complicated questions too.
 me trying to comunicate with it right now looks like this  :banghead:

the questions:
1 is the TI CAS for dummies a worthwhile pick up for a complete beginer?
2 while multiplying polynominals it doesn't correctly solve the equation. Is there a settings menu to tell it to do so or another way of inputting the problem to get the right answer?
3 along the same lines as #2 but on some equations it just refrazes the question instead of solving it (im using it in scratchpad mode if that matters)

a few examples to better explain it...sorry if you didnt need this part, just wanting to be clear.

if you input (x+1)^2
it will refraze as (x+1)*(x+1)
if you input the refraze the answer does not include x^2
I know how to do the math as 3 seperate problems to get the answer but is there a way to tell the CAS to solve it in 1 step ?
Similarly if you were to input -5(x+1)
it will refraze as 5(-x-1)
i used simple numbers where the math is easy to do in your head to make the explanation easier but is there a way to tell it to solve the equation ?
thanks in advance for any help provided
« Last Edit: October 11, 2011, 10:29:17 am by Ghost »