Using the Wolfram Language in the Classroom: Chemistry
Welcome to day three of the Wolfram Language in the Classroom series. I hope you’ve enjoyed the lessons so far. Today I want to show you how data built into the Wolfram Language can be used in the chemistry classroom. The Wolfram Language has information on over 44,000 chemicals and thus provides a perfect environment for chemistry students to do comparative, data-driven analysis.
The unique advantage of using the Wolfram Language for computational thinking in a chemistry class is that it allows students to analyze curated data to create hypotheses and show correlations in a new way.
Lesson title: Data-Mining Chemical Properties
– Formulate problems in a way that enables the students to use a computer to solve them
– Automate solutions through algorithmic thinking
– Abstract data into a model
– Have students explore chemical properties for single chemicals and groups of chemicals
– Compare physical properties in a group of chemicals to find trends
– Fit a simple model to a dataset
This lesson is intended to be used as a guided exercise for your students. They should follow the steps laid out here and be encouraged to explore ways of changing the code on their own.
To get started, use ChemicalData to produce a list of the chemicals the Wolfram Language has data on. Give this list of chemicals the name allchemicals for easy use later:
You can check out the properties of a chemical by using ChemicalData again:
Get a list of all properties like this:
Often chemical properties are not measured or publicly available. In that case, ChemicalData returns Missing[NotAvailable]:
To create a targeted inquiry, pare down the number of chemicals by taking a subset. For example, restrict the scope to chemicals whose common name ends in “acid”:
Next, get the density of each acid in the group, sort them, and plot them all. Delete any chemicals for which the information is unavailable:
Now look for correlations between physical properties of the acids. It might be reasonable to assume that the density of an acid is related to its boiling point. Pull all the known densities and boiling points and plot them together to see if they look correlated. ListPlot will automatically remove any chemical where either property is unknown:
Well, those don’t look correlated at all! Instead of trying to find correlations by hand, employ some computational thinking methods and use the Wolfram Language to automatically plot every combination of properties, which can then be visually inspected. For brevity in this example, I will use a hand-picked list of common properties, but one could easily use all known properties:
The graph comparing the boiling points with the melting points seems to show a linear correlation. Quantify that by fitting the data to a linear model:
Now show the fitted line and the data together:
With a very small amount of code, you can create plots of multiple datasets to inspect for correlations, rather than trying to pick and construct them by hand. Having found a possible correlation, you are then able to quantify this correlation. Now the next step would be to have the students hypothesize if this correlation is real and why it has the relationship that it does. Using the capabilities of the Wolfram Language, you can move students beyond just looking for facts—you can ask them to interpret and analyze as well.
To see more posts in this series, please click here.