Derive equation of state