## Saturday, July 31, 2010

### Avoid Computer Injury - Repetitive Strain Injury (RSI) Software

I've recently succumbed to the unforgiving punishment of continued computer use. I purchased my first computer in 1995. It had an Intel Pentium 133 MHz processor. I don't recall the memory size. It had a 4GB hard disk drive (called Quantum BigFoot). And so began my computing journey. I was inseparable from this machine. I vaguely remember a day passing without me using a computer. Of course, I had no hint that muscle injuries could occur due to extended and imporper use of computers. I don't think that everybody agrees the proper computing practices, but no one argues that regular breaks and stertches must be carried out during computer usage sessions.

Looking back at things, I averaged  about 10 hours a day using a computer. So, for the past 15 years, that's: 5,479 days or 54,790 hours!!! To be a bit conservative, I will take an average of 7 hours a day (to account for occasional breaks). That would only take it down to 38,353 hours... that's a lot of hours.

After looking at these numbers, and the stiffness in my shoulders, I decided that it is time to look for options. Of course, forcing myself to take breaks never worked, so the ideal candidate was a software that lurks in the background and tracks my computing levels to suggest micro and macro breaks.

Micro breaks seem to be the most important. These are very short breaks (10 to 30 seconds) that are to be taken between intervals of intense keyboard usage activity (~50 words per minute). In general, taking a micro break every 2 to 4 minutes is a good option. Ive looked at a few software and here's what I liked so far:

MacBreakz - I use that on my Mac. It tracks your activity and suggests breaks with stertching exercises. I like it a lot. It is very cheap ($25 for a single license) and it is worth every penny. Wellnomics Workpace - Windows only. I used it for a while. The user interface is a bit ugly, but the software has great features. It can perform statistics and does real time keyboard tracking. It is expensive:$69 for a single license.

Workrave - Windows/Linux, and most importantly open source! It may not have all the advanced features of Workpace, but for the price, I'm taking it.

So here you go. My advice, don't underestimate this problem. Take the proper measures to reduce the impact of computer usage on your muscles and ultimately your career.

Cite as:
Saad, T. "Avoid Computer Injury - Repetitive Strain Injury (RSI) Software". Weblog entry from Please Make A Note. http://pleasemakeanote.blogspot.ca/2010/07/avoid-computer-injury-repetitive-strain.html

## Friday, July 30, 2010

### emacs, vim, svn, doxygen, and friends - Stocking your Unix Toolbox

Charles Reid, a doctoral candidate at the University of Utah and a very good colleague of mine, has kindly agreed to post some lectures from his summer "Scientific Computing Workshop" on PMAN. Charles is not only knowledgeable in all Unix related stuff (Unix, Linux, OSX), but also a very rigorous researcher. You can find his original workshop series on his website: http://charles.endoftheinternet.org/.

and here's part 2

Cite as:

## Thursday, July 29, 2010

### LaTeX Symbols - Detexify

say you're looking for some weird LaTeX symbol but you don't want to go through an exhausting list of possible candidates. You just want to draw that symbol and have someone tell you what the syntax for that is.

Well, Detexify does this exact thing!!! Go ahead and try it (and train it, and by all means donate to these guys).

This is by far one of the most useful things I found on the net (thanks to this article on fellow blog walking randomly).

Cite as:

## Wednesday, July 28, 2010

### How to Add a Contact Me Page to your Blog or Website

Turns out to be quite simple using Google docs! Here are the steps:
2. Create a new form

3. Customize the form to your liking by filling it with required info (Name, email, website, message...)
4. To add new items use the "Add item" button on the upper left. Use this to add more entries. For the message, add a paragraph text.
5. Finally, here's how it could look like. Don't forget to name the form and put in a short description
6. Now, you can get the code to embed that form in your website or blog. Just go to the "More actions" button on the upper right and choose embed.
7. Copy the embed code to your website or blog. In blogger, you can create a new page for that form and embed the code in it. See how it looks like on mine.
This form will automatically create an associated spreadsheet in your Google docs where it can store all the submissions going through the form. You will want to be notified of those submissions via email for example. To set this up, here's what you do
1. While still editing the form, choose "See responses -> Spreadsheet"
2. In the spreadsheet, go to: "Share -> Set notification rules" and specify how you wish to be notified
Voila!

Cite as:

## Tuesday, July 27, 2010

### How to Place Two Figures Side by Side in Latex Multicolumn Class

If you are using a multicolumn LaTeX class template, then placing two figures side by side so that they spawn the entire width of the page is done by simply using the {figure*} environment
\begin{figure*}
\subfigure{...}
\subfigure{...}
\end{figure*}
Voila!
You may want to move the code for your figure around so that it doesn't show up on the last page. Also, try using [ht] for figure placement
\begin{figure*}[ht]
\subfigure{...}
\subfigure{...}
\end{figure*}
This is a typical case with the IEEE Transactions LaTeX template which was the reason for searching the web for this. I learned it from here.

Cite as:
Saad, T. "How to Place Two Figures Side by Side in Latex Multicolumn Class". Weblog entry from Please Make A Note. http://pleasemakeanote.blogspot.ca/2010/07/how-to-place-two-figures-side-by-side.html

## Monday, July 26, 2010

### Inexact Differentials

In a previous post, I discussed the proper techniques to integrate an exact total differential. The major point to be drawn from exact differentials is that their parent function is independent of the path of integration. For example, the work done by gravity is independent of the path taken. It only depends on the end points of the path. This has to do with the fact that the gravitational force can be expressed as the gradient of a scalar. We call this type of force a conservative force field.

In general, many physical processes cannot be represented by conservative fields and therefore, their total differentials are inexact. One can think of the total differential as the a small increment taken on an arbitrary path. A very popular example of an inexact field is the work (and subsequently heat) in thermodynamics.

The work done by or on a system is in general dependent on the path taken. It is a summation of infinitesimal steps along the path. In contrast, the internal energy of the system is independent of the path taken. This has to do with the macrostates of a system. A macrostate of a system is a state where external parameters are specified. These include volume, temperature, pressure, mean total energy.

Then, for the mean energy U, the total differential is simply the difference between two known macrostates (remember, that the energy is specified for a macrostate). In contrast, the work done cannot, in general, be written as the difference between two well defined quantities. You can find more details on this in Prof. Richard Fitzpatrick's online textbook on thermodynamics.

So how do we integrate inexact differentials? Simple. If the path is known then the integration can be carried out along that path!

However, we will now show that if the inexact differential is multiplied by some function of the independent variables, one can construct an exact differential. To show this, I will follow the exposition given by Prof. Richard Fitzpatrick (http://farside.ph.utexas.edu/teaching/sm1/lectures/node36.html).

Consider the inexact differential equation
where I have used the symbol \delta to denote an inexact differential. An immediate consequence is that
Furthermore, the integral of F over a closed path is not equal to zero
To make further headway, let us consider the solution of
or
Dividing by H dx, we get
This equation describes the slope of some set of curves at every point in the x-y plane. These curves can be written as
where c is a constant labeling parameter. Think of this a set of controur lines for \Gamma. Note that Gamma is a function of (x,y), the constant on the RHS merely says that Gamma is constant on a given contour line. We now form the total differential of \Gamma
Now we want to connect the total differential of Gamma to the ratio dy/dx. To achieve this, we divide the previous equation by dx
upon substitution of dy/dx, we get
or
then
where sigma(x,y) is an arbitrary function of the independent variables. Then
Upon substitution into the original inexact differential, we have
therefore
and thus, by multiplying the inexact differential by a proper factor, one arrives at an exact differential. If this factor exists, it is called an integrating factor (its reciprocal in fact is the integrating factor). Such a factor may not exist in higher dimensions however.

In thermodynamics, for a reversible process, the entropy is written as
Note that the total differential of Q is inexact. But when dividing it by the temperature, one arrives to an exact differential. In this case, the temperature is an integrating factor and the total differential of entropy is exact.

Voila!

Cite as:

## Saturday, July 24, 2010

### Fallacies in Scientific Research: Appeal to Popularity

This is my second post on logical fallacies in scientific research. Today's subject discusses how the "Appeal to Popularity" fallacy can hinder the research environment. This one in particular is a bit tricky because, at the face of it, an individual may use it as evidence.

Definition: Appeal to popularity is a logically fallacious argument in which an individual is lead to believe that something is true (valid, moral...) because it is widely accepted or used. The person arrives at this belief without any reference to evidence supporting the validity of the claim.

Examples:
• The majority of people use brand X car. Then it must be the safest car.
• Laptop Y is very popular among university students. Therefore, it must be the best laptop.
• The majority has opposed this law. It means that the law is bad.
This fallacy is a very delicate one as I mentioned previously. There are two points in every one of the above statements: the "factual" part and the illogical inference. It may be true that the majority favors brand X or Laptop Y, but inferring that it is a good product is wrong. There is no immediate link between these two points.

It may also be true that car X is one of the safest cars, but it is not because everybody owns one. Such a statement should be validated by data, experimental tests between a variety of cars and so on. Interesting, for the most part, one can revert the above statements and obtain a valid argument. For instance, because car X is one of the safest cars, it has a wide customer base.

At the face of it, it seems that by appealing to popularity, one is using statistical data. This becomes a problem in Scientific research. As usual, examples from personal experience:
• Fluent is the most popular CFD code used. Then it is the best CFD software out there.
• The Finite Volume Method is the most popular discretization technique. Then it must be the best.
• Everybody is getting funding from the industry. Then, this is the best source of funding.

Again, these are all invalid arguments for making decisions especially in scientific research. To stretch things a bit, these arguments may be massaged a bit to lend them some credibility by isolating the statistical component of each argument and using it as data input for making decisions. Here's how I think these should be amended:
• Fluent is the most popular CFD code used. We should list it as one of the software to consider for purchase. But first, we must compare its performance to the other software we are considering for this particular problem and then make an informed decision.
• Fluent is the most popular CFD software. We should consider it in our modeling efforts to reach a wider audience. (I'm not too fond of this particular way of putting it as this borders on the marketing side).
• The Finite volume method is a very popular discretization method. Based on the literature we reviewed, the method was successfully used to simulate a wide range of physical phenomena. There's also a large amount of evidence that the method is particularly suited for transport phenomena. We should consider it as a viable method for solving our hypersonic design problem.
• I don't have any comments on the last one.
When it comes to science, our conclusions should be entirely based on the data. But when it comes to decision making, data is only a part of the process. There are existing and expected experiences that come into play and those may not be entirely rational. The problem is not also in the statistics. If the statistics point to the fact that 80% of the simulation science is done using the finite volume method, then, in the context of science, this should only mean that we should consider the finite volume method as option and test its performance for our problem. Appeal to the number by itself is meaningless. What percentage have reported positive results in this case? If the argument was: 75% of the scientists have reported positive results for using the finite volume method for compressible flow problems, then things are quite different. This is no longer appeal to popularity, it is an appeal to evidence.

### References:

http://www.nizkor.org/features/fallacies/appeal-to-popularity.html

Cite as:
Saad, T. "Fallacies in Scientific Research: Appeal to Popularity". Weblog entry from Please Make A Note. http://pleasemakeanote.blogspot.ca/2010/07/fallacies-in-scientific-research-appeal_24.html

## Friday, July 23, 2010

### Numeric Limits in C++

You can use the "limits" class template to obtain machine specific numeric limits. Here's a sample code:
#include <iostream>
#include <limits>

using namespace std;
int main()
{
//print maximum of various types
cout << "Maximum values :\n";
cout << "------------------\n";
cout << "short : " << numeric_limits<short>::max() << endl;
cout << "int : " << numeric_limits<int>::max() << endl;
cout << "long : " << numeric_limits<long>::max() << endl;
cout << "float : " << numeric_limits<float>::max() << endl;
cout << "double : " << numeric_limits<double>::max() << endl;

//print minimum of various types
cout << "\n";
cout << "Minimum Values: \n";
cout << "------------------\n";
cout << "short : " << numeric_limits<short>::min() << endl;
cout << "int : " << numeric_limits<int>::min() << endl;
cout << "long : " << numeric_limits<long>::min() << endl;
cout << "float : " << numeric_limits<float>::min() << endl;
cout << "double : " << numeric_limits<double>::min() << endl;
//
return 0;
}


Cite as:

## Thursday, July 22, 2010

### Remote Desktop Through a Router

If you're trying to remote desktop to a computer connected to a wireless router, you'll most likely need to "forward" certain ports to allow this connection to go through. For windows, and if you haven't changed that setting, the default port if 3389. So here's how you can do it in general:
• Go to your router's configuration page
• Look for "Port Forwarding"
You will be asked to specify which IP address to open up the port for. You can get that from the ipconfig command on the command prompt
• Open up a command prompt
• Type: ipconfig (and press enter!)
• Write down the IPv4 address that shows up and use it in the port forwarding setting
Voila!

Cite as:

## Wednesday, July 21, 2010

### How to Get CPU Info on Linux

Try:
cat /proc/cpuinfo
There's a lot more to this. You can learn about the /proc directory from this post: http://www.linux.com/archive/articles/126718

Cite as:
Saad, T. "How to Get CPU Info on Linux". Weblog entry from Please Make A Note. http://pleasemakeanote.blogspot.ca/2010/07/how-to-get-cpu-info-on-linux.html

## Tuesday, July 20, 2010

### 2D Arrays in C++ using New

In a previous post I discussed how to create 2D arrays in C. Here's the version for C++. Pointers can be easily used to create a 2D array in C++ using the operator "new" . The idea is to first create a one dimensional array of pointers, and then, for each array entry, create another one dimensional array. Here's a sample code:
double** theArray = new double* [arraySizeX];
for (int i = 0; i < arraySizeX; i++)
// allocated arraySizeY elements for row i
theArray[i] = new double [arraySizeY];
Voila!

To follow my previous post on 2D arrays in C, create a function called Make2DDoubleArray that returns a (double**) and then use it in the code to declare 2D arrays here and there
double** Make2DDoubleArray(int arraySizeX, int arraySizeY) {
double** theArray = new double* [arraySizeX];
for (int i = 0; i < arraySizeX; i++)
theArray[i] = new double [arraySizeY];
return theArray;
}

Then, inside the code, i would use something like
double** myArray = Make2DDoubleArray(nx, ny);
Voila!

Of course, do not forget to remove your arrays from memory once you're done using them. To do this
// first delete inner entries
for (i = 0; i < nx; i++) delete[] myArray[i];
delete[] myArray;


Cite as:

## Monday, July 19, 2010

### How to Organize your Digital Photos

With the advent of digital photography and the widespread use of digital cameras, it has become very exciting and easy to take photos... that is, lots of photos! Soon enough, your hard disk will be spawned with JPEGs. Whether you are scanning your old prints or importing photos from your digital camera(s), you will notice a dramatic increase in the number of photos on your disk in a short period of time. Within a year, I accumulated around 7,000 photos!

However, with the wealth of photos you have on your disk, it will become a difficult task to keep track of what's in there... even your computer will have a hard time processing and displaying thumbnails and photo information (assuming you put all your photos in one directory!).

I thought of a lot of ways to organize my photo library and have gone through several paradigms. What I describe in this article is the technique I use to organize my photos. I think it is very efficient and so far it has served me well. For example, I would want to quickly find photos sharing a certain theme (sunset, fruit, cloud...) or photos about a friend (Matt for example). Sometimes I would want to find photos relating to a certain event (concert, birthday...). All of these can be done with little effort, provided you are consistent with your workflow and take the time to organize your photos.

The fundamental concept of my approach is to separate the file storage from the user. This is accomplished by dividing the organizational task between myself and a photo organizer (such as Picasa). In this plan, photos are kept intact, and stored in systematically named folders. It is the software interface that will take care of all the organization. This also makes use of the property tags in jpg files.

Please understand that in order to obtain the results you expect, you have to put enough effort from your part (such as keywords and captions). There is no software (yet) that automatically knows what your pictures are about, or that figures out the names of the people in a certain group photo!

### Step 1: Create a Master Directory

First and foremost, I create a master folder called "My Pictures". I place this folder on an external hard disk to save space on my local disk.

### Step 2: Create Sub Directories

Since I use several cameras (and you probably do as new models come around), I create a directory for each camera (Nikon N80, Nikon D50, Canon PowerShot 540 ...). I do this because I like to have the photos from each camera in a separate location for comparison purposes.

In each "camera" directory, I create sub directories tagged by year. For example, Photos taken in 2005 will be placed in the "2005" directory. I chose to categorize by year to keep track of the evolution of my skills in photography. This is not a big deal since your photos already contain the date taken in the picture metadata. However, it will prove to be good practice to categorize your photos per year as years go by!

For photos that come from third parties, I also categorize them by year but place them in a directory called "other"

### Step 3: Importing Photos

So far we have only scratched the surface. The question is where to import the photos form your digital camera? For example, you can import photos related to a certain event into a directory with the name of that event. That works fine, but it will create a set of incoherent directory names, and sometimes ambiguous names. Just today [Jan 28, 07], I have reached a consensus on where to import my photos. The idea is simple and is inspired from film photography. When using film cameras, I usually use films with 25 exposures (they're the only ones left out there!). Therefore, it would seem logical to put each film in a separate directory. When extrapolated to the digital world, I simply split the photos on my digital camera into 25-file sets and put each 25 files in a separate directory. I name each directory according to the following convention
[camera name]-[year] [roll number]
For example, "D50-06 0012" corresponds to roll 12 taken with the D50 in the year 2006.
I make sure I keep enough digits for roll 9999! Sometimes, my camera would have 450 photos. I take 30 files at a time and put them in their respective rolls, tout simplement!
For photos that come from third parties, I just put them in directories with the following name convention
You can choose to place any reasonable number of photos in a roll (25-100). Just don't put 1000 photos in a single directory. Your system will become sluggish when you are manually browsing your photo directories and displaying thumbnails (this won't be a big problem with new hyper threading and duo-core processors). It is a personal preference to put any number of photos in each directory, but the objective is to have the same number of photos in all directories.

At this point, we still haven't attached any useful information to the photos. This should be the task of the photo organizer software. I use Google Picasa to organize all my photos. Picasa is a free photo organizer. It is super easy to use, super fast and provides you with all the functionality you need to edit, search and organize your photo library. In summary, what we are doing here is organizing photos in rolls (on the hard disk) and then creating albums and collections in Picasa.

### Step 4: Picasa (or any other photo organization software) [NOTE: THIS SECTION WAS WRITTEN BASED ON PICASA 2. SOME FEATURES MAY HAVE BEEN UPDATED IN NEWER VERSIONS]

Now comes the fun stuff. After you install Picasa, it will give you the option to scan some directories on your hard disk. Select whichever one you want (Desktop for example). Once Picasa starts, we want to change that. Go to "Tools/Folder Manager" and point Picasa to the directory in which you have placed all your photos (i.e. the "My Pictures" master directory). Make sure you select "Scan Always" on your right so that Picasa scans your photos as you add them. Also, remove any other folder that Picasa is currently scanning (select that folder and then select "Remove from Picasa").

Once your photos are in place, Picasa will import them automatically. It will place them in a master collection called "Folders". Under Folders, you will be able to see all those Rolls you have created.

### Step 5: Creating Albums (or collections or whatever your software calls these)

You can create new collections and move these folders into them (note that these actions do not alter the actual location of the photos. that's what's nice about Picasa). For example, I have a collection for each of my cameras. Every time I import a new roll, I right click on it and move it to its rightful collection. Select the folder you wish to move, right-click, select move to collection and choose new collection (assuming the collection doesn't exist yet). I hope future versions of Picasa will have an easy way to create a new collection!

Type in the name of the new collection, and it will be created. Then you can move folders around. Of course, once you create a new collection, it will be added to the list of existing collections. Here's an example of how things should look like.

### Step 6: Albums

The best thing to do when you import new photos is to automatically sort them into albums. This is especially true when you are importing photos that pertain to a certain event. Just create a new album (File/New Album), select the photos that correspond to that album, and drag and drop them on that album. For example, here's how I add some photos to the "Sunsets" album.

### Step 7: Keywords

Keywords are very important when you want to search for pictures with a specific theme. You can create any keyword you want (animals, plants, sunsets, people etc...) and attach it to any photo (or set of photos). This makes it very easy to search for photos with a specific theme. Select a set of photos that share a similar theme. Click the "View" menu and select "Keywords". Add the keyword that you like and click "Add" to confirm.

You can also select a set of photos and use "Ctrl + K" to invoke the Keywords dialog. It is good practice to use shortcuts.

### Step 8: Captions

Captions are like titles, but are embedded in the photo's metadata. Adding captions is time consuming, but gives you the most accurate description of your photos in the future.
In Picasa, double click on a photo to enter preview mode. Just below the photo you will see a message inviting you to type a caption. Simply click there and type the caption you desire. To speed up the process of creating captions, notice that when you are in preview mode, you can simply type on the keyboard and Picasa will automatically interpret what you type as a caption. When you finish typing, press "Enter" and then move to the next photo by clicking the right or left arrow on you keyboard. Type again, press Enter and so on...

I prefer taking the time to add captions to every set of photos I import rather than having to do that one year later with 2034 photos. (Although I have to do that right now with all my old photos)! I add captions to 50-100 old photos every day. I am going over all my old photos adding keywords and captions to every single one of them. I enjoy doing this because I get a chance to review old work and most importantly, be able to find the photo I need at any time I want!

Once you start adding keywords, captions and albums, it will be very easy to locate specific pictures. Picasa will search keyword and caption content as well as album names whenever you search for something. Digital photography is such a thrill and organizing your digital photos is your own personal project. Happy sorting!

Cite as:

## Saturday, July 17, 2010

### Fallacies in Scientific Research: Appeal to Common Practice

In this series of articles, I will discuss some of the most annoying logical fallacies that research scientists fall a victim to. I will start with a very common fallacy known as Appeal to Common Practice. As the name designates, this logical fallacy stands in its own right as an insult to logic and rationality. Here's a formal definition (based on wikipedia entry):
Appeal to common practice is a logical fallacy in which a thesis is deemed correct [moral, rational, sound, justified...] on the basis that it correlates with some past or present tradition.
In other words, if some action "A" is common among the masses, then it must be true, justfied, or it is morally correct to do it.

Appeal to authority falls under several categories. Here are a few examples.

• Bribery is illegal... but hey! everybody does it! So it is okay to do it.
• Cheating on tests is unethical, but everybody cheats, so it is justifiable to do it.
• It is illegal to pass a stop sign without stopping, but everybody does it! So it is okay to do it.

Therefore, appeal to common practice requires that the established action to be unlawful, or irrational (...) of some sort. So in a country where bribery is legal (??), the example on bribery is no longer a fallacy. Thus, based on the established norm, one should draw the proper conclusions. In issues dealing purely with quantifiable items, one can draw more absolute conclusions. For example, if person X works more hours than person Y, and if they both get paid by the hour, then person X is expected to get paid more.

In light of the previous examples, I would like to now focus my attention to the use of this fallacy in the context of scientific endeavors. Here are two examples drawn form personal experience:

• The majority of journals do not allow the publication of an already published paper in a different journal, but these days, almost everybody is doing that! So it is okay to do it!!!
• It is unethical and illegal to use grant money for personal benefit, but most PIs do it! So it's alright to do it! (An example of using grant money for personal benefit is hitting two birds with one stone: say you've always wanted to visit Italy, then, you'd claim that it is important to collaborate with some university in Italy and go ahead for the trip. Of course, you may do great science over there, but you've also managed to implicitly gain personal benefits...)

(please also feel free to add if you have examples on this).

It is a shame for a scientist or researcher to think in this manner. It is an insult to the mind and the scientific community when these things happen. Based on what i've seen in graduate school, there is a lack of proper education regarding ethics in science. On one hand, it is the duty of the seasoned academic advisor to properly educate his pupils on scientific ethics. On the other hand, it is also the responsibility of the aspiring graduate student to educated themselves on these subjects. There are many books out there on scientific ethics that ALL graduate students in science should read. Here's a good resource to start with:
http://www.files.chem.vt.edu/chem-ed/ethics/vinny/ethxbibl.html

### References:

http://www.nizkor.org/features/fallacies/appeal-to-common-practice.html

Cite as:
Saad, T. "Fallacies in Scientific Research: Appeal to Common Practice". Weblog entry from Please Make A Note. http://pleasemakeanote.blogspot.ca/2010/07/fallacies-in-scientific-research-appeal.html

## Friday, July 16, 2010

### Compiling Hypre on Mac OSX

Hypre is a library for solving large, sparse linear systems of equations on massively parallel computers. You can download it from here. Here's my configuration on Mac OSX
CC='gcc -arch x86_64' CXX='g++ -arch x86_64' F77='gfortran -arch x86_64'
then
make
make install

Cite as:

## Thursday, July 15, 2010

### Parallel Heat Equation

I apologize for this delay. I've attached the parallel heat equation solver to this post. You can download the code from here
or, separately
Please note, that due to time constraints, I have not thoroughly debugged this code. So please make sure you understand the code very well before adapting it to your problem. I've put as much comments as possible so the code should be self explanatory.

I will try to put in some explanation of what's going on in there, but that may take a while.

Cheers!

Cite as:

## Wednesday, July 14, 2010

### Compiling OpenMPI on MacOSX

First, you will need a proper gfortran installed on your system. This version (gfortran 4.2.3)worked for me. After installing that download and extract OpenMPI. Here's the config line that I used
F77=gfortran CFLAGS=-m64 CXXFLAGS=-m64 FFLAGS=-m64
then
make
make install
Voila!

If you wish to install to the default location (/usr/local/ etc...) remove the prefix option.

Cite as:

## Tuesday, July 13, 2010

<script style="text/javascript">
function numberOfPosts(json) {
document.write('Total Posts: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
}
document.write('Total Comments: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
}
</script>
</script>
Voila!
Don't forget to put in your blogger url.
I picked this up from bloggerstop. You can find the original post here:

Cite as:

## Monday, July 12, 2010

### LaTeX Thesis and Dissertation Template

Here's the LaTeX class template that I developed for my dissertation. It is hosted at the University of Tennessee. You can download it from here:
http://web.utk.edu/~thesis/files/ut-thesis-template.zip
The class has some really neat features. It can automatically generate the approval pages for up to 6 committee members. All you have to do is type in their names.

Cite as:

## Sunday, July 11, 2010

Try this:
• Go to "Options" (click the wrench button on upper right)
• Go to: Under the Hood -> Content Settings -> Plug-ins
• Click on "Disable Individual Plug-ins...
• Locate the Adobe Acrobat plugin (or any other PDF viewer) and click "Disable"
Voila!

Cite as:

## Saturday, July 10, 2010

### How Euler Derived the Momentum Equations

In this post, I will present Euler's derivation of the momentum balance equations for a fluid flow. Please note that I will use modern notation with a few modifications to the original derivation to clarify certain issues. Nonetheless, the core of Euler's derivation is maintained.

Considering two dimensional flows with axial and transverse velocities denoted by u(x,y,t) and v(x,y,t), respectively, Euler first forms the total differentials of these fields
Next, dividing both equations by dt, we obtain
but
then, upon substitution, we recover
One can infer that Euler is heading towards Newton's law. The previous expressions represent the acceleration of a fluid element. As to the forces, Euler identifies pressure, friction, and gravity. For the time being, he abandons friction and focuses on pressure and gravity.

For gravity, the force is in the transverse direction and is given by
where
is the mass of the fluid element.

For the pressure, he considers a rectangular fluid element as shown below.
Euler then assumes that the pressure at point L is p and deduces the values at the corners of the control volume. The net force acting on each side is calculated by taking the average pressure at the vertices defining that side and multiplying it by the area. This is shown in the figure below

Then, the net forces in the axial and transverse directions are given by
and

Now, by applying Newton's law, we have
or, by projecting in both directions, we have
and
Upon expansion, we get
and
Finally, we get the Euler equations
and

Voila!

[Next: Momentum Eqs. in Cartesian Coordinates]

Cite as:

## Friday, July 9, 2010

### Italics in Math Equations

I've seen plenty of papers in the literature with equations that are practically unreadable. My main issue is that these manuscripts fail to follow a very simple guide in mathematical notation:
If the term in question is a variable, then it should be italicized. All other terms should NOT be italicized.
Do NOT Italicize:
• function names (sin, cos, log, ln etc...)
• dimensionless numbers (Re, Pr, Ra...)
• exact infinitesimal increments (dx, dy et... in BOTH integrals and differentials)
• descriptive text

Here are some examples:
Another special case is with indices. The same rules still apply so that if the index is a variable, then it must be italicized. If it refers to a type of procedure (e.g. average, maximum...) it should NOT be italicized. If it refers to an entitye (e.g. gas, fluid, solid, particle...) then it should NOT be italicized. Some examples include
In the last two examples, g and d refer to gas and particle diameter, respectively. Here, I am assuming that the particle diameter is a constant.

Voila!

Hope that helps a bit. If you think of something else, please feel free to add.

Cite as:

## Wednesday, July 7, 2010

### LaTeX Letter Template

Here's a LaTeX letter template for two print formats. Use the first to print on paper WITHOUT a letter head and the second on paper WITH a letter head.
• LaTeX letter template for paper without letter head [tex][pdf]
• LaTeX letter template for paper with letter head [tex][pdf]
Voila!

Cite as:

## Tuesday, July 6, 2010

### How to Post LaTeX Equations in Blogger

I've gone through several approaches to post math equations on blogger (check my previous posts here, and here). I found that the most effective and stable method is the one based on the CodeCogs server. Here's how it works:
1. Go to the codecogs online LaTeX editor
2. Type in your equations LaTeX
3. Copy the HTML code that is generated at the bottom of the page
4. Paste it in Blogger (either in the "Edit HTML" or "Compose views").
Here are the settings that I use:
• image type: png
• font: Sans Serif
• fontsize: (10 pt) normal
• resolution: 120 dpi
• background: white
• uncheck inline and compressed
• choose: HTML (Edit) at the bottom (this allows you to click on the generated image and edit your equations! you'll have to copy the updated HTML though)
Voila!

Cite as:
Saad, T. "How to Post LaTeX Equations in Blogger". Weblog entry from Please Make A Note. http://pleasemakeanote.blogspot.ca/2010/07/how-to-post-latex-equations-in-blogger.html

## Monday, July 5, 2010

### Transparency, Opacity, or Alpha settings for CSS Backgrounds

Try:
background:rgba(r,g,b,alpha-value)
Voila!
For example, on this blog, I use rgba(255,255,255,0.8) for the background wrapper.

Cite as:
Saad, T. "Transparency, Opacity, or Alpha settings for CSS Backgrounds". Weblog entry from Please Make A Note. http://pleasemakeanote.blogspot.ca/2010/07/transparency-opacity-or-alpha-settings.html

### Mathtype and Office 2010

Move the following files
• ...\MathType Install Dir\MathPage\MathPage.wll
• ...\MathType Install Dir\Office Support\MathType Commands 6 For Word.dotm
• ...\MathType Install Dir\Office Support\WordCmds.dot
To
...\Office Install Dir\Office14\STARTUP
Voila!

Cite as:

## Sunday, July 4, 2010

### 9. Derivation of the Continuity Equation in Spherical Coordinates

We start by selecting a spherical control volume dV. As shown in the figure below, this is given by
where r, θ, and φ stand for the radius, polar, and azimuthal angles, respectively. The azimuthal angle is also referred to as the zenith or colatitude angle.

The differential mass is

We will represent the velocity field via

In an Eulerian reference frame mass conservation is represented by accumulation, net flow, and source terms in a control volume.

### Accumulation

The accumulation term is given by the time rate of change of mass. We therefore have
$\bg_white \120dpi \frac{\partial \rho}{\partial t}r^2 \sin \theta {\rm d}r {\rm d}\theta {\rm d}\phi$

The net flow through the control volume can be divided into that corresponding to each direction.

Starting with the radial direction, we have
The inflow area Ain is a trapezoid whose area is given by
The key term here is the sine term. Note that the mid segment is the average of the bases (parallel sides). Upon expansion of Ain, and in the limit of vanishing dθ, we have
substitution into Ain yields
where high order terms have been dropped.

The outflow in the radial direction is
$\bg_white \120dpi \dot m_{\rm out}=\left(\rho u +\frac{\partial \rho u}{\partial r}{\rm d}r \right )A_{\rm out}$
but
where
and
By only keeping the lowest (second & third) order terms in the resulting expression, we have
Note, that in the expression for Aout, we kept both second order and third order terms. The reason for this is that this term will be multiplied by "dr" and therefore, the overall order will be three. In principle, one must carry all those terms until the final substitution is made, and only then one can compare terms and keep those with the lowest order.

At the outset, the net flow in the radial direction is given by

### Polar Flow (θ)

The inflow in the polar direction is
where

The outflow in the θ direction is
where
Upon expansion, and keeping both second and third order terms, we get

Finally, the net flow in the polar direction is

### Azimuthal Flow (φ)

The inflow in the azimuthal direction is given by
with
while the outflow is
and

At the outset, the net flow in the polar direction is

### Continuity Equation

Now, by collecting all mass fluxes we have
which, upon dividing by dV and combining terms, reduces to

Cite as:
Saad, T. "9. Derivation of the Continuity Equation in Spherical Coordinates". Weblog entry from Please Make A Note. http://pleasemakeanote.blogspot.ca/2010/02/9-derivation-of-continuity-equation-in.html