Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. 68k Calculator Basic => TI-BASIC
Author Message


Joined: 06 Mar 2008
Posts: 1

Posted: 06 Mar 2008 06:14:55 pm    Post subject:

I've written a program to quickly find the order of reactants for a given element in an integrated rate law for use in my AP Chemistry class. However, I'm running into one slight problem. The way you pick the order of reactants is by graphing three graphs: [A] versus t, ln[A] versus t, and 1/[A] versus t where [A] is concentration and t is time. You then pick the graph that produces the straightest graph. The way I've handled this is you enter in the time and respective concentrations, the program then finds out what the slopes would be between each of the plots on all three of the graphs. Then to make the program easy to use, I want to compare all the slopes for ever consecutive points and output which one is most consistent. I initially did this by outputting the slopes to a list and then using the variance command. However, when testing the program I realized I had made a huge blunder seeing as if the graph of [A] versus t produces extremly small slopes (on the order of 10^-5) but deviate further from the slope of a straight line as compared to if a graph of say ln[A] versus t produced a vary straight line but has smaller slopes (on the order of 10^-2) than if you assume that the most accurate line is the one with the least variance you will be lead astray since the small slopes but less straight graph will give you a small (on the order of 10^-5) value of variance compared to the more linear graph. Does anyone know how I would go about using the slopes to calculate how far they deviate from a straight line and then output the result with 0 (zero) signifying a perfectly straight line and anything greater then zero signifying increasing curvature? One way I though of was using:

abs(0-mean(d)/median(d))      //d is the list holding the slopes

This worked however I'm not sure that it will work for all cases. Any input would be great. Sorry for the lengthy description/explanation. In case any of you want to play with the program I've included the full source code below. Thanks in any help you can give me, it's greatly appreciated.
-Ian B.


 Title "Integrated Rate Laws"
 Request "Time",x,0
 Request "[A]",y,0
 Text "Enter x for Time to denote end."
 If x="x" Then
 Goto end
 If c=1 Then
 Lbl end
 Lbl fuction
 If f=1 Then
 Define g(s)=s
 ElseIf f=2 Then
 Define g(s)=ln(s)
 ElseIf f=3 Then
 Define g(s)=1/s
 Goto exitp
 For i,1,rowDim(m)-1
 If c=1 Then
 Output (f-1)*10,50,approx(abs(0-mean(d)/(median(d))))
 Goto fuction
 Lbl exitp
 Output 0,0,"Zero"
 Output 10,0,"First"
 Output 20,0,"Second"
 DelVar c,m,x,y,t,d,i,f,g
Back to top
ceci n'est pas une |

Super Elite (Last Title)

Joined: 04 Nov 2003
Posts: 8328

Posted: 06 Mar 2008 10:30:47 pm    Post subject:

I would use the LinReg command on each set of points; this will attempt to fit a straight line to them. The resulting line is stored in regeq(x), but this doesn't really matter; what does matter is that the "correlation coefficient" is stored to the system variable corr. The correlation coefficient is a measure of how close a fit the line is. If it's a close fit, it will either be close to 1 (if the line has a positive slope) or close -1 (if the line has a negative slope). If it's a bad fit, the correlation coefficient will be close to 0.
Back to top
Display posts from previous:   
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
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours