I'm attempting to write a small program that will calculate the values for the Ideal Gas Law, specifically for molecular Hydrogen (H2) in space. Eventually, this will grow to be a sort of "simulator", but right now I seem to be having problems with remembering my college chemistry and physics.
Here is a picture of the form that I created:
So in my program (written in C#), I have the following as initial values for those variables:
P = ?
v = ?
n = 2.0158 (weight in grams of H2)
T = 2.725 (average temp in space)
R = 1.67E-27 (1.67 * 10^-27)
My problem is that, how does one go about trying to solve for P or v? Do you assign an arbitrary number for what you suppose the volume of the gas would be in space, and then calculate P based on that? Or is it the other way around?
Extra, yet entirely unneeded info: This was brought about because my 7 year old daughter asked me how stars were made. I gave her the explanation that anyone who's got even a remote interest in it gives to their kids, but thought it would be pretty cool to make a little program that would give her a visual. Here was my explanation:
"we think that Hydrogen stuck together to make even larger clouds of Hydrogen, which increased the total mass of the gas cloud, increasing the gravitational pull on other atoms/molecules of nearby gas, etc. This eventually got to the point that the gases started to heat up as they were squished together by their own mass, but that increase in temperature created an outward push (pressure), which got into a tug-of-war with gravity acting on the mass of the gas itself. And later, we got a star. That's how most of us non-scientists think it happens, anyway!"