# How can I get the solubility value of nitrogen in water at 10 degrees Celsius with Mathematica?

How can I get the solubility value of nitrogen in water at 10 °C with Mathematica?

The site engineering toolbox dot com gives graphs of such values, but I want the numerical value.

Related thread on chemistry.SE

• ChemicalData["Nitrogen", "Solubility"] is Missing["NotAvailable"], sorry. – 2012rcampion Apr 22 '15 at 13:46
• = solubility of nitrogen in water (Free-Form) does give back some result though. – Taiki Apr 22 '15 at 14:16

Unfortunately, the data do not currently exist in the Wolfram sphere of knowledge:

WolframAlpha["aqueous solubility of nitrogen"]


(At least W|A knows what we are asking for, it just doesn't know the answer). Instead, we need to use graph manipulation to get our answer.

img = Import["http://i.stack.imgur.com/V4JdO.jpg"];
(* Manually find the image coordinates for three points *)
{a1, a2, a3} = {{88.1818, 67.8182}, {89.0909, 369.636}, {403.636,67.8182}};
{b1, b2, b3} = {{0, 0}, {0, 0.035}, {60, 0}};
(* Create a transformation *)
trans = FindGeometricTransform[{b1, b2, b3}, {a1, a2, a3}][[2]];


The plot is blue, and there are better ways, I'm sure, to get at the blue in this figure, but subtracting out the red and green is most intuitive to me, so here it goes:

blue = ImageData[img][[All, All, 3]] - ImageData[img][[All, All, 2]] -
ImageData[img][[All, All, 1]] // Image


We can grab the curve points and tweak the image all in one shot:

curve = (Reverse /@
Position[
ImageData[Thinning@Binarize@DeleteSmallComponents@blue,
DataReversed -> True], 1]);
Show[ListPlot[trans@curve, PlotRange -> All]]


Now all that is left is to make an interpolating function of the data and get our answer:

solubility = Interpolation[trans@curve]
solubility[10]
(* 0.0242127 *)


I wouldn't trust Mathematica's number of significant figures, but we've got a reasonable result at this point.

• I don't think Mathematica is claiming that any of those figures necessarily are or are not significant! Still, this seems like the best approach. I simply would not trust any values obtained from W|A without knowing where they came from originally. – Oleksandr R. Apr 22 '15 at 14:23
• @OleksandrR. True. The comment stems from me currently doing some grading and noting that students are writing down every darn number from their calculator without thinking about the precision of their measurements. I think I'm grumpy. – bobthechemist Apr 22 '15 at 14:40
• That said, your comment on sources is very important. The source of this data isn't a terribly reliable one, and the website does not make any attempt to cite where the data are from or how the measurements were made. Caveat Emptor. – bobthechemist Apr 22 '15 at 14:44

Since the relevant data are not known to either of ElementData[] or ChemicalData[], I'll go ahead and pull needed values from the NIST Chemistry WebBook; at least that is a more generally accepted provenance than the built-in curated data functions.

First, I'll assume that nitrogen's pressure is at 1 atmosphere. We can then use the temperature-dependent version of Henry's law. Using the relevant values for nitrogen taken from here, we have

With[{p = Quantity[1, "Atmospheres"], t = Quantity[273.15 + 10, "Kelvins"]},
UnitConvert[(ChemicalData["Nitrogen", "MolarMass"]/ChemicalData["Water", "Density"])
p Quantity[6.5*^-4, "Molar"/"Atmospheres"]
Exp[-Quantity[1300, "Kelvins"] (1/t - 1/Quantity[298.15, "Kelvins"])],
"Grams"/"Kilograms"]]

Quantity[0.0144532, "Grams"/"Kilograms"]


which is a bit off from the value in bob's answer. Whether this is due to a deviation from Henry's law, or the questionable provenance of the empirical data in the OP, or something else, is another question altogether.

• Hmm, only now noticing your answer. The shape of the curve in the OP's data makes me think that Henry's Law isn't followed here; although I don't know why that would be the case for a reasonably innocent gas such as nitrogen. – bobthechemist Dec 10 '18 at 2:02