Thursday, April 22, 2010

INVICTUS

For the warriors out there who working with little success to show off, here’s some inspiration to keep you going. This is a spectacular poem by William Ernest Henley written in 1875. The title means “Unconquered” in Latin. When I read this poem I get chills, the hair on my arms stands up and I feel the need to either kill something or create something. Also the recent movie of the same was a good. Mandela is a true visionary who used sports as a medium for bridging people together. Prob policy makers of IPL can learn.

OUT of the night that covers me,
Black as the Pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.

In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.

Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds and shall find me unafraid.

It matters not how strait the gate,
How charged with punishments the scroll
I am the master of my fate:
I am the captain of my soul.

Tuesday, April 20, 2010

Runge Kutta 4th order code

function u = RK4(h,tf,x1,y1)
%to solve the ode for radiation using rk fourth order
I=tf/h;
fh = @ (x , y) (-2.2067)*(10^-12)*(y^4-(81*10^8));
u = y1;
for i = 1:I
k1=h*fh(x1+(i-1)*h,u);

k2=h*fh(x1+(i-1)*h+(h/2),u+(k1/2));

k3=h*fh(x1+(i-1)*h+(h/2),u+(k2/2));

k4=h*fh(x1+(i-1)*h + h,u + k3);

u= u + (1/6*(k1 + 2*(k2 + k3) + k4));

end
u
end

Bizzare Hair loss treatment

Shakespeare, all mighty literature bard, in nearly all his works used hair loss to portray aging persons, fallen kings, fools or even villains, but never a virile yang person. From that point of view it is interesting o know that Shakespeare himself was presented as being bold, which is seen on his numerous portraits.

Since from ancient times abundant hair equals youth, energy, strength, potency, dignity etc. it’s no wonder that man (and some woman as well) are in constant pursue for miraculous heir remedy from the oldest times, but even today some of the lotions and remedies that are offered on the market show no more success then those used in, say, ancient Egypt.

This can be largely contributed to marketing strategies that are used in hair treatment business of today. They present colorful brochures and advertisements which promise gain of instant sex appeal, gorgeous woman by ton, and better car or job position together with recurrence of lost hair. And yes even today’s more educated, modern man fall for those false promises stressed out by suffering hair loss which constantly reminds them of passing of their youth. Some man even become quite artistic with their remaining hair, growing it longer where possible and parting it sideways close to their ears in vain hope of covering up gaps, which is a ridiculous technique that just mirrors their desperation.

adparams.getadspec(‘c_billboard1′);

Therefore it is no wonder that man of yesterday often tried and sometimes dedicatedly used some really dubious and often funny remedy recipes in hope of recovering what nature itself has so cruelly deprived them of, considered by some one of most coveted possessions, hair on their bold heads.

Here are some examples of those miraculous cures and ointments so you, dear reader, can choose your favorite. One that amuses me most comes at the end of the list.

Read and enjoy

- One of 18-Th and 19-Th century favorites was hair growth treatment that involved every night massaging in to your scalp mixture made mainly of rancid rhino fat, mixed with grounded rosemary by the virgin’s hand.

- In America in the 18-th century tough, hardened but non the less bold cowboys lined up to spend their hard earned cash on worthless “Snake Oil”, which actually was any bizarre concoction sold by so called trawling Doctors’. Here is one such original recipe, which actually was imported from the old world:
Mix carefully
”Peach Tree if the kernels be bruised and boiled in vinegar until they become thick and applied to the head until hair starts growing upon bold places or where it is too tin.”

- Or, if you had really strong stomach you could try this medieval English recipe, it was said that it worked wonders:
”Combine boar’s grease, ashes of burnt bees, ashes of southern-wood, juice of white lily root, oil of sweet almonds and musk into an ointment. Rub in to the scalp on daily bases.”

- In Roman times popular method for concealing boldness was to actually pain curls, and as for ‘curing’ boldness they concocted a lotion made from boiled snakes, which was probably very origin of the term ‘’snake oil”.

- Old Greece’s most famous physician, Hippocrates, who was himself suffering from a hair loss, devised specific remedy mixing together opium, flower essences, wine and pigeon droppings.

- Physicians in ancient Egypt had their own ways for treating baldness using potions mixtures created from hedgehog bristles and human fingernails steeped in crocodile, hippo or lion fat.

- But from the ancient times throughout Middle Ages there was one omnipotent miraculous cure for everything from bad luck or plague to boldness. This one is most certainly my favorite. It was small amount of powder obtained from grounded unicorn’s horn. Oh, yes they had unicorns horn at their disposal at those times, if they had enough money to pay for such a rare wonder that is, since it cost sometimes equaled that of entire County. Now that was a present suited for kings, and guess what, some of them had a whole horn, usually mounted in gold and jewels safely stored in their treasury. Since some of those treasuries survived at to this day and age horns where finally given for examination and then the most well kept trading secret of probably all times was discovered. Those long twisted horns really belonged to an animal but, alas, not to the mythological and magical unicorn. Those were narwhal horns, and narwhals are species of see mammals still living in cold waters of Arctic circle. And they weren’t actually horns either, but prolonged teeth. For ages native fisherman from polar areas were hunting narwhals and selling their hornlike tooth to skillful Asian merchants who trawled with them back home reselling them in Asia and Europe as unicorn’s horn gaining tremendous profit. They actually worked magic, not in curing boldness or anything else for that matter, but for bringing riches to cunning salesmen.

The Name for my blog


When I decided to restart this blog, I wanted to rename it. I was blogging sporadically in my wordpress blog (sriramsgsr.wordpress.com : u will find a few posts repeated here :P) my first major stumbling block was to find a suitable name for the blog. I had registered for this blog some 3 years back. I moved on to wordpress for no apparent reason. Being a person who is interested in writing orbit technical stuffs, i wanted to challenge myself, basically by creating a repo of good good technical and time pass stuffs so that people who visit this blog, dont get bored. So coming back to naming the blog, I want such a caption which could thrill the people who visit this page.

I also wanted to add a tinge of historical flavor to the blog as I am very interested in history and believe that we have loads to learn from history. So flashed in front of me an anecdote from 18th century from life of one Mr . Rene Descartes. (Does this name ring a bell in your mind). For those who are interested in Mathematics, he a legend who changed outlook towards mathematics by starting a new face of mathematics called the coordinate Geometry. ( other Cartesian in his memory). There is this famous incident from his life, where he was fatally injured and was hospitalised for some 4 months. Having nothing to do (ob, those days there were no TVs in the hospitals for the patients to play around with the remote :P) he observed the room in which he was housed. It was a cuboid in shape. Slowly he found out that every point in the room could be defined with reference to that of the corner (which later he called the 'origin') This how the field of coordinate geometry the mother of mother of most the present day principles was born.

So one of his famous quotations was "I think therefore i am". First time I came across this in my class 10 when a friend of mine was reading a book on coordinate geometry. From then this particular caption has been etched in my heart. This a very true but simple saying that has so much relevance in the modern context.

So I had no hesitattion in giving that as the title for my blog. As the title suggests, I plan to include posts that are humorous and thought provoking catering to varied fields.

Monday, April 19, 2010

Making movies in MATLAB ( for simulation purposes)

o make a movie of MATLAB figures first have MATLAB generate the frames of the
movie. An example file is the following…
% initialize vectors (x and y) and the axes used for plotting
nx=40;
x=linspace(-2,2,nx);
y=exp(-8*x.*x);
plot(x,y);
lim=axis;
% nframes = number of frames in movie
nframes=40;
M=moviein(nframes);
% Note: memory can be reduced by making the plot window smaller
% and commands to get and set the current plot size are…
%get(gca,’Position’)
%set(gca,’Position’,[0.13 0.11 0.5 0.6]);
% loop to produce frames of the movie (frames stored in matrix M)
dt=2/nframes;
for it=1:nframes
z=x-sin(2*pi*it*dt);
y=exp(-8*z.*z);
plot(x,y)
axis(lim)
drawnow;
M(:,it)=getframe;
end;
% various commands to show movie
movie(M);
movie(M,3);

B. Turning a MATLAB Movie into an MPEG File
You can turn the movie into a MPEG file by using the mpgwrite command
map=colormap;
mpgwrite(M, map,’filename’)
where ‘filename’ is the string containing the name of the MPEG file. Note this
is not a regular MATLAB command and the source file for it can be found at
http://www.mathworks.com/ftp/graphicsv5.shtml. Alternatively, you can copy the
files in the directory ~holmes/public/mpgwrite into the directory where you
keep m-files on RCS (note this will only work on UNIX machines). To play these
movies on RCS you can use a command like the following…
mpeg_play filename.mpg
or
mpeg_play -loop filename.mpg

TIDBITS:

While running the code make sure the plot is visible (as getframe captures the plot) and dont run other applications keepping matlab minimized. Then u will get only a blank movie.

While converting it to mpeg file make sure that the structures in M have the same frame values (exactly not sure of the tech term…. jus open each struct available in the array M nd see if the value it stores are same in case u are not able to convert it)

Link for downloading mpgwrite http://www.mathworks.com/matlabcentral/fileexchange/309

Any querries pls comment…