How would I work this calculus/engineering problem? Cylinder pressures.


Mar 19, 2013
Hi all, I have had this calculus (pretty sure its calc) problem for a while and its driving me crazy cause it seems like it should be quite simple. Like I’m Just missing a formula.
Here is the setting, a project of mine requires 2 movable pistons in a container. One connected to a spring connect to say the top of the container and the other a movable shaft that goes out the bottom. There is a gap between them has some arbitrary about of compressible gas. The pistons are sealed against the sides of the container so that the gas can not escape from between them. As the piston moves up it compresses the gas which in turn compresses the spring.
(See Picture)

Here is the problem, how do you calculate the position of the spring and the pressure of the gas as the piston compresses it?

Example set up I’m trying to figure out. I’m ignoring friction, gravity, external air pressure and so on. Just trying to theoretically find the height the spring compresses too as the piston applies force on the gas. Say:
I have a cylinder with Cross area = 3in^2
Starting gap (g) has a quantity of gas that measures 10psi when at a volume of 3in^3
The 10inch (L) Linear spring compresses at 5lb per inch thus 50lb total force.

After moving the piston up 2 inches (p) how far has the spring compressed (c)? And what is the gas pressure pushing the piston back down(g2)?

Please let me know if I'm way over my head.. my calculus 1 is bit rusty but I'm trying to relearn it. Any hints on what calculus sections I should study up on again?

TJ's is not correct either if two portions of gas are in play here, proof is the spring is compressed by 5 in initially.
Question: is it vacuum between top of the container and top shaft?
Do you place the spring first->natural length 10 in,
then add gas, between two shafts?
This initial placement is very important.
No calculus involved.

1) Pressure/volume of gas: P1*V1=P2*V2 -> P2-P1=P1[(V1/V2)-1]

2) Force of spring/gas (must be equal if things are stationary), where A is area of piston: F2-F1 = A*P1[(V1/V2)-1] = k*d (k is spring constant, d is change in position of the spring piston)

3) Can get an equation for final volume (V2): V2=V1+A*(d-2). The 2 is the change in position of the other piston (which we are given).

Putting 2) and 3) together, we can get:

k*d = A*P1{[V1/(V1+A*d-A*2)]-1}

In equation we know everything except for d. The equation ends up being a quadratic, with the positive root being 1.77, which is how many inches the spring piston moved. At that point you can easily solve for V2, which in turn makes it straightforward to find P2 and therefore the force the gas exerts.

Let me know if that doesn't make sense.

Edit: @vapour I think I had to work through it like 5 times on paper to get it right, and even now I'm not 100% confident of my answer lol. I figured it should be fairly straight forward when I started and then was too stubborn to stop, ended up spending a not insignificant chunk of my work day on it, oops...