Wednesday, April 20, 2011

Chemistry: Ideal Gas Law

Boyle's, Gay-Lussac's Law, and Charle's Law were all combined for everyone's convenience. It's a good thing too, or else this would've been bigger.
The good ol' PV = nRT. Pick the unknown variable in the menu. Insert the other data.

P: Pressure       >(atm)
V: Volume         >(Liters)
G: Grams          >(grams)
M: Molar Mass     >(g/mol)
T: Temperature    >(Kelvins)
N: Number of Mols >(mols)

-- Ideal Gas Law --
:Disp "IDEAL GAS LAW","P, V, M, G, T"
:(0.082)R
:Input "UNKNOWN: ",Str1
:If Str1="P"
:Then
:Prompt N,T,V
:((NRT)/V)P
:Disp "PRESSURE:",P
:End
:If Str1="V"
:Then
:Prompt N,T,P
:((NRT)/P)V
:Disp "VOLUME:",V
:End
:If Str1="G"
:Then
:Prompt P,V,T
:Input "MOLAR MASS: ",M
:((MPV)/(RT))G
:Disp "GRAMS:",G
:End
:If Str1="M"
:Then
:Prompt G,T,P,V
:((GRT)/(PV))M
:Disp "MOLAR MASS:",M
:End
:If Str1="T"
:Then
:Prompt P,V,N
:((PV)/(NR))T
:Disp "KELVINS:",T
:End

8 comments:

  1. How do I get the u with the two dots without connecting it to my computer

    ReplyDelete
  2. I meant to replace that with the STO function. Thanks for the comment, much appreciated!

    ReplyDelete
  3. Getting a syntax error, everything is typed properly

    ReplyDelete
    Replies
    1. On which line is it breaking? I just changed a line to correct an error. I believe line 7 had a U with umlauts when it was supposed to just be an arrow.

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. my calculator is giving me an error with the Str1 and doesn't seem to want to except it

    ReplyDelete
  6. getting an error on line 3.. any help?

    ReplyDelete