Recently everyone has been failing the AP Chem exams, because there's not enough time to finish them. Programs are fair game if we make them, so I decided to make one. One of the main reasons we can't get done is because we have to calculate the molar mass so often. To reduce time on calculating this I was to make a program that you enter the Atomic number, and how many times it occurs...Then add it with the other atoms in the compound.

So I need something like {1.00794,4.00260,6.941,9.01218,...}
then when they enter in the atomic number such as 1, the program would use 1.00794, or if it was 2; 4.00260.

I cannot for the life of me remember the command to get a number like this out of a list. Question

Also, is this the best way to go about it, any suggestions?
Sounds like a reasonable approach to me.

To get a specific list index (A) from, say, L1, you'd do

Code:

L1(A

Remember now?
thanks. ;p I can't believe I couldn't think of it.
Try http://www.ticalc.org/archives/files/fileinfo/389/38907.html I use it all the time for my Chem class. Not only will it find the molar mass, but if will also find Grams, moles, number of molecules, and number of atoms, as long as you know one of those values. This app also messes up omnicalc, so if you use that you will have to enable it after every use.
Alot of people liked my chemistry program, but they want me to implement something so they can type the formula of the compound, to give them the molar weight.

So for water, they would type H20, and it would add molar masses stored in a list to find water's molar mass. The thing is...I can't quite figure out how to do this, I've toyed around for a while and I'm stumped.

Any ideas?
Have the user input a string using the input command. Then use the "inString" and "sub" commands to find the various molecules.
You're going to have some trouble telling the difference between coefficients and the subscript numbers. And unless people are forced to enable lowercase, it will sometimes be impossible to tell when one atom ends and another begins. Like in "SN". Is that Sulfur and Nitrogen or Tin?

And for reference, the syntax for "inString" and "sub" are:

Code:
inString(string to search, substring to search for[,start]) -> Location
sub(string to search,start,length) -> String
I actually wrote this program.

You can get it here: http://www.ticalc.org/archives/files/fileinfo/405/40542.html

It CAN handle parentheses: "Ba(NO3)2"

I wrote it a few months ago and I have no idea how it works, but I remember making very complicated flow charts and diagrams at the time.
Welcome, how did you find Cemetech? You should pick up development on this program, it seems quite good.
I found Cemetech through SourceCoder. It's such a useful tool. Did you write it?

The program is pretty much final. I'm not planning any extra features - all it does is parse a chemical formula and find the molecular mass, and I'm not sure how else I could optimize it. But thanks!
Ed H wrote:
I found Cemetech through SourceCoder. It's such a useful tool. Did you write it?

The program is pretty much final. I'm not planning any extra features - all it does is parse a chemical formula and find the molecular mass, and I'm not sure how else I could optimize it. But thanks!
Ah, fair enough. Yes, I did indeed write SourceCoder; glad you find it useful.
Quote:
I wrote it a few months ago and I have no idea how it works, but I remember making very complicated flow charts and diagrams at the time.


Now that I've stopped programming all that much this happens to me a lot. Somehow a friend of mine will walk up to me at school and have one of my programs on my calculator and ask how it works. I feel kinda stupid when I can rarely answer them.
Pseudoprogrammer wrote:
Quote:
I wrote it a few months ago and I have no idea how it works, but I remember making very complicated flow charts and diagrams at the time.


Now that I've stopped programming all that much this happens to me a lot. Somehow a friend of mine will walk up to me at school and have one of my programs on my calculator and ask how it works. I feel kinda stupid when I can rarely answer them.
I also haven't written TI-BASIC in quite some time, but I generally can still read my code when I'm looking at it.
  
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