Sunday, August 28, 2011

Genetic Algorithms.

The hominoids evolved from a common ancestor.  Source.


I have been thinking a lot about genetic algorithms lately.  The idea was introduced to me here, where I lost many an hour watching cars evolve to fit different tracks.  I later saw it being used in the lab where I did my honours thesis, with a peer attempting to design better fuel cells.  Perhaps I shall start with an explanation of what exactly these genetic algorithms (GAs) are.

A GA seeks to mimic the natural evolution that we see in our day-to-day life on Earth.  Take for example how we humans reproduce.  We are produced via sexual reproduction, we get half our chromosomes from our mother and the other half from our father, called "crossover" in terms of genetics and GAs.  After random mutations (which GAs also utilise), we are essentially a genetic experiment.  We have a fairly high success rate currently due to the societies we have built, but in earlier eras survival was not necessarily the virtual guarantee it is now.  Should the organism survive to procreate, it is largely considered a success.  The better the individual, the better the chance of this success.  Therefore, with increasing number of generations, the "good" traits we inherit from chromosomes should come to predominate in the larger population, since ideally those individuals with "bad" traits are less likely to succeed and procreate.

Life, in our case, is the equivalent of a "fitness function" for GAs.  Life determines fitness of individuals by killing off or making the less successful crossovers less likely to breed.  In terms of computers, the fitness will be evaluated based on what the scientist wants to accomplish with the algorithm.  The boxcar example above evaluates the fitness of cars based on how far they get on a given track, and how fast they do it.  A selection process then chooses breeding pairs to create the next generation (with the most successful individuals very likely to reproduce).  Naturally, crossovers of fit individuals does not guarantee fit offspring, but it becomes increasingly likely as the population will "converge" to a solution for a given problem.

Sunlight.  You'll understand if you read the next paragraph.  Source.

By now, my dear reader, you must be wondering what on Earth can be accomplished with a GA.  The answer, really, is whatever you want it to.  A video of a TED talk by Bill Gross was my inspiration for this post.  Bill Gross decided that he wanted to design a solar energy solution using mirrors and Stirling Engines, and he used a GA to do it.  He designed the computer to utilise chromosomes based on mirror pieces in three dimensional space (presumably with random placement and orientation), and with enough time, the GA gave what it felt to be the best solution based on the fitness function used (it sought to maximise the hours of sunlight the device would be useful for).  I highly recommend watching the video, at least so that one can view the results, which are truly remarkable.

The strength of GAs is that, so long as they utilise a good fitness function, they can come up with solutions a human engineer might never come up with.  Perhaps we as humans would think of these solutions with enough time, but we are creatures of habit.  Computers, given enough degrees of freedom, can come up with truly remarkable solutions without the bias towards existing solutions that we humans may exhibit.  These solutions often represent the convergence of an entire population within the computer to one design.  It is just as we humans have come to where we are today through genetics and evolution.

Arguably the most fascinating aspect of GAs is that we are not exactly certain why they work.  There exists no theorem or mathematical proof which would explain why a GA would ever be a good solution.  Additionally, the solutions generated by GAs often catch scientists off-guard.  They look strange and new to us, but must be a good solution, as they have already been tested under the constraints of the fitness function.  Bill Gross, too, was surprised to see what his GA had developed, and like other scientists, had no idea how it had come to such a conclusion.  The only reason we have to think GAs will work is the large GA experiment we see around us, commonly known as life.

As a result of all of this, I have found myself wondering where else GAs could improve our lives.  I also think I could utilise a GA to select a fantasy hockey pool team, a thought that titillates me to no end.  I'm not sure I've done the best job of explaining GAs here, but I hope I've piqued your interest enough that you will do some reading of your own.  It's truly wonderful stuff.


Thursday, August 25, 2011

Garbage Incineration.

Municipal waste being incinerated.  Courtesy Wikipedia.

It would seem that there is some kerfuffle in the Greater Toronto Area.  The ground has been broken on a garbage incinerator project, and the locals are certainly worked up about it.  While I will not pretend to be an expert on the subject, I do know some pertinent science that I am sure you, my monocled, Brandy-swirling readers would love to hear about.

I will freely admit that at first, burning garbage seems like a bad idea.  After all, many of us have thrown things onto a fire and seen the evolution of black pillars of foul-smelling smoke.  This, however, is far different from what goes on in a garbage incinerator.  You see, inside an incinerator, it is much easier to get up to high temperatures in an enclosed space than in an open fire pit.  Those of you who have used a chimney to ignite charcoal (or "cookin' biochar", as I am certain no one calls it) may be familiar with this effect.  The objective here is to achieve total combustion, where all carbon [or fuel, the garbage] is fully converted to carbon dioxide ["is fully oxidised"].  This is far better for our air than the results of impure combusion, which include much higher amounts of ash, soot [what I assume to be aerosolised/dispersed ash, really], and harmful products like carbon monoxide.  Fire pits see impure combustion when "smoky".  The combustion above appears to be very pure, by comparison.

The structure and synthesis of polystyrene. Wikipedia.

I will also admit that, in many cases, garbage incineration is often accompanied by the abandonment of recycling plastics.  They are necessary to fuel the blaze, and are included with the garbage.  This, too, sounds like a nightmare to the environmentalist.  I agree that in a perfect world, all plastic would be recycled forever.  Sadly, this is either not the case, or not possible.  Some classes of plastics would be easy to recycle.  Styrofoam, polymerized styrene [or "polystyrene"] is an example.  This is easily dissolved in the solvent acetone.  Acetone also has a very, very low boiling point.  It would be very easy to dissolve all those meat trays and packing chips, then boil off the solvent to have relatively unscathed polystyrene to reuse.  Unfortunately, as with other classes of plastics (water bottles, especially), this is not the case.  The manufacturing process for these types of plastics is inexpensive enough that the recycled product is too expensive for anyone to purchase.

The other challenge facing plastic recycling is the nature of the substance.  As can be seen above, plastics [polymers] are very long chains of some individual molecule [the monomer].  The recycling process must heat plastic so that it can be reformed.  Heating damages the bonds of the polymer, causing the plastic to degrade.  In fact, the reason that one rarely sees 100% recycled plastic products is that the structural integrity of recycled plastic is compromised, and it must be blended with new plastic so that the product may serve its purpose.  For the record, recycled metal does not share this problem, and I think it a fabulous idea, given the environmental costs of smelting metal.  Metal is also easily recovered in the incineration process.

A garbage incinerator in Vienna.  Source.

"Now see here!" You may demand.  "Won't this contribute to global warming?  Spewing out all that carbon dioxide?!"  This is an excellent point, and I am glad that you [might have] raised it.  It is true that greenhouse gas emissions will be added to with garbage incineration, however, it is much better than other emissions associated with dumps.  You may have seen torches burning outside of buried garbage dumps.  I know that I have near Carp, Ontario.  The reason for this is the venting of methane, a common byproduct of garbage disposal.  A methane leak is far, far worse than the leaking of carbon dioxide into the atmosphere.  The reason can be explained with very simple physical chemistry and math (you may skip the next paragraph if you are truly averse to it, though I find it interesting).

The surface of the Earth is heated by the Sun.  As can be seen in math here, the light that an object emits depends on its temperature.  The very hot Sun emits all colours of the rainbow, but the Earth is by comparison only lukewarm.  Objects at that temperature emit infrared (IR) radiation (this is how night and thermal cameras work).  Normally, a substantial amount of heat from the Earth is converted into IR and is lost to space.  Molecules, however, will absorb IR and begin to vibrate, blocking the exit of the heat into space.  This is the cause of the greenhouse effect.  Now, not all molecules are created equally.  The amount of IR that a molecule can absorb depends on how many ways that molecule can vibrate, known as vibrational modes.  The number of vibrational modes of a molecule depend only on the number of atoms.  Carbon dioxide has three atoms, and linear molecules follow the formula 3N-5, meaning it has 4 modes of vibration.  Non-linear molecules have 3N-6 vibrational modes, giving methane, a 5 atom species, 9 modes of vibration (or something like that).  Other math which I do not wish to get into demonstrates that this makes methane 21 times worse to have in the atmosphere than carbon dioxide.

We must also consider the issue of storage.  Many municipalities are running out of space for garbage, and it is much easier to bury the remaining ash of an incinerator than it is for the immense volume it started as.  Also, while most modern dumps are more or less sealed, leaks of contaminants are not impossible.  Many contaminants released by the incineration process can be captured before discharge into the air, meaning that, in my opinion, it is likely safer to incinerate garbage than it is to simply bury it.
Power transmission lines, because I discuss it below, and this certainly is a large block of text.  Source.

I must also discuss the issue of power.  Conventional dumps may use the methane generated by the garbage to spin a turbine and generate power, which seems like a fantastic idea.  Energy from our waste. However, garbage incineration offers a much higher amount of energy to us.  The fire from the incinerator can be used to generate steam from a boiler.  This would spin a turbine in exactly the same way as nuclear, coal and natural gas power plants do, but from a power source we are currently wasting. In a twist on this idea, a company called Plasco has found that heating and exposure to a plasma torch can produce refined syngas (mentioned previously in my biofuels post), which can then be used to make various other products and fuels.  It is also worth noting that steam-generating applications can route waste heat to nearby schools and hospitals to heat hot water, boosting the overall efficiency of the process.

With this in mind, I feel that garbage incineration is beneficial, and ultimately an opportunity.  It would lead to safer disposal of our waste, which is inherently invaluable.  Further, it represents an untapped energy source which could ease strain on our grid, and provide baseline electricity generation which most renewable fuels cannot (as the sun does not always shine, nor does the wind always blow).  I think that, if done properly, widespread incineration efforts would lead to a better tomorrow.


Saturday, August 20, 2011


Temperate, mixed forest.  Courtesy Wikipedia.

It was not too long ago that I was sitting in a crowded environmental issues class, listening to my professor (who has a blog here), extol the virtues of trees.  He summed it up well with the statement "Trees are the answer.  What's the question?" They do have a number of benefits to the environment, and subsequently us humans.  Let me first tell you a little about trees.

Essentially, trees will grow wherever they can.  So long as there is enough water (rain, usually), and the soil is not in some way harsh, trees will start popping up.  First, small grasses and weeds will cover available soil.  Next, taller weeds compete and win against the shorter growth.  With the shade from taller weeds, conifers (usually evergreens with needles), begin to take hold.  Then, with the limited lifespan of conifers, deciduous trees may also be added to the mix.  This is how the mixed forest of North America works, anyway.  In fact, switchgrass may be used to speed along this process as a "tall weed" analog in environmental regeneration efforts.  Its roots are also an excellent tool for fixing soil to avoid erosion, but I don't need to tell you, my monocled, well-dressed, non-spambot readers.

The Taiga in Nordic-Europe.  Courtesy Wikipedia.

Trees do much for the environments of which they are a part.  Excluding habitat considerations, their root systems bind the soil to prevent erosion.  The leaves and needles left on the ground to rot enriches the soil's carbon content, making it more hospitable to other plant life.  They also provide shade to the forest floor, which becomes important in places where water is a little more scarce.  The Taiga forest, that which encircles the globe through Russia, the Nordic countries, Canada and Alaska, will actually affect global carbon dioxide concentrations when the seasons change.  Supposedly, it is as if the trees all take a deep breath in preparation for winter, storing potential energy to use when the sun is scarce and conditions are harsh.  In the interest of full disclosure, I may have this backwards for some reason.  However, I just handed in my last paper of my University career, and I relish this recreational writing in which I do not need to meticulously fact check.  I am a terrible academic.

An approximate representation of the Sahel region of Africa.  Courtesy Wikipedia.

Trees have also been part of a stunning revolution in the Sahel.  Most of my information on this topic comes from a truly fascinating article I read in Scientific American, and not necessarily scholarly resources (ANARCHY REIGNS... *ahem*).  The Sahel is a sub-Saharan region of Africa which is prone to drought and subsequent famine, and by all accounts is a terrible place to live if one values food. However, recent years have seen an incredible increase in food production across the region.  This is not in thanks to Western scientific efforts, but rather the scientific, inquisitive spirit that persists in all mankind.  An especially curious man named Yacouba Sawadogo led this revolution.  He is a subsistence farmer who speaks only the local dialect, and no official language of Burkina Faso.  At a time when crops were poor, he followed the local practice of making small conical holes in the soil to direct the scarce rainfall towards the roots of his plants.

Yacouba's innovation started with the addition of manure to these holes.  Despite being called wasteful by his peers, he felt it would work.  I feel it made good sense, the collected rain would filter through manure, bringing nutrients to the plants.  The true revolution, however, was to follow.  In the manure, one could find seeds of all varieties, a notable constituent being the seeds of the local trees.  The use of trees in farming is by no means a new idea, the shade is good for crops in places like the Sahel (just as grass is useful between rows of corn).  However, live trees do not have a good success rate in being transplanted to these regions, and they often die.  Yacouba saw these trees start to grow, and waited to see what would happen.

The trees, which did not have to endure shock of transplantation, thrived.  In a land plagued by famine and drought, crop production increased.  He also had a new source of income, the trees could be pruned and the wood sold for fuel.  It did not take long for the practice to catch on.  All across the Sahel, crop production has increased upwards of 50%.  Families which once kept one grain elevator now require three to four to house all the millet grown.  The 1980s saw very harsh droughts, during which time crop production was kept stable under those farms practicing farmer-managed natural regeneration (FMNR).  Further, it has been suggested that during these droughts, the water table was actually rising due to the widespread adoption of FMNR.  It is an age of unprecedented food security for the modern-day Sahel.

FMNR did not catch on quickly everywhere, however.  In some countries, policies existed which stated that trees growing on a farmer's land did not belong to said farmer, and the trees and/or surrounding land could be seized by the government.  The natural reaction to this is to kill any saplings.  Luckily, the successes of FMNR were so great that the policies have since disappeared, and FMNR is now common practise all across the Sahel.

A Red Mangrove tree.  Courtesy Wikipedia.
This is by no means the only success story of trees.  Though I am sure many others exist, I wish to share another story I find fascinating.  It is via the kind of tree pictured above, the Mangrove.  These trees exist on the border of ocean and land.  In an interesting twist, the extensive root system of the mangrove trees will trap soil which would otherwise be lost to the sea.  With increasing amounts of trapped soil, the mangrove becomes more land than swamp.  It is this way that mankind can reclaim land from the sea via natural mechanisms.  This is practiced in Bangladesh with help from the Dutch (a people quite adept at reclaiming land from water).

You may, as I did, wonder how the tree can survive in such a salty environment.  It is, after all, not easy for plants to do this.  While the roots of the plant keep out well over 90% of salt, not all can be excluded if the plant wishes to get any water.  So, by some biological mechanism (i.e. "black magic", to a chemist), the mangrove tree pumps the salt to old leaves, which then become sacrificial.  The tree drops the leaves, and continues to grow, the mangroves steadily edging farther and farther out into the ocean.

A sacrificial leaf.  Courtesy Wikipedia.

So there you have it.  Trees are truly wonderful.  A natural beauty; a tool of man.  The next time you are out and about, stop and ponder the majesty of a forest, and just what it means to the planet as a whole.  If you want mood music for the experience, I recommend the Pines of Rome by Respighi.  I listened to it while writing this post, and quite enjoyed myself.


Edit: It would appear that trees are also responsible for the evolution of rivers that we know today, according to this Scientific American podcast.  It seems that water used to flow wide and shallow over the land.  It wasn't until the evolution of tree-like species with deep, soil-fixing roots that rivers took their present shape.

Sunday, August 14, 2011


Grapefruit, courtesy Wikipedia.

It is summer in the northern hemisphere.  There is much fun to be had in the sun, vacations and adventure abound.  Unfortunately, with summer comes mosquitoes, and various other biting insects.  The worst part about such pests is that the only 100% solution is to completely cover oneself, which seems impractical and needlessly warm in such a season.

I have long pondered how to deal with such problems.  In earlier years, I investigated how to breed dragonflies.  I had seen them hunt the pests while camping, and was intrigued.  Regrettably, dragonflies breed in standing water, as do mosquitoes.  I have also considered constructing a "bat box", a box in which bats may rest during daylight hours.  In my search through unofficial literature, I found that one can fairly easily house 300 bats in a larger box.  As an interesting aside, in Canada it is necessary for one broad side of the house to face south, and to paint the box black so that the bats will be warm during the day.  I had no idea this would be a concern in weather that I consider stifling.  I also discovered that pests may be deterred by the sound of the bats (imperceptible to us, but a loud alarm to biting insects), which could also provide relief.  For a second digression, I would be curious as to whether or not the presence of a bat house would discourage nesting within human homes.  I know one family who seems plagued by bats in August.  Would a nearby bat box provide an easier home, or draw more bats to the site, and thus the family home?  Details or case studies would be appreciated.

As a final digression on the topic of bats, let us consider ammonia.  Bat feces are rich in the stuff, that which humans use for both explosives and fertiliser (especially for hungry crops like corn).  Brazil (I think) was a world power in the production of ammonia due to its large bat population.  This was, of course, before the Haber process was developed.  This allowed humanity as a whole to produce ammonia from nitrogen and hydrogen gases, and also allowed the Germans to produce explosives in the absence of mined ammonia during The Great War, or WWI.  For the record, there are no evil chemicals, only humans who use them poorly or without due respect.

Digressions aside, whilst bat boxes seem like a good idea to reduce the pest population, I am certain that I would still be bitten throughout the course of the summer.  Currently, the best solution is to use various products one burns to repel mosquitoes, or to use DEET to hide oneself from the pests.  This is a bother to me, that DEET is called a "repellant", but does nothing to repel insects, only hide us from them.

"Now, see here!" I assume you are demanding by this point, brows furrowed over monocles, Brandy angrily swirled.  "Why on Earth did you start this article with a picture of a grapefruit?"  An excellent question, my non-spambot friends.  It would seem that there do exist chemicals which will repel ticks, mosquitoes, biting flies, and all your most hated pests.  One is called nootkatone, and it will repel these insects.  The best part?  It is harmless to us, humans are not affected by the molecule.  The downside?  You will smell like grapefruit (if you dislike that sort of thing).  This is, really, the worst effect of a nootkatone repellent.  It is part of the aroma of a grapefruit, and is added to a beverage known as "Squirt", which I have never consumed.  Grapefruit, so you know, does not contain high enough concentrations of nootkatone to deter the pests itself.  Spreading grapefruit juice on yourself will only make you sticky and dissatisfied.

Nootkatone, courtesy Wikipedia.

The effect of nootkatone on a pest is rather dramatic.  The molecule attacks the nervous system and by some mechanism which I do not understand, causes severe over-stimulation.  The insect will shake itself to death.  The bugs are aware of this, and are deterred by the scent of it.  Whereas an arm covered in DEET will be ignored by mosquitoes, the same arm covered in a 2% solution of nootkatone will repel mosquitoes.  Should the insect pursue your flesh anyway, it will die.

For now, nootkatone is considered "prohibitively expensive" to use in commercial repellents.  Actual repellents, what a concept!  At roughly $4000/kg, there are far cheaper alternatives.  Nootkatol, the alcohol equivalent to nootkatone's aldehyde, has been shown to demonstrate similar effects, and may be much cheaper to manufacture.  Hopefully once organic chemists work their magic, we may have a way to manufacture the nootkat- family of molecules cheaply and efficiently.  I shall continue to hope anyway.  I hate being bitten.


Monday, August 8, 2011

Hot Peppers

Capsaicin molecule, courtesy Wikipedia.


The molecule pictured above may look like a simple technical drawing, but this molecule means pain to all who encounter it.  Capsaicin is the active ingredient in hot peppers, and represents somewhat of a fascinating topic to me.

While my understanding of this molecule's chemistry is somewhat limited, I will discuss it briefly here.  You can see various oxygen atoms, along with one nitrogen.  This often means that the molecule may be dissolved in water.  However, as you peer through your monocle at this article, you will also note that they are a minor part of the overall organic molecule.  I will note that I use "organic" in the technical sense, in that the molecule contains carbon bonded to hydrogen (lines here represent carbon-carbon bonds, and it is assumed that hydrogen fills out the rest of the available bonding sites).  This molecule will bind to pain receptors in mammals, activating them despite the absence of a real threat to the organism.  The consequence of the organic structure of this molecule is that milk and yogurt will help those eating spicy foods.  The fats in dairy will dissolve this molecule and carry it to the stomach.

In the natural world, this amazing molecule is found in the Capsicum genus, the plants we know as peppers.  Sweet bell peppers have little to none of this molecule, but most other chilies (the "hot" peppers) will have comfortable levels to monocle-dropping amounts.  This, of course, leads to the question of how to measure the quantity of capsaicin in a pepper.  The Scoville scale, measured in Scoville Heat Units (SHU), remains the only real measure we have to answer this question.  The chemist Scoville designed this test to take one drop of an alcohol-based extraction of the fiery peppers, then systematically adding equal parts of [saturated] sugar water until the spice was no longer detectable by a panel of judges.  The current method of testing removes the human element, and utilises High Performance (or "Pressure", depending on where you learned about it) Liquid Chromatography, HPLC. Simply, HPLC measures the actual concentration of capsaicin in a pepper sample, and normalises it ["makes it fit with"] the classical Scoville scale.  Either way, sweet peppers represent zero on the scale, while purified (a.k.a. "weaponised") capsaicin measures about 16,000,000.  All other peppers are found somewhere in the middle.

The habanero pepper, ~200,000 SHU

As someone who enjoys gardening, I have found great delight in growing a specific cultivar of the habanero, the Caribbean red habanero (~400,000 SHU).  Initially, I was looking to experiment with a useful plant which could be grown indoors.  Since my girlfriend and I enjoyed cooking with store-bought hot peppers, I thought it would be interesting, perhaps fun, to grow some of my own.  The clerk at Thrasher's in Belleville, Ontario was incredibly helpful, pointing me to the [incorrectly labelled] "hottest pepper in the world".  I thought this would be perfect, all I would need was one tiny pepper to a large batch of spaghetti sauce!  I was correct.  In fact, I learned that it needed to be a large batch, especially if the seeds were not removed.  What I did not realise was that I had purchased a pepper that, while not the hottest in the world, was incredibly flavourful.  After some practice, I produced a batch of spaghetti sauce which was heavily complimented by my apartment-mates.  The Caribbean red has a remarkable fruity flavour, it is truly astonishing how pronounced it is as such a minor constituent in spaghetti sauce.  I was surprised, especially after my North American upbringing had only exposed me to jalapeno peppers (~5,000 SHU), the flavour of which I do not care for.

This delicious flavour, as it happens, is part of an evolutionary strategy of the Capsicum genus.  For reasons I do not quite understand, it is considered not desirable from an evolutionary standpoint to have the seeds of a plant scattered near to the parent.  Land-based organisms such as mammals are then ill-suited to carry and eliminate capsicum seeds.  By comparison, birds which eat the seeds and excrete indiscriminately (I like that phrase), are ideal candidates for spreading the seed.  The plants then have evolved with capsaicin which will deter mammals but not birds.  As a result, you may coat your bird seed with said molecule.  Birds will love it, but pests will find the seed extremely uncomfortable.  As an aside, humans are the only mammals known to eat these peppers.  It is theorised that the adrenaline rush we receive releases "feel-good" hormones, and encourages us to continue eating them.  Leave it to humans to engage in such foolishness.  For the record, when I have eaten scotch bonnet (100,000-250,000 SHU range) peppers on their own, I laugh an awful lot and have a wonderful time, save for the pain.

An unripe Bhut Jolokia pepper (~1,000,000 SHU)

As a result of this foolish behaviour, businesses may thrive on people who wish to torture themselves for a somewhat-natural high.  Breeding experiments are rampant to make the hottest of hot peppers.  From extremely hot, naturally occurring peppers such as the Bhut Jolokia of India (pictured above) around one million SHU, the current hottest pepper according to the Guinness Book of World Records is the Trinidad Scorpion Butch T (which appears to be a location, then manly/scary words), which is just south of 1.5 million SHU.  I remain doubtful this will last given the current pace of things.  A quick Google search will turn up many pictures of this pepper, and YouTube has many a video of deliberate eating of, and pranks involving the Bhut Jolokia.

As it stands, I am pro-pepper.  I have a Caribbean red (of Capsicum chinese family, a lovely cultivar of the usual habanero) which is currently flowering, and a "Super chilli", which appears to be a random cultivar of the Capsicum annuum family designed to produce ~30,000 SHU peppers in a large supply.  As of yesterday, I also possess a Bhut Jolokia pepper, the seeds of which I intend to keep and grow.  I also hope to make a good batch of spaghetti sauce, I have heard the bhut is very flavourful, though I am slightly frightened of my purchase.  Its skin is bright red and has a bumpy/rough texture, as if Satan himself resides in the pepper.  Hopefully the $2 was worth it.  Should I fail to post again, dear reader, assume I died a spicy, spicy death.


Edit: I lived.  While I did not make spaghetti sauce, the Bhut Jolokia chili con carne was delicious!