TI-89 HomeGames ArchiveTitanium GamesGames How ToProgramsFAQForumTI-89 WikiLinks

Help! Chemistry Program.

 
Post new topic   Reply to topic    Your TI-89 Resource Forum Index -> BASIC Programming
Author Message
thatguy69



Joined: 18 Nov 2010
Posts: 1

PostPosted: November 18, 2010 11:35 PM    Post subject: Help! Chemistry Program. Reply with quote

This is a program for my chemistry class designed to solve the Clausius-Clapeyron equation for an unknown variable. I can't seem to get it to work. It either tells me that for the 'solve' function "Argument must be a variable" or that somethings wrong with the units.

Can anyone tell me what's wrong?

Code:
()
Prgm
Local p1,p2,hvap,t1,t2,mv,expo

Dialog
Title "Clausius-Clapeyron"
DropDown "Missing Variable",{"Pressure 1","Pressure 2","H of Vapor","Temperature 1","Temperature 2"},mv
EndDlog

If mv=1 Then
 Dialog
 Title "Clausius-Clapeyron"
 Request "Pressure 2",p2
 Request "H of Vapor",hvap
 Request "Temperature 1",t1
 Request "Temperature 2",t2
 EndDlog
 solve(ln(p2/p1)=–hvap/ugas*(1/t2-1/t1),p1)
EndIf

If mv=2 Then
 Dialog
 Title "Clausius-Clapeyron"
 Request "Pressure 1",p1
 Request "H of Vapor",hvap
 Request "Temperature 1",t1
 Request "Temperature 2",t2
 EndDlog
 solve(ln(p2/p1)=–hvap/ugas*(1/t2-1/t1),p2)
EndIf

If mv=3 Then
 Dialog
 Title "Clausius-Clapeyron"
 Request "Pressure 1",p1
 Request "Pressure 2",p2
 Request "Temperature 1",t1
 Request "Temperature 2",t2
 EndDlog
 solve(ln(p2/p1)=–hvap/ugas*(1/t2-1/t1),hvap)
EndIf

If mv=4 Then
 Dialog
 Title "Clausius-Clapeyron"
 Request "Pressure 1",p1
 Request "Pressure 2",p2
 Request "H of Vapor",hvap
 Request "Temperature 2",t2
 EndDlog
 solve(ln(p2/p1)=–hvap/ugas*(1/t2-1/t1),t1)
EndIf

If mv=5 Then
 Dialog
 Title "Clausius-Clapeyron"
 Request "Pressure 1",p1
 Request "Pressure 2",p2
 Request "H of Vapor",hvap
 Request "Temperature 1",t1
 EndDlog
 solve(ln(p2/p1)=–hvap/ugas*(1/t2-1/t1),t2)
EndIf


EndPrgm
Back to top
View user's profile Send private message
mellamokb



Joined: 10 May 2007
Posts: 124

PostPosted: February 10, 2011 3:44 PM    Post subject: Reply with quote

Hi thatguy69,

It looks like you can't solve for an undefined local variable. Try using another variable name for the one being solved. For instance, the first expression would look something like this:

Code:

solve(ln(p2/thevar)=hvap/ugas*(1/t2-1/t1),thevar)



You would swap out thevar (which can be whatever you want) for each variable being solved for.

Edit: You also need to convert the request values. They are stored as strings, and need to be converted to numbers. Like this:

Code:

expr(p2) -> p2
expr(hvap) -> hvap
expr(t1) -> t1
expr(t2) -> t2



You will also want to print out the result. You can do something like this:

Code:

solve(ln(p2/thevar)=hvap/ugas*(1/t2-1/t1),thevar) -> p1
Disp p1



Hope this helps!

Regards,
~ mellamokb[/code]
Back to top
View user's profile Send private message
Display posts from previous:    View previous topic : View next topic  
Post new topic   Reply to topic    Your TI-89 Resource Forum Index -> BASIC Programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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

Contact Us | Privacy Policy | Disclaimer | Trademarks

Copyright ©2006 All rights reserved.


Free Greeting Cards | Girly Myspace Layouts | Myspace Unblocker |