Bubble

It's about time I popped this bubble of silence.

I've been working hard on two programming projects this summer, namely my Google Summer of Code project and a fancy upgrade to some molecular dynamics software. In my previous posts, I looked at the back-end of Step and some of the mathematics of smoothed particle hydrodynamics. There are still plenty of outstanding problems in those areas but I'll address those gradually in the coming weeks. For this post, I'll give an overview of all the GUI/user interactivity stuff that i'll have to tackle on my quest to implement fast fluid simulation.

I'll just enumerate the ways the user can interact with a fluid and trace through exactly what is going on behind the scenes. I know, KDevelop/IDEs are pretty fancy, but I'm oldschool so I tend to just follow the code execution manually. It's kind of like a grep-based treasure hunt! So, I'll just give some running commentary with bonus screenshots from the current Gas classes. I doubt many readers of this blog will find this interesting, but my dream is that this post series may someday be useful for a new Step developer =P 

Oh, if you're a Qt newbie just remember that any class with a Q is a Qt class, and don't forget your slots and signals.

Read the rest of this entry »

Debbie Smyth Tape Measure Project

The trials and tribulations of uncertainty run deep in the hearts of experimentalists. From our biased human minds, to the imprecision of our measurement devices, to the quantum uncertainty of our universe, errors have confounded scientists for eons. Even within the safe and deterministic world of computation, inexactness is rampant.

There are two main types of numerical errors. The first of which is result of computers having a limited number of bits (32 or 64) to represent numbers. All the coolest real numbers have an infinite number of digits so we're restricted to representing numbers that differ by machine epsilon.

The second source of numerical error pops up a lot in numerical algorithms, including those implemented in Step for solving differential equations. It would be nice if we could perform exact symbolic computation all the time, but physics can get messy, especially with errors! Almost any time we take a derivative on computer, we approximate it using a taylor series. This approximation works great if we keep an infinite number of terms but who has the time to calculate all that? Thus, our results differ from the exact answer based on where we truncate our taylor series. This truncation error combined with the floating point error mentioned above, has the potential to cause serious numerical instabilities and pain for computational scientists.

Numerical issues aside*, in true experimentalist fashion, Step allows users keep track of the propagation of user-inputted uncertainties over the course of a simulation. The mathematics behind this process is reviewed briefly here. As an example let's look at the calculation for the uncertainty in kinetic energy in the Step's ParticleErrors class,

 

double ParticleErrors::kineticEnergyVariance() const {
  return _velocityVariance.dot(particle()->velocity().cwise().square()) * square(particle()->mass())        + square(particle()->velocity().squaredNorm()/2) * _massVariance;
}

 

The kinetic energy (KE) of a particle is a function of both mass and velocity, where each of these variables have their respective uncertainties. In order to calculate the variance of kinetic energy we have to take the sum of d(KE)/dv multiplied by our velocityVariance and d(KE)/dm multiplied by our massVariance. The function only looks a bit confusing because we want a scalar value and we have to use a few Eigen functions to deal with 2D vectors. 

The trouble with smoothed particle hydrodynamics is that each "fluid particle" is inherently an approximation of many particles or a bulk region of fluid. Nonetheless, the calculated densities and pressures for each chunk of fluid are subject to uncertainty. As outlined by Muller et al., any scalar quantity A can be calculated by summing over all particles j with some smoothing kernel defined by W:

Discrete Equation for Scalar Quantity in SPH

Given the user-inputted uncertainty in particle mass m and whatever calculated uncertainty we have for our quantites A and p, this formula can be used with the method above to calculate uncertainty in the newly calculated quantity A. These calculations will be coded in the FluidParticleError class outlined below. Note the addition of the member variables for densityVariance and pressureVariance. These values could be calculated on the fly, but in doing there would be a large amount of calculations due to the summation of all nearby particle errors. Later in this project this will also include Viscosity error calculations that depend on the velocity of nearby particles using the same equation above. 

Step Fluids UML Errors 1

It's a week into my GSOC project and I still have lots of work to do. Next post will be a bit more software development oriented, as I'll look more at the Qt GUI and how it connects with the numerical back-end of Step. Expect a post shortly!

*You can adjust the precision of your Solver in the properties dialog box of Step!

Richard Feynman, Safecracker

Reading textbooks gives me scary flashbacks of my days as an undergraduate (about 2 weeks ago). I did a little research on the internet and supposedly there are these things kids are calling "light reads" that make reading fun again. Comic books/Graphic novels are the pinnacle of fun, so I put together a quick list of illustrated reading to salivate the mind in absence of raw textbook facts.

1. Larry Gonick's The Cartoon Guides

Cartoon Guide to Physics

First order of business, the master of non-fiction science comics: Larry Gonick. He's the author of such masterpieces as The Cartoon Guide to Physics, The Cartoon Guide to Chemistry, The Cartoon Guide to Genetics, and The Cartoon Guide to the Environment. I own the Physics one so I can testify that these books have high educational merit!

2. Jay Hosler's The Sandwalk Adventures

The Sandwalk Adventures

Jay Hosler is on fire with biology themed comics. The Sandwalk Adventures is a tale of two mites living on a eyebrow follicle of Charles Darwin. Comics Worth Reading has a nice review. Also check out Clan Apis, Hosler's comic about honey-bee life and insect society.

3. Jim Ottaviani's Two-Fisted Science/Dignifying Science/Suspended in Language

Two-Fisted Science

"Two-Fisted Science, a Xeric Award-winning and Eisner nominated original trade paperback, features true stories from the history of science. Some are serious, some are humorous, and most are a bit of both. Scientists highlighted include physicists Richard Feynman, Galileo, Niels Bohr, and Werner Heisenberg, but you'll find a cosmologist and some mathematicians inside as well." -GT Labs

Jim Ottaviani is making big moves in the science comics game. Dignifying Science illustrates the stories of a number of famous female scientists like Emmy Noether, Lisa Meitner, Marie Curie, and Rosalind Franklin. Recently, Jim collaborated with Jay Hosler (see above) on Suspended in Language, a biography of Neils Bohr. If you're in the area, you can catch Jim at the Toronto Comic Arts Festival and get your comics signed!

4. Capstone Press' Max Axiom/Inventions and Discovery Series

Max Axiom

Capstone Press brings forth a veritable treasure trove of K-12 science teaching material in graphic novel format. They star Max Axiom, your standard african american superhero scientist in action-packed adventures like The Shocking World of Electricity, The Attractive Story of Magnetism, Investigating the Scientific Method, and Understanding Global Warming. Capstone Press also publishes a bunch of comics about scientists like Isaac Newton, Charles Darwin, Louis Pasteur, and Jonas Salk. Google Books has a teaser of the Photosynthesis with Max Axiom volume.

5. Apostolos Doxiadis’ Logicomix

Logicomix

Logicomix is a "brilliantly illustrated tale of reason, insanity, love and truth recounts the story of Bertrand Russell's life". This novel comes off as one of the more mature reads of this list, so I'm pretty excited for this comic to be released later this year.

6. Matt Fraction's The Five Fists of Science

5 Fists of Science

Okay, you might not learn a lot from The Five Fists of Science, but who can argue against a steam-punk comic featuring Nikola Tesla and Mark Twain fighting against an evil Thomas Edison?

Formula Sheet for Condensed Matter Physics

Click the thumbnail above to catch a glimpse of a single-sided slice of beauty. I cranked it out for my condensed matter physics final tomorrow morning.

Arguably a waste of potential "comprehension-intensive" study time, preparing an excessive formula sheet always puts me at ease (at least until moments before the exam when classmates are chatting about some obscure textbook chapters).

I usually insert inspirational messages into my formula sheets just in case I need that bonus motivation, but this time... see if you can find Waldo!

P.S., I can't wait until I can take care of this blog again after my finals.

The Scientist Identity

I recently listened to the Systems Biology Nature podcast.

Systems biology is mathematical modeling of biological systems (even at the molecular/gene level) with the intention of reproducing emergent properties in complex living systems. These mathematical systems could  combine everything from gene regulatory networks to crazy metabolic networks into one glorious approximated abomination of biology. This research could lead to at least two great things:

  1. Spore 2 (check out local guest blogger Kate's Spore creature gallery)
  2. Accurate evolution simulations, ie. new opportunities for creationist bashing

Systems biology is a perfect example of a new multidisciplinary field. It combines the work of mathematicians, computer scientists, physicists, bioinformaticians, biochemists, molecular biologists, cell biologists, and geneticists. Even a philosophy major could probably slip into the team undetected for a little while!

As grad school selection approaches and life decisions loom above like an angry sun, it really begs the question: Should one be specializing or diversifying ones skill set?

Sure, you could diversify (your bonds) and learn about computer science and physics like me, or you could specialize the old fashion way and join some miraculous science collaboration dream team to work on cutting edge science.

The case for diversifying is argued nicely in a PLoS essay entitled: "Antedisciplinary Science". (Hat tip!)

It turns out that antedisciplinary science aligns nicely with the ideal Jacks of Science "Jack of all trades" blogging philosophy:

Perhaps the whole idea of interdisciplinary science is the wrong way to look at what we want to encourage. What we really mean is “antedisciplinary” science—the science that precedes the organization of new disciplines, the Wild West frontier stage that comes before the law arrives.

The essay was written by a computational biologist and the topic really hits home for me. By next April I'll have graduated with equal amounts of physics and computer science credits thanks to University of Waterloo's free-spirited computational science program. But I'm kinda doomed. I don't have the expected skillset of a physics major or of a computer science major if I choose to go to grad school for either.

I should have specialized in something!

Why am I currently researching computational chemistry!?

Why do I plan to study polymer physics next term!?

Who am I!?

Now that I'm finally The Dread Zoologist Roberts, I feel a need to help the people. The confused people. People confused about wives tales, folk taxonomy and poorly researched news stories. People confused about whether the appropriate short form of Charles Darwin's name is Chas D, Char Dar, or Chuck D (in fact, all three are acceptable, along with "Charwin").

But as my first order of business, I'd like to demolish some zoological misconceptions I commonly come across. I hate zoological misconceptions! Let's begin:

1. Assuming you live in the New World, honey bees are not your friends. Nor are they friends with your true bee friends, the native bumblebees. Honey bees were introduced to the Americas by European apiculturalists, making them an ALIEN/INVASIVE species. So, it shouldn't be any wonder that they are "declining", given that they didn't belong here in the first place (OH SNAP).

2. Daddy Long-Legs are not spiders, nor are they poisonous. They are harvestmen. Also, check out the weird pro-harvestmen science bias in the Wikipedia article:

Because they are an ubiquitous order, but species are often restricted to small regions due to their low dispersal rate[citation needed], they are good models for biogeographic studies[dubious ].

Indeed! Dubious!

3. Polar bears are not a distinct biologically species, separate from grizzly bears and brown bears (which themselves are not biologically distinct). In other words, polar bears, grizzly bears and brown bears are in fact all the same (biological) species, and hybridization is possible!

4. Monkeys and Apes are different things! Chimpanzees, Bonobos, Gorillas, Orangutans, Gibbons and Humans are apes. Apes, I say! Monkeys are things like Tarmarins, Capuchins, Owl Monkeys (above), etc. So, next time your esteemed associates say "Humans are descended from monkeys!" you can say "That statement is incorrect, associates! They are descended from, and still are, apes!".

5. Killer whales are oceanic dolphins, not whales. Similarly, Koala bears are not bears.

Do you feel informed? I have many more such facts, stay tuned!

Evolution can be a tricky (but by absolutely no means impossible!) process to observe. This can make teaching students about the theory of evolution somewhat difficult compared to more readily demonstrable concepts such as magnetism or acid-base chemistry.

Computer simulations of evolution offer an excellent solution to this problem. Using these simulations, students and scientists can explore the process of evolution and get (in some cases highly visual) results in a matter of minutes. Luckily, thanks to intrepid biologist/programmers, many of these sexy in silico simulations of evolution are now freely available for download! Here are a few, at a glance:

Breve Creatures

Gene Pool

Java Evolution Simulator

Java Biomorph (Java implementation of the Dawkins Biomorph program)

Mushroom Life

(OK, its not a true evolution simulator, but I have a soft spot for Conway's Game of Life. And mushrooms.)

See also:

Dr. Saul's Evolution Lab
Evorunners
Flow in games
Maxis 1990 computer game Simlife
Discussion of the validity of computer simulation to provide evidence for evolution.

The Unit State of America

June 5th, 2008

Katamari Ruler

Oh wow, it didn't take long for me to renew:

  1. My domain registration.
  2. My interest in blogging. 

Things are safe on the blog front for now, and like always, there are many big things in store for Jacks of Science which will one day come to delicious fruition for all.

So anyway, I'm researching in the U.S. this summer on a work placement. Living here I've had the privilege of experiencing the finer details of life which Canada lacks. Mainly, White Castle and an abundance of unsweetened iced tea but I still can't figure out what's the deal with the Imperial Units

When I'm homesick I just use Google for conversions to S.I. units. If that fails, which it has yet to, UnitConversion. But I admit, even meters, kilograms, and seconds can get a bit boring after a while. When that happens I have no choice but to use WeirdConverter (Turns out I only weigh 11% of a whale testicle).

If you've ever played Katamari Damacy for Playstation 2 then you'll know exactly what I mean. Info-rich game facts appear on the pause screen informing you that your Katamari ball is the size of 5 swordfish or perhaps 35 grandmas in width. Katamari Damacy is a great educational tool. It gives a unique sense of scale and teaches you that all measurements are relative.

There are plenty of obscure units to express our measurements in. Which begs the question: what made us settle on the standard units we did? It all boils down to an ongoing quest for finding a high accuracy measurement and agreeing internationally on a particular definition. Here are some of the weirdo ways our favorite units are defined:

  • The Meter. Kind of a cop out, but if you get this crazy notion to fix (?) the speed of light in a vacuum at a constant number, like 299 792 458 meters per second, you can use the distance that light travels in 1/299 792 458 seconds to get a distance known as a meter. But wait, how do they know long is a second?
  • The Second. Scientists needed a time measurement that was a bit more precise than "one Mississippi", so they set a second as the duration of 9,192,631,770 cycles of microwave light absorbed or emitted by a cesium atom moving between 2 energy levels at a temperature of 0 kelvin. But wait, how hot is a kelvin?
  • The Kelvin. The International Atomic Energy Agency developed a standardized composition of pure water called Vienna Standard Mean Ocean Water. They carefully obtained the triple point and absolute zero point of this water and set them as 273.15 kelvin and 0 kelvin respectively. You can divide this interval to get the individual units of degrees.
All of the seven deadly SI base units are described on this handy Wikipedia page that I wish I had discovered sooner. My personal favorite being the kilogram because it's just a big metal cylinder under high security in Paris. Hmm, if I was a thief that would be top on my robbery list. If I obtained the cylinder and beefed up the mass a bit, it would do wonders for the obesity problems in America and consequently draw attention to hunger issues worldwide. I'd be a hero!