Message Boards Message Boards

Mass material property query from online databases

Posted 11 years ago

My first post. Be gentle. :-)

I have a list of materials in Excel. (say for example, Gold, Iron, Lead. I actually have 60 or so materials). I want to find out their hardness properties. I know on W|A I can get an individual hardness property by simply typing "Gold Hardness" for example. What command would I use in Mathematica to ask for the hardness properties of all of the materials, at once, (and for bonus marks, output it in a table that I could copy back into Excel)?

Cheers!

POSTED BY: Edward Brelsford

Here is an approach for items that are in Mathematica's MineralData curated data. This is for the first 20 in the list given by executing

MineralData[]

Here is the example:

In[1]:= hardnessData = 
 Map[MineralData[#, {EntityProperty["Mineral", "Name"], 
     EntityProperty["Mineral", "Hardness"]}] &, 
  MineralData[][[1 ;; 20]]]

Out[1]= {{"antimony", 3.25}, {"arsenic", 3.5}, {"bismuth", 
  2.25}, {"cadmium", 3/2}, {"chromium", 7.5}, {"copper", 
  2.75}, {"gold", 2.75}, {"indium", 3.5}, {"iridium", 13/2}, {"iron", 
  9/2}, {"lead", 2.25}, {"mercury", 0}, {"nickel", 9/2}, {"osmium", 
  13/2}, {"palladium", 4.75}, {"platinum", 4.25}, {"rhenium", 
  Missing["NotAvailable"]}, {"rhodium", 3.5}, {"ruthenium", 
  6.5}, {"selenium", 2}}

In[2]:= hardnessData = DeleteCases[hardnessData, {_, Missing[___]}]

Out[2]= {{"antimony", 3.25}, {"arsenic", 3.5}, {"bismuth", 
  2.25}, {"cadmium", 3/2}, {"chromium", 7.5}, {"copper", 
  2.75}, {"gold", 2.75}, {"indium", 3.5}, {"iridium", 13/2}, {"iron", 
  9/2}, {"lead", 2.25}, {"mercury", 0}, {"nickel", 9/2}, {"osmium", 
  13/2}, {"palladium", 4.75}, {"platinum", 4.25}, {"rhodium", 
  3.5}, {"ruthenium", 6.5}, {"selenium", 2}}

In[3]:= hardnessData = 
 hardnessData /. {name_, value_} -> {name, N[value]}

Out[3]= {{"antimony", 3.25}, {"arsenic", 3.5}, {"bismuth", 
  2.25}, {"cadmium", 3/2}, {"chromium", 7.5}, {"copper", 
  2.75}, {"gold", 2.75}, {"indium", 3.5}, {"iridium", 13/2}, {"iron", 
  9/2}, {"lead", 2.25}, {"mercury", 0}, {"nickel", 9/2}, {"osmium", 
  13/2}, {"palladium", 4.75}, {"platinum", 4.25}, {"rhodium", 
  3.5}, {"ruthenium", 6.5}, {"selenium", 2}}

You can then export this table of {name, value} to Excel by using Export as in

In[4]:= Export["/Users/dreiss/Desktop/hardness.xls", hardnessData]

Out[4]= "/Users/dreiss/Desktop/hardness.xlsx"

Giving an XLSX file that opens to

enter image description here

The other curated data sources of interest are listed here:

https://reference.wolfram.com/language/guide/PhysicsAndChemistryDataAndComputation.html

I haven't done much of this sort of computation yet with Mathematica 10, so this is just an outline of an approach. Others may have some more detailed and useful additional information.

POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract