Wednesday, October 12, 2011

Wordclouds of Chemistry Texts

After stumbling across a post on One R Tip A Day about building Wordclouds using R, I thought I would try it out myself.  I have been subjecting my undergrad chemistry students to R, so this seemed like a good opportunity to use R for a little fun.  I decided that it would be interesting to look at some old chemistry books.  I picked three works from Project Gutenberg:
  • The Sceptical Chymist (1661) by Robert Boyle
  • Elements of Chemistry (1789) by Antoine Lavoisier
  • An Elementary Study of Chemistry (1905)
    • by William McPherson and William Edwards Henderson

The Sceptical Chymist (1661) Robert Boyle
Elements of Chemistry (1789) Antoine Lavoisier
An Elementary Study of Chemistry (1905) McPherson and Henderson

It's no surprise that Boyle's wordcloud is so different from the other two.  The influence of Alchemy was still quite strong in 1661, and Boyle's vocabulary reflects this.  It is perhaps more interesting to see how similar Lavoisier is to McPherson and Henderson despite their being 116 years apart.

Robert Boyle and Antoine Lavoisier were both instrumental in developing modern Chemistry, William McPherson was a chemistry professor at Ohio State University and one of the chemistry buildings there is named for him.

I adapted Paolo's code from  Wordclouds using R. You will need the R packages tm, wordcloud and RColorBrewer. I downloaded the books as plain text from Project Gutenberg and saved them in a directory called chemtxt.


library(tm)
library(wordcloud)
library(RColorBrewer)

#reads all files in the directory chemtxt
chemtexts <- Corpus(DirSource("chemtxt/")) 



book <- Corpus(VectorSource(chemtexts[["boyle.txt"]])) 
book <- tm_map(book, removePunctuation) 
book <- tm_map(book, tolower) 
book <- tm_map(book, stripWhitespace) 
book <- tm_map(book, function(x) removeWords(x, stopwords("english"))) 


# format as a dataframe with words and their frequencies 
book.tdm <- TermDocumentMatrix(book) 
book.m <- as.matrix(book.tdm) 
book.v <- sort(rowSums(book.m),decreasing=TRUE) 
book.d <- data.frame(word = names(book.v),freq=book.v) 


#color scheme 
pal2 <- brewer.pal(8,"Dark2") 


# uncomment this line to save wordcloud as an image file #png("wordcloud_boyle.png", width=600,height=600) 


#I picked just the 60 most frequent words 
# to show ALL the words in the wordcloud use max.words=Inf wordcloud(book.d$word,book.d$freq, scale=c(8,.2),min.freq=3,max.words=60, random.order=FALSE, rot.per=.15, colors=pal2) 
dev.off()







Enhanced by Zemanta

Tuesday, September 20, 2011

What is public science, and why do you need it?

Science icon from Nuvola icon theme for KDE 3.x.Image via Wikipedia
Did you use a browser to zoom around on the internet today? Have you ever been vaccinated? If you answered yes to either of those questions, your life has already been made better through publicly-funded science in America. Public science is basic scientific research funded by governments, and just in America alone it's led to breakthroughs in everything from medicine to clean energy. But now public science is under threat. Here's why — and why we can't afford to lose it.
The Science Fiction blog IO9.com has a nice overview on the value of basic research funded by the US government and some of the myths about science funding.  Don't rely on know-nothing blowhards who tell you the US should cut funding for science.  Check it out.

What is public science, and why do you need it?
Enhanced by Zemanta

Wednesday, September 14, 2011

Nano "Motor" Powered by Chemistry

We have been hearing about nanotechnology in the media and in science fiction for a long time now.  I have always been a little skeptical  about how realistic an idea "nano-machines" are.  This new research has me rethinking that skepticism.

A communication published online in Angewandte Chemie describes what you could call a working nano-motor.  Ayusman Sen and his coworkers at Pennsylvania State University have prepared little spheres less than a micrometer across - one side of the sphere is gold and the other side is silica (SiO2).  On the silica side they have attached a Ruthenium compound known as a Grubbs Catalyst.  The Grubbs Catalyst reacts with alkenes which are the "fuel" for the motor.

Image via Angewandte Chemie

When they place their motor-particles in a solution containing norbornene, the catalyst group on the silica side of the particle polymerizes the norbornene, and the amount of unreacted norbornene molecules on the silica side of the particle decreases.  This causes a concentration gradient - the concentration of norbornene on the gold side is higher than the concentration of norbornene on the silica side.

It is this difference in concentration of "fuel" molecules that makes the particle move.  Osmosis involves solvent molecules moving from a region where concentration is low, to a region where concentration is high.  As a result, solvent molecules flow around the "nano-motor" from the silica side (less norbornene - because the Grubbs cayalyst polymerized it) to the gold side (lots of norbornene).  And this causes the particle to move in the opposite direction.

Professor Sen anticipates that eventually you could redesign his nano-motor to use a "fuel" like glucose and doctors could use it in the bloodstream to repair damaged tissue.  Just like something out of Fantastic Voyage.

Fantastic VoyageImage via Wikipedia

Self-directed microspider could repair blood vessels - New Scientist

Original research article:  A Polymerization-Powered Motor  DOI: 10.1002/anie.201103565
Enhanced by Zemanta



Wednesday, September 7, 2011

What is a Bridgehead Carbon anyway?

It's the start of a new school year and I am going to try to post a little more regularly.  Since it has been a while since I posted on a regular basis, I thought it would be a good idea to re-introduce this blog.

What is a Bridgehead Carbon anyway?  I teach undergraduate chemistry and my main area of interest is Organic Chemistry.  I chose the name "Bridgehead Carbons" partly because I have always liked the look of bicyclic compounds like norbornane.  You can think of Norbornane as being a cyclohexane (in pink) with a CH2 unit (in black)that acts as a bridge connecting the top and the bottom of the pink ring.  The carbons that connect the "main ring" to the "bridge" are the Bridgehead Carbons.



Another reason for choosing this name is that Bridgehead Carbons serve to connect different rings within the same molecule, and I intend to write about a variety of topics that I none the less feel are connected to my experience with chemistry and teaching.

So, what is this blog all about?  Stuff that interests me as a chemistry teacher, especially organic and bio-organic chemistry, cheminformatics, things that might be helpful to college students in general, and anything else that strikes my fancy.

Enhanced by Zemanta

Science in the Library winner

Louise Peck posted this on the CHEMINF-L list serve
The Royal Society of Chemistry's RSC Publishing division recently ran an annual photograph competition with the theme 'Science in the Library'. 
The competition prize was that the winning photograph would be placed on the front cover of the 2012 RSC Publishing Catalogue and was voted for by over 115 RSC staff and the RSC Library Advisory Board.
image from RSCPublishing Blogs Home 
And the winner is Johns Hopkins University in Baltimore, MD,  home of the first PhD program in chemistry in the United States which was started by Ira Remsen if I recall correctly.

You can download a copy of the 2012 RSC Publishing Catalogue from their website.  All 17 libraries that were entered in the contest are shown on pages 2-5 of the catalogue.  See if you can guess which one I have visited.

Monday, April 25, 2011

End of the Year Writing Advice

It is the end of the school year and our seniors will be turning in their senior research papers soon.  I think that scientific writing in particular can be a big challenge, especially when writing about your own research.  When you work on a project for most of a year you become emotionally invested in it, and you loose sight of its complexity.  But in sharing your results with others, whether as a paper or an oral presentation, it is easy to assume that everyone knows what you know.  And when discussing complex ideas, you can try to say too much at a time.

The original list has seven rules, but I am only quoting the first three.  If you are a writer of any sort, go read the original post with all seven rules.
VS Naipaul’s Rules for Beginners 
1. Do not write long sentences. A sentence should not have more than ten or twelve words. 
2. Each sentence should make a clear statement. It should add to the statement that went before. A good paragraph is a series of clear, linked statements. 
3. Do not use big words. If your computer tells you that your average word is more than five letters long, there is something wrong. The use of small words compels you to think about what you are writing. Even difficult ideas can be broken down into small words.
The point is to use good judgement.  Use big words when they are necessary, not just to impress your reader.  Strive for short, direct and clear.  If the result is too simple, you can always revise.  But if your first draft is full of long, convoluted sentences it can be hard to make it concise.

Sometimes you don't really understand some of the details yourself.  Really good writing can help you to better understand the topic yourself.  It forces you to choose your words carefully and think about the meaning.  

VS Naipaul’s Advice To Writers - The India Uncut Blog - India Uncut via BoingBoing
Enhanced by Zemanta