Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dduce

Pages: [1]
1
TI-BASIC / Re: TI - Npsire, CAS; many programming questions
« 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!

2
Introduce Yourself! / Greetings!
« on: May 12, 2011, 11:52:04 am »
It has been suggested to me that I come and introduce myself.

Hello! I'm dduce.  8)

I'm a very novice programmer. As I said in a post here, I'm not a beginner, but I'm far from being a novice.

Currently, I am pursuing a degree in Chem. Engineering. I mainly program using MATLAB, as this is the program that my school has deemed a must for all engineers. Recently, I've begun programming the nspire cas for help in these upper level classes, which led me here.

Thus far, I'm very glad that I found the board.

Thanks everyone!

3
TI-BASIC / Re: TI - Npsire, CAS; many programming questions
« on: May 11, 2011, 10:35:18 pm »
C and ASM are different languages. They're much harder to learn than BASIC and must be programmed on a computer. Ndless will run on OS 1.7, 2.0.1 and 2.1.0. I don't think it will run on OS 2.1.1, though. You need to download Ndless 2.0 Beta from the Ndless sub-forum here.

I don't think you need to worry about those languages if you are only planning to use the calculator for educational purposes, though.

Still, I think I need to invest the time to do some more researching. You've got my curiosity up. I'll keep poking around the site. There's tons of info that I haven't even discovered yet. Thanks again for the replies!

4
TI-BASIC / Re: TI - Npsire, CAS; many programming questions
« on: May 11, 2011, 10:29:29 pm »
For displaying all of the values, I think a for loop would be best.  I am not 100% sure that this will work with an array of more than one dimension (and I can't test now :().

Code: [Select]
For x,1,dim(mstm)
Disp mstm[x][3]
EndFor

For the string issue, do you want to find the index of a certain substring in a string?

First, to convert from a number to string, use "string(number)" and to do the opposite, use "expr(string)"
To find the index of a substring in a string, use "inString(string,substring)", which will return the index of the substring if it is in the string (with the first index being "1", not "0").

I tried playing with the for loop, but it errors out, say "Domain Error". And it highlights the "mstm[ x][ 3]". I've tried mstm[x,3] , and that returns everything. The problem appears to be with way you tell the calc "all", there must be a symbol which means "all" when referencing the row... Very frustrating. Arg!  :banghead:


I did figure out this:
Code: [Select]
{xx,yy}=dim(mstm)
Returns:
{xx=3,yy=64}

However, the values xx and yy are not stored as a variable. So when I type "xx" in the calc prompt, it displays "xx" and not 3. Any ideas how to fix this? I tried {xx,yy}:= , with the colon, but it doesn't like that.

Regarding the search issue. Yes, I'd like to search be able to find the index number.

Also, I used you For ... EndFor suggestion and modified it like this:
Code: [Select]
indexd:=0
While indexd<dim(ion)
indexd:=indexd+1
disp mstm[indexd]
EndWhile

But it errors too.

Quote
First, to convert from a number to string, use "string(number)" and to do the opposite, use "expr(string)"
To find the index of a substring in a string, use "inString(string,substring)", which will return the index of the substring if it is in the string ...

I'm still struggling. Sorry. Maybe an example might help: my string value, for example are: "Br" , "Ag" , and "Cl", and these reside in the ion portion of the newly created matrix/list named mstm, and there are 2 other lists which correspond each ion. These lists are charge (row2) and size (row3). An example, let's say "Ag" is the second value of row 1, but lets pretend I don't know it's the second value of row 1. Lets say I write a program that asks you to enter a string value for the ion which you are searching for, the request is stored in the variable "ur_ion".

So the idea now is to compare ur_ion with row 1 of mstm, find that strings index, then using that index # it will grab the corresponding charge and size values associated with it, and create new variables storing the charge (named: nwchrg) and size (named: nwsznm)

Using those variables the calculation will continue. The program will request input, and so on...

Maybe instring, string, and expr are what I need to be using, but I still can't seem to figure it out.

Thanks again for the help.

5
TI-BASIC / Re: TI - Npsire, CAS; many programming questions
« on: May 11, 2011, 09:27:32 pm »
TI's stance with this calc is that the more locked up it is to games/utilities the better it will be. We have programs like Ndless that let us run C/Asm programs on our calcs. If TI doesn't remove it before they rerelease 3.x we have Lua, but our guesses are that it was unintentional to give it to us


I've read about ndless, but I thought it wouldn't work for my OS, being that the download that I find mentions it's for v1.7 and theirs not much talk further that I have found. Never heard of Lua. ... I'm really in the dark about C/Asm. I've seen it mentioned but over looked it. Is it a different language?

DJ_O,
That sucks. I was hoping to utilize the menu's and cursor... unfortunately for me though, I don't have time to really play around, as cool as these other capabilities are, Math and Science is my life for some time to come. I'm curious though, and again I may just be to novice still, but the calc came loaded with a bunch of examples. Within these examples, there are functions which utilize the menu and cursors. ... no idea yet how it's done though. Think that's part of the OS, or a separate script wrote particularly for these examples?

I'll have to jump on the software now and check these out.

6
TI-BASIC / Re: TI - Npsire, CAS; many programming questions
« on: May 11, 2011, 09:05:51 pm »
Ah ok. OS 2.1 should have most recent functions then. As for the BASIC language, it is more like the TI-89, but it is much more limited. Basically it doesn't have Getkey, Pixel-On/Off, Line() and Output/Text/Locate() equivalents, so the language is not suitable for people who are using their calculator for other purposes than school (such as gaming).

EDIT: Your post vanished O.O

Sorry about that. I didn't realize apcalc had posted as well. I wanted to reply to both. :)

I did run across the TI89 for dummies book. I tried to follow what was going on, but the 89 is so different than the nspire, I was lost to say the least.

What do you mean that the language is a lot more limited? Is there a way to fix this?

7
TI-BASIC / Re: TI - Npsire, CAS; many programming questions
« on: May 11, 2011, 09:03:25 pm »
Excellent, I'm grateful for the quick replies!

apcalc,

this seems very logical. I'm going to go and sit down and play around with this. I greatly appreciate you explaining those commands. I wasn't using them properly. I'll post back.

The hand held os is v2.1.1.38, and I should probably mention that I'm using the computer software, os v2.1.0.631, to program with. I've read the nspire BASIC is a lot a like the 83+ basic, but their are 4 or 5 generations worth of subtle differences between them and the nspire cas. No idea really though. I've never owned an 83 or 84.

Thanks again everyone! and for the welcoming :)

8
TI-BASIC / TI - Npsire, CAS; many programming questions
« on: May 11, 2011, 07:39:17 pm »
Hello everyone! This is my first post, and first time finding the board. I'm glad to have found you all. Hopefully I can find some answers here.

About me:
I'm a Chemical Engineering student. I'm fairly familiar with programming in MATLAB, and I've been programming on the Nspire CAS for about a month steady now. I'm not a complete beginner, but I'm far from a novice. ;)

Anyway, as I said, I have many questions that I will be posting on my journey, and hopefully I can answer a few questions too. Please, if you have any Chemistry questions, or the like, feel free to ask away. As for programming.... ::)

About the program:
I am developing a very sophisticated program that will collect strings and values, ultimately plugging these values into tons of equations and displaying answers, activities, equations, and loads more of helpful calculations and features that will help other colleagues in my field.

One problem that I am having is, you'll see the variables here, ion - charge - sznm. These are values that are stored in a spread sheet, and the headings of the columns, are the same as the variable names (as I'm sure you're all aware... just trying to be as specific as possible):
Quote
mstm:={ion,charge,sznm}

This works perfectly. If I type mstm[3], on the calculator application, for example, and press enter, the 3rd row of the matrix is displayed. Likewise, if I type in the calc promt: mstm[1,1]    , it will display the value in row one, column one. Works perfect. Now, here's the question, how do I tell it to display "ALL" rows of column 3? In MATLAB you would say mtsm(:,3) , meaning all rows in the 3rd column...

Another question that I have: is there a way to do a search for a string and/or a value?

InString and Frequency, unless I'm doing it wrong, don't appear to be what I need in order to perform this task.

in MATLAB it's a simple "find" command, and in excel, I believe it's Vlookup or Hlookup, meaning vertical/horizontal lookup, if that helps anyone.



Another question: is anyone familiar with the "indirection operator"?

I'm curious if I were to have string values stored in a list, is there a way to write a while loop, for example, that would grab each string value and convert it to a variable?


I've searched for days for this answer, which led me here. Can you help? Please  :) Much appreciation.

Pages: [1]