Well of course there is a equation (well three really) and they are not very hard. There are basically two parts to the problem. The first part is to determine what pressure of inert gas is present in your tissues. For that you need the Haldane equation which provides the gas loading for maintaining a constant depth, and Schreiner's equation which provides the change in pressure for a change in depth at a constant rate. The third thing you need is some sort of limit to keep your calculated pressures below. And those are "M" values. Buhlmann provided a set which can be adjusted for different depths/altitudes. It has been suggested that Buhlmann coefficients apply to half an atmosphere or so. Others have suggested that this is not quite conservative enough and would prefer to keep tissue pressure to 70-90% of the gradient (difference between ambient pressure and M). Anyway you can get the a's, and b's from Buhlmann's book, or on the web and do your own calc's. It is something a relatively average high school student could do, but then the dive agencies think their students are too dim to do the math. Doing everything in common units of pressure makes things a lot easier. It is customary to use units of depth (meters of sea water absolute, or feet of sea water absolute). Once you do that you have to convert altitude to the same units. So for example ambient pressure at sea level is 33 fswa, and in a airplane at 8000 feet above sea level ambient pressure is 25 fswa.