Wolfram Language

Richer Knowledgebase Access

Prepare Aspirin

Aspirin is one of the most commonly used medications for treating pain, fever, and inflammation. It can be synthesized by combining equimolar amounts of salicylic acid and acetic anhydride. Here, chemical data from the Wolfram Knowledgebase is used together with the quantity framework and entity groups, copies, and instances to study the chemical preparation of aspirin.

Represent a typical laboratory batch for a 100-millimolar preparation of aspirin using EntityGroup.

In[1]:=
Click for copyable input
reactants = EntityGroup[{EntityInstance[Entity["Chemical", "SalicylicAcid"], Quantity[0.1, "Moles"]], EntityInstance[Entity["Chemical", "AceticAnhydride"], Quantity[0.1, "Moles"]]}]
Out[1]=

Compute the total mass of this batch using a "curried" form of an entity-property query.

In[2]:=
Click for copyable input
mass = reactants["AbsoluteMass"]
Out[2]=

Because acetic anhydride is a liquid, it would be convenient to know exactly how much is needed.

In[3]:=
Click for copyable input
UnitConvert[ EntityInstance[Entity["Chemical", "AceticAnhydride"], Quantity[0.1, "Moles"]]["AbsoluteVolume"], "Milliliter"]
Out[3]=

Assuming a stoichiometric, i.e. a (theoretical) quantitative reaction, this yields 100 millimoles of aspirin. However, in practice, yields of about 90% will be achieved.

In[4]:=
Click for copyable input
EntityInstance[Entity["Chemical", "Aspirin"], 0.9*Quantity[0.1, "Moles"]]["AbsoluteMass"]
Out[4]=

Count constituent atoms of the aspirin molecule.

In[5]:=
Click for copyable input
elem = Entity["Chemical", "Aspirin"]["ElementCounts"]
Out[5]=

Assemble the proper numbers of these atoms into a grouped entity expression.

In[6]:=
Click for copyable input
atomAssemble = EntityGroup[ MapThread[EntityCopies[#1, #2] &, {Keys[elem], Values[elem]}]]
Out[6]=
In[7]:=
Click for copyable input
atomicmass = atomAssemble["AtomicMass"]
Out[7]=

As expected, the overall atomic mass of this entity group coincides with the molar mass of the whole molecule.

In[8]:=
Click for copyable input
molarmass = Entity["Chemical", "Aspirin"][ EntityProperty["Chemical", "MolarMass"]]
Out[8]=
In[9]:=
Click for copyable input
Equal @@ QuantityMagnitude /@ {atomicmass, molarmass}
Out[9]=

However, there are other possible isotopic combinations, each of them with a slightly different total mass.

In[10]:=
Click for copyable input
stableIsotopes = #[EntityProperty["Element", "StableIsotopes"]] & /@ Keys[elem]
Out[10]=

This group consists of the standard isotopes only (the so-called "principal ion").

In[11]:=
Click for copyable input
EntityGroup[{EntityCopies[Entity["Isotope", "C12"], 9], EntityCopies[Entity["Isotope", "H1"], 8], EntityCopies[Entity["Isotope", "O16"], 4]}]["AtomicMass"]
Out[11]=

The probability of the occurrence of a molecule with such a composition is less than 90%. Nevertheless, in a mass spectrum it would be the most prominent molecular peak.

In[12]:=
Click for copyable input
Times @@ MapThread[(QuantityMagnitude[#1[ EntityProperty["Isotope", "IsotopeAbundance"]], "PureUnities"])^#2 &, {stableIsotopes[[All, 1]], Values[elem]}]
Out[12]=

Related Examples

de es ja ko pt-br ru zh