Equations in use:

These are written in javascript form, (ie math.pow), since that is how they are used in the animation. They should be written the way Jason sent them for a publication, or formal info page. (I also have additional "if" clauses to protect from dividing by zero where needed, and also to deal with V/Q = infinity.)

V/Q (for 1 unit) = V[unit1 A] / Q[unit A]

PAO2 (for 1 unit) = (17.5229 + 44.295 * VQ + 361.931 * Math.pow(VQ, 2)) / (0.437074 + 1.11927 * VQ + 2.4552 * Math.pow(VQ, 2))

this equation is from Jason Torchinsky's email from February 8, 2022

PaO2 (for 1 unit AND for Combo) = PAO2 - (( patientAge22 + 10 ) / 4 )

this equation is from Chris Green's email March 25th 9:26 AM

SaO2 (for 1 unit) =

var numerator = math.add(math.multiply(1955.0394699543847, PartO2), math.add(math.multiply(-213.2662843886982, math.pow(PartO2, 2)), math.add(math.multiply(41.54640092306389, math.pow(PartO2, 3)), math.pow(PartO2, 4))));

var denominator = math.add(-106448.2587420381, math.add(math.multiply(65913.51184300154, PartO2), math.add(math.multiply(-851.451203713157, math.pow(PartO2, 2)), math.add(math.multiply(45.05377099788284, math.pow(PartO2, 3)), math.pow(PartO2, 4)))));

return math.divide(numerator, denominator);

this equation is from Jason Torchinsky's email from February 8, 2022, but then translated into javascript on 4-14 and with more decimal points included.

PaCO2 (for 1 unit) =

var a0 = 76.2751;

var a1 = 70.0209;

var a2 = 33.6502;

var a3 = -0.34346;

var b0 = 1.77389;

var b1 = 1.61767;

var b2 = 1.33013;

var b3 = 0.0772792;

PaCO2 = ( (a0) + (a1 * VQ) + (a2 * math.pow(VQ, 2)) + (a3 * math.pow(VQ, 3)) ) / ( (b0) + (b1 * VQ) + (b2 * math.pow(VQ, 2)) + (b3 * math.pow(VQ, 3)) );


from Jason Torchinsky's PDF "main3.pdf" equation 2.6.1

CaCO2 (for 1 unit) =

var a0 = 450.766;

var a1 = -324.839;

var b0 = 0.00447017;

var b1 = -0.0455131;

CaCO2 = (a0 * math.exp(b0*PACO2)) + (a1 * math.exp(b1*PACO2));

from Jason Torchinsky's PDF "main3.pdf" equation 2.8.1, with corrections sent in email Sept 9th

ComboSaO2 = ((Q[unitA]*PropA) * SaO2[unitA] + (Q[unitB]*(100-PropA)) * SaO2[unitB]) / ((Q[unitA]*PropA) + (Q[unitB]*(100-PropA)))

this equation is a modification from Chris Green's email from Thu, Feb 17, 3:54 PM. Kate added the PropA parts when the 5th slider was added. "PropA" refers to the proportion shown by the 5th slider. (Proportion of the lung acting like unit A). This number is out of 100.

There is also a maximum of SaO2 set to 98.8.

ComboPaO2 =

var a0 = math.divide(math.subtract(10.38660023076597, math.multiply(11.26344274947071, comboSaO2)), math.subtract(comboSaO2, 1));

var b0 = math.divide(math.add(math.multiply(comboSaO2, math.subtract(math.multiply(1075.0947060911885, comboSaO2), 1645.7226752215443)), 573.7033803407896), math.pow(math.subtract(comboSaO2, 1), 2));

var c0 = math.multiply(3.940786557660247e-14, math.multiply(math.pow(math.pow(math.subtract(comboSaO2, 1), 3), 1./3.), math.subtract(math.multiply(math.subtract(3.6519627291763246e63, math.multiply(3.678206421048116e63, comboSaO2)), comboSaO2), 7.704925727224935e61)));

var c1 = math.subtract(math.multiply(math.add(3.0493168812921595e140, math.multiply(math.subtract(math.multiply(6.139089782895964e141, comboSaO2), 6.396790839353522e141), comboSaO2)), comboSaO2), 1.1635911791364433e139);

var c2 = math.add(2.0877433016741836e278, math.multiply(math.subtract(math.multiply(math.add(7.469118128223332e281, math.multiply(math.subtract(math.multiply(math.add(6.87738499223727e283, math.multiply(math.subtract(math.multiply(4.5671677653081645e283, comboSaO2), 1.0231982990880378e284), comboSaO2)), comboSaO2), 1.2853844024371706e283), comboSaO2)), comboSaO2), 1.7530444761963444e280), comboSaO2));

var b1 = math.divide(c0, math.multiply(math.pow(math.subtract(comboSaO2, 1), 2), math.pow(math.add(c1, math.pow(c2, 1./2.)), 1./3.)));

var b2 = math.multiply(math.multiply(math.divide(1, math.pow(math.pow(math.subtract(comboSaO2, 1), 3), 1./3.)), 7.252577143003733e-45), math.pow(math.add(c1, math.pow(c2, 1./2.)), 1./3.));

var a1 = math.multiply(0.5, math.pow(math.add(b0, math.add(b1, b2)), 1./2.));

var b3 = math.divide(math.add(1147.4067606815793, math.multiply(math.subtract(math.multiply(2150.189412182377, comboSaO2), 3291.4453504430885), comboSaO2)), math.pow(math.subtract(comboSaO2, 1), 2));

var c3 = math.add(30698.87177532589, math.multiply(math.subtract(math.multiply(math.subtract(414157.8781909889, math.multiply(193051.12355792642, comboSaO2)), comboSaO2), 251816.41301363567), comboSaO2));

var b4 = math.divide(c3, math.multiply(2, math.multiply(math.pow(math.subtract(comboSaO2, 1), 3), a1)));

var a2 = math.multiply(0.5, math.pow(math.add(math.subtract(math.subtract(b3, b1), b2), b4), 1./2.));

var tempComboPartO2 = math.re(math.add(a0, math.add(a1, a2)));

this equation is from Jason Torchinsky's inverting of the SaO2 Eq and translating it into javascript from 4-14-22

ComboCaO2 = ((Q[unitA]*PropA) * CaO2[unitA] + (Q[unitB]*(100-PropA)) * CaO2[unitB]) / ((Q[unitA]*PropA) + (Q[unitB]*(100-PropA)))

this equation is basically the same as ComboSaO2 equation above, and its also equivalent to eq 2.10.1 in Jason's PDF, but I've added in the horizontal proportional slider, PropA.

ComboPaCO2 =

var d0first = math.add( math.bignumber('4.6939e+470'), math.multiply(-1, math.bignumber('1.9981e+468'), math.bignumber(comboCaCO2)), math.multiply( math.bignumber('3.6701e+465'), math.pow(math.bignumber(comboCaCO2),2)), math.multiply( -1, math.bignumber('4.0437e+462'), math.pow(math.bignumber(comboCaCO2),3) ) );

var d0secd = math.add( math.multiply(math.bignumber('2.6762e+459'), math.pow(math.bignumber(comboCaCO2),4)), math.multiply(-1, math.bignumber('4.1493e+455'), math.pow(math.bignumber(comboCaCO2),5) ), math.multiply(math.bignumber('5.7768e+451'), math.pow( math.bignumber(comboCaCO2),6)) );

var d0 = math.add( d0first, d0secd );

var c0 = math.cbrt( 1.99406 * math.pow(10,51) + 2.37391*math.pow(10,49)*comboCaCO2 + 9.42036*math.pow(10,46)*math.pow(comboCaCO2,2) + 1.24609*math.pow(10,44)*math.pow(comboCaCO2,3) );

var c1 = 1.25867 * math.pow(10,17) + 4.99478 * math.pow(10,14) * comboCaCO2;

var c2 = math.cbrt( math.add( math.bignumber( -5.9963 * math.pow(10,232) + 1.1836 * math.pow(10,232) * comboCaCO2 - 3.1032 * math.pow(10,229) * math.pow(comboCaCO2,2) - 1.1522 * math.pow(10,225) * math.pow(comboCaCO2,3)), math.sqrt(d0) ) );

var b0 = ( -6.23596*math.pow(10,100) + 8.84235*math.pow(10,97)*comboCaCO2 + -3.07793*math.pow(10,94)*math.pow(comboCaCO2,2) ) * c0;

var b1 = math.pow(c1, 2) * c2;

var b2 = 8.02407 * math.pow(10,-57) * c2;

var b3num = 2.25696 * math.pow(10,40) - 2.62944 * math.pow(10,37) * comboCaCO2 + 2.27933 * math.pow(10,34) * math.pow(comboCaCO2,2);

var b3denom = math.pow( 1.25867 * math.pow(10,17) + 4.99478 * math.pow(10,14) * comboCaCO2, 2 )

var b3 = b3num / b3denom;

var b4num = 4.51392 * math.pow(10,40) - 5.25887 * math.pow(10,37) * comboCaCO2 + 4.55866 * math.pow(10,34) * math.pow(comboCaCO2,2);

var b4denom = b3denom;

var b4 = b4num / b4denom;

var b5 = 6.93781 * math.pow(10,60) - 1.07485 * math.pow(10,58) * comboCaCO2 + 1.50266 * math.pow(10,55) * math.pow(comboCaCO2,2) - 7.97666 * math.pow(10,51) * math.pow(comboCaCO2,3);

var a0num = (-7.68214 * math.pow(10,19)) + (4.24789 * math.pow(10,16)) * comboCaCO2;

var a0denom = (1.25867 * math.pow(10,17)) + (4.99478 * math.pow(10,14)) * comboCaCO2;

var a0 = a0num / a0denom;

var a1 = (1/2) * math.sqrt( b3 + (b0/b1) + (b2/c0) );

var a2 = (1/2) * math.sqrt( b4 - (b0/b1) - (b2/c0) + (b5/(2*math.pow(c1,3)*a1)) );

var comboPaCO2 = math.add(a0, math.multiply(-1, a1), a2);

return comboPaCO2;

This is from Jason's PDF, equations 2.9.2a - 2.9.3

Javascript code:

It's used within Adobe Animate, so this code won't run on it's own because the objects are defined elsewhere in the program. But the logic is all here.. 93b