Friday, December 25, 2009

Steam Tables in Matlab, Octave, OpenOfficeOrg, and Excel

Anyone who's taught undergrad chemical thermodynamics understands the important role that steam "tables" play in many calculations.

Here is an amazing website which provides an open-source freely available version of the steam tables in various formats. I mirrored the user-guide and the actual program on Scribd, just in case.

The program is saved as XSteam.m.txt, which you will have to rename as XSteam.m after downloading, for Octave or Matlab to recognize it natively.

Here's the attribution/disclaimer.
Water and steam properties according to IAPWS IF-97
By Magnus Holmgren, www.x-eng.com
The steam tables are free and provided as is. We take no responsibilities for any errors in the code or damage thereby. You are free to use, modify and distribute the code as long as authorship is properly acknowledged. Please notify me at magnus@x-eng.com if the code is used in commercial applications.

Monday, December 21, 2009

Wolfram Alpha is amazing!

In all the commotion surrounding Microsoft's Bing, the demise of Yahoo Search, and Google's counter-attack by announcing a light-weight OS, something really useful to me, did not get as much play as it should have.

Wolfram Alpha is an amazingly intelligent search engine/parser/magic genie, for anything mathematical in particular. I have using it quite regularly, not quite as a substitute for Google yet, but even something as unthinkable as that could happen.

In the academic realm, it is a killer resource.

Here are just a few illustrative screenshots from my search today. You may have to zoom in a little bit for clarity.





Friday, December 18, 2009

Thoughts on getting an MBA

This article (old but still completely valid) by an insider provoked me to re-articulate, what I've advised many friends and family.

A disclaimer is warranted, upfront. Many of my friends and family, who have MBAs, are extremely talented and smart individuals. By strange coincidence, all of them were extremely talented and smart individuals, before they got their MBAs.

I've never really thought too highly of the content of most MBA programs. In my opinion, there are only a handful of good reasons to enroll in one. Like most opinions, this is probably worthless, but here you go anyway:

1. You want to change your career path. You're stuck, and don't like what you do. You seek growth, you seek something different! In short, you want to hit the reset button.
2. Networking. You go to a great school, which attracts smart people, you build a network. And the value of a good network is quite obvious, especially if you like climbing career ladders. A strong network is like an elevator. It can get you there faster.

Note that I am intentionally not putting "learning" as one of the reasons. In my opinion, you don't learn anything, that you can't read directly from books for 1/100th the cost.

When I took financial economics at Michigan, the instructor who also taught the same class to business students, often used to joke: "in the evening class, we stop here," before introducing something important and mathematical. And Michigan has a good B-school.

Sure you learn how to use useless buzz words (which the linked article describes) without understanding jack. Reminds me of Dilbert's "leveraging synergies across alternative technology platforms!", whatever that means!

I know people say case studies, group interaction etc. But c'mon those things are best picked up on the job. Basically, if you are smart enough, can read books without being threatened, cajoled, or bribed, make friends easily, are happy with your job, and can think independently an MBA is precisely what you don't need.

Monday, December 14, 2009

Where are the QuickStar and Amway guys?

When I was in Ann Arbor, MI, my friends and I would bump into these Amway/QuickStar folks all the time (coffee shops, bookstores, grocery store etc.) I was talking to my wife last week, and it seems like we haven't been "approached" even once in three years, since coming to Florida.

It's surprising, but of course, I am not complaining.

It got me thinking about an old incident.

* * *

Once, while still at Michigan, I got a call from this guy - Mr. X - who claimed to be a friend of a friend. He had just moved into the Detroit area. We talked on the phone over multiple weekends, and to be honest, the conversations themselves were quite entertaining.

Then one day, he asked if we could meet, and since we had become "pally" by then, I said yeah.

At his place, I talked with him and his wife, over a cup of tea and cake. He asked me more about what I was doing. At that particular point, I was in grad school wondering whether I should go to industry or academia, and more susceptible to suggestion, than I would have liked.

In short, I was a great bakra.

After about 20 minutes of small talk, I thought I should leave, and got up to say bye. All of a sudden, both Mr. and Mrs. X stood up, and asked me to have more tea.

"Hmmmm. Fisshhhy!", I thought to myself. Something was amiss.

They didn't waste any more time. He started talking about "the business", and "financial independence", "asset creation", and "who wants to be a millionaire?".

When I did not react with the overflowing enthusiasm that was expected, he must have thought, I was the nerdy type, and needed a different approach. Very skillfully, he started spewing out an alphabet soup consisting of "B2B, ..., B2P, ... P2P...", essentially connecting random letters with a "2".

I said, "I am a chemical engineer, and don't know what all this means." It was a rare, but honest concession of ignorance.

He said, I should go to this amazing "once-in-a-lifetime" seminar in Southfield the following weekend. I said I was busy, and he said, "but it will change your life."

Of course registration was about $100, at which point I had completely tuned out, but just to be polite, still asked, "what will I learn?".

I endured another litany of management bullshit, after which I had to go outside and gasp for fresh air.

As I emerged out, the chilly, subzero Michigan air had  lost its bite.

* * *

Wednesday, December 9, 2009

Interesting Links

1. Ethics and "ClimateGate": An interesting post by Aswat Damodaran on the ideal and real academia.

2. What is the LaTeX symbol for that? A older link, but interesting, if you haven't seen this before.

3. Yet another beautiful proof of the irrationality of the square root of 2.

4. Along similar lines, Euclid's elegant proof of "there are infinite prime numbers" in the Kumari Meera Memorial Lecture by M. S. Raghunathan (via this link).

Monday, December 7, 2009

Quantitative v/s Qualitative Evaluations: Impact Factors and Wine Experts

Personally, I react to the importance attached to impact factors of all varieties, h-indices and their cousins, and metrics such as the pure number of research citations or papers published, with an emotion ranging between dismay and disgust.

I think they are a lazy substitute for actually reading a person's research and evaluating its worth individually. While it is fashionable, and getting increasingly so, I've never really been a big fan of using purely quantitative factors to measure the worth of an individual, university, or country.

You wouldn't necessarily think that the musician who sells the most records, or has the most covers made is necessarily the best (that would rate the likes of Back Street Boys over bands like Dream Theater).

Not that I don't understand the perils of subjectivity.

I recently came across this Wall Street Journal article on subjective assessment of wine experts through this blog. It highlights the problems of purely subjective evaluations. From the article:
In France, a decade ago a wine researcher named Fréderic Brochet served 57 French wine experts two identical midrange Bordeaux wines, one in an expensive Grand Cru bottle, the other accommodated in the bottle of a cheap table wine. The gurus showed a significant preference for the Grand Cru bottle, employing adjectives like "excellent" more often for the Grand Cru, and "unbalanced," and "flat" more often for the table wine.
Another similar story:
Francesco Grande, a vintner whose family started making wine in 1827 Italy, told me of a friend at a well-known Paso Robles winery who had conducted his own test, sending the same wine to a wine competition under three different labels. Two of the identical samples were rejected, he said, "one with the comment 'undrinkable.' " The third bottle was awarded a double gold medal.
I've never really had a very discriminating sense of taste (which by the way, I always viewed as an asset, since cheap works just as well as expensive). In the world of "wines" there are so many rules. The wine-nazis decide which vintage of which wine goes best with what kind of food. They can apparently discriminate all the nuances of a sophisticated wine. Interestingly from the article:
For example, a 1996 study in the Journal of Experimental Psychology showed that even flavor-trained professionals cannot reliably identify more than three or four components in a mixture, although wine critics regularly report tasting six or more. There are eight in this description, from The Wine News, as quoted on wine.com, of a Silverado Limited Reserve Cabernet Sauvignon 2005 that sells for more than $100 a bottle: "Dusty, chalky scents followed by mint, plum, tobacco and leather. Tasty cherry with smoky oak accents…" Another publication, The Wine Advocate, describes a wine as having "promising aromas of lavender, roasted herbs, blueberries, and black currants." What is striking about this pair of descriptions is that, although they are very different, they are descriptions of the same Cabernet. One taster lists eight flavors and scents, the other four, and not one of them coincide.

Saturday, December 5, 2009

Phew! What a week!

I heard back this week about the fate of two of my manuscripts that were grinding through the peer-review process. I should have a really thick skin by now, but I don't think I do. I was getting ready to wind down gracefully in preparation of the upcoming India vacation, when this sweet-and-spicy-tornado hit.

The first one, on ring polymers, got summarily rejected with a editorial note:
Your paper has been reviewed with the aid of two independent reviewers. Their comments are shown below for your consideration. Unfortunately, you will see that they are advising against publication of your work. I am afraid your paper has not been accepted.
which is a polite way of saying buzz off. One reviewer said it was the wrong journal (which I partially agree with), while the other made a few valid, and a few completely addressable scathing attacks. However, I think I am going to check my natural belligerent instinct, and sleep on this one through December.

My other solo-manuscript, on using Bayesian inference as a tool for solving inverse rheology problems, got flattering reviews (the best I have ever received yet!). The more glowing of the two reviews started with:
This is really a breakthrough paper! [...] In fact, my main criticism of the paper is that it does not lay out as well as it should, the possible future uses of this approach for inferring structure from rheology.
I'll take that kind of criticism any day. With mustard and ketchup.

The other review said:
The paper should certainly be published, since it is proposing something that has not been done before in this important problem
So overall, although its 1-1, I feel really good. Great, in fact!

I had mulled over the ideas in the second paper actively for a year (and passively for nearly six). My resolution last year was to undertake two high-risk/high-reward ideas in 2009, and one of them panned out. It sets a clear agenda for 2010 - to polish the rough corners.

Thursday, December 3, 2009

Can US census data help guide a dating strategy?

Perhaps.

But I will leave most of that to you.

I recently saw a fascinating blog entitled "An Older Woman, A Younger Man" by mathematician Tanya Khovanova. She uses US Census data to figure out what her dating outlook is, since she is 50-year old single woman seeking to enter the circuit again.

She starts out with a thesis:
We know that boys are born more often than girls, and men die earlier than women. Somewhere around age 30 the proportion in [the] population switches from more boys to more girls. And it gets more skewed with age. So there’s a deficit of older men. In addition, a big part of the population is married, making the disproportions in singles group more pronounced. So I decided to look at the numbers to see how misshaped the dating scene is.
I plotted the ratio of single men to women from the table she diligently assembled for easier visualization, as below.

You can do all sorts of "data-mining" with these figures. For example, she uses the data to figure out that if she dates a randomly chosen single man, she has a 3/4 chance of picking someone younger than her (you need the absolute numbers from her entry to figure that out).

This means that if I am a 30 year old man trying to marry someone my age, I face a much harder scene, than if I were a 50 year old man trying to do the same.

Also, a woman under 40 years of age, looking to marry someone younger than her, and a man over the age of 40, looking to marry someone older than him have statistics loaded in their favor.

Wednesday, December 2, 2009

When Math Software Fails!

You may already have heard of an embarrasing problem with MS Excel 2007. It was reported on groups.google, a couple of years ago, in a simple email:
I heard about it when someone posted a printout of the following essay ("Arithmetic is Hard - To Get Right") on a bulletin board right outside the kitchen in my department.

A couple of days ago, I heard about a serious problem with Matlab R2009b. Apparently, when you try to solve this simple 2x2 linear system:
A=[ 0 2 ; 1 0 ];
b=[ 2 ; 0 ];
A'\b

ans =
0
1  
which is clearly wrong (A' is the transpose of A). Apparently, older versions of Matlab and the wonderful FOSS program which I use a lot, GNU Octave, do not have the same problem. They yield the correct solution

ans=
0
2

Tuesday, December 1, 2009

OpenFOAM - a nice open-source CFD tool!

Having used Fluent and COMSOL in the past, I recently switched to an open-source CFD package called OpenFOAM. Although I use the label "CFD" software, it really allows you to solve PDEs.

It has basic meshing functionality (blockMesh), and integrates well into a reasonably well-developed visualization tool called ParaView. However, the pre- and post-processing steps can be carried out using any of your favorite programs - free or commercial. There are all sorts of converters available to translate data to and from these applications to something that OpenFOAM understands.

What is great about the program, and the primary reason I am attracted to it, is the flexibility of the solver. It allows one to extend standard solvers to consider a new constitutive relation, or a new multi-physics problem, relatively easily.

As bonus, it has great parallel efficiency, and is of course free!

Unlike most of the other FOSS software that I use, I like OpenFOAM more for the "open-source" part, than the "free" part, since writing/changing source code is critical to solve my problem.

I've started working on an interesting problem of the flow of a nanotube filled polymer resin in a relatively simple geometry, where the constitutive relation depends on the density and orientation of the nanotubes, which is in turn governed by the flow field, and hence, the constitutive relation.

Here are a few links that I found useful, while trying to ascend the relatively gradual learning curve (I am still climbing!)

  1. The official OpenFOAM website.
  2. The OpenFOAM wiki site - especially the compile and build section.
  3. Nice course materials on OpenFOAM by Hakkan Nilson at Chalmers.
  4. Lecture notes on CFD in general.
  5. The discussion group on OpenFOAM at CFD-Online.