Pages

Friday, January 2, 2009

Science in Sports - The Magnus Effect

0 comments
My brother looks back at the cylindrical filter of a reverse osmosis unit substituted for a lone stump, toppled by the plastic ball I threw. He had played a perfect forward defense that would have made Rahul Dravid proud! Yet the ball, tracing a curved path in the shape of a banana had whizzed past the outside edge to hit the "stump". "Yeah, that's the Magnus Effect", I thought to myself. The same effect that helps Roberto Carlos score a goal as well as threaten the ball boy standing 10 yards away from the goal!

So, what is the Magnus Effect? When a cylindrical body or a spherical spins and moves in one direction through a fluid, experiences a force perpendicular to the direction of its velocity.



Consider there is no wind and the velocity of the ball is V. So, the relative velocity of air around the ball with respect to the ball is V. Now, due to the spin on the ball, the air in contact with its surface acquires some velocity. In the above picture (I got the picture from wikipedia) you can see that the flow of air is assisted by the spin. Therefore the relative velocity of air will be greater than V. On the other side, the flow is being opposed by the spin and hence lesser relative velocity of air with respect to the linear motion of the ball. This difference in velocity, in accordance with Bernoulli's theorem, will create a difference in pressure between the top and bottom side. With the bottom side having a lesser pressure due to high velocity of air, the ball experiences a net downward force.

This force is given by the relation,
Here F is the force, ρ is the density of air, V is the relative velocity of air over the ball with respect to the ball, A is the area of cross section of the ball and l is spin ratio.

l = rw/(2*linear velocity) where w is the angular velocity of the ball and r is its radius.

Now that you know what exactly is the magnus effect, lets see its influence in various sports. And yeah, in the order of my favourite ones! ;-)

Cricket
I guess most people know that the lateral movement of the cricket ball when a fast bowler bowls is due to the varied degree of smoothness on the two sides. So, this has got nothing to do with the magnus effect though bernoulli's theorem comes into play. In cricket the only scenario where I've observed this effect is when a spin bowler bowls.

When an off spinner bowls, he gets the ball to drift away from the batsman and when a leggie bowls, the ball drifts into the batsman. When the ball leaves the bowler's hand(in both cases), it spins around an axis that is slightly inclined to the horizontal. So, the angular velocity has a component in the horizontal plane and this accounts for the drift!(Hope you could visualise what I mean)

Tennis
In tennis the magnus effect is the reason behind the dip in the ball's trajectory after being hit. In tennis terminology this is called "topspin". When Roger Federer imparts heavy topspin on the ball with a forehand shot, the initial path traversed by it would apparently take it way outside the baseline, but the considerable force acting in the downward direction keeps it in play!

A similar action is observed in Table Tennis too. Without the help of the magnus effect there is no way to keep the ball within the limits of the table!

Football
Beckham does it, Gerrard does it, Roberto Carlos does it and almost every one of those skilled players does it!

Check this video http://www.youtube.com/watch?v=-wL5w_GxIoo
Its self explanatory!!!

But wait! A cricket ball is imparted with much more spin that that on a football and yet the football moves more! The reason is simple.

  • *Magnus force is proportional to the area of cross section of the ball. A football is larger than a cricket ball.
  • *F=m*a, when mass is less the acceleration is more for a constant force. Football is lighter than a cricket ball(i guess so :P)
The other sports like golf and volleyball are also influenced by Magnus effect.

Learnt some facts from wikipedia.


Thursday, January 1, 2009

My Birthday Reminder program!

8 comments
At last I'm done with that birthday reminder program! Here are a few screen shots of my 'software'. :P

The Main Menu


Adding Data:


Checking for birthdays on a particular date:


Clearing data:


Finally, a 'Thank You!':


The code:

#include "stdio.h"
#include "conio.h"
#include "strings.h"
main()
{
void boss(void);
void add(void);
void clear(void);
void bcheck(void);
boss();
system("cls");
printf("\n THANK YOU FOR USING THIS SOFTWARE ");
printf("\n (Press any key to exit)");
getch();
}

void boss(void)
{
int choice;
FILE *bd;
system("cls");
printf("_________________________ PREM'S BIRTHDAY REMINDER ____________________________");
j:printf("\n\nWhat do u want to do?");
printf("\n1. Add Birthday");
printf("\n2. Clear the list");
printf("\n3. Check for a birth date");
printf("\n4. Exit\n");
printf("Enter choice:");
scanf("%d",&choice);
if(choice==1)
add();
if(choice==2)
clear();
if(choice==3)
bcheck();
if(choice!=1 && choice!=2 && choice!=3 && choice!=4)
{printf("\nInvalid choice!\n\n");goto j;}

}

void add()
{
int n;
FILE *bd;
char *name[25],*bday[10];
system("cls");
l:printf("\nAdding a birthday...\n");
printf("Enter the name:");
scanf("%s",name);
printf("Enter the birthday(dd/mm/yyyy):");
scanf("%s",bday);
bd=fopen("Birthday.txt","a");
fprintf(bd,"%s\n%s\n\n",name,bday);
fclose(bd);
printf("_______________________________________________________________________________");
j:printf("\n\nAdd another birthday?\n1 - Yes\n2 - No (Go to main menu) \nEnter your choice:");
scanf("%d",&n);
if(n==2)boss();
if(n==1)
goto l;
if(n!=1 && n!=2)
{printf("\nInvalid choice!");goto j;}
}
void clear(void)
{
int n1,n2;
FILE *cl;
o:system("cls");
printf("\a");
printf("\n WARNING! YOU ARE ABOUT TO CLEAR THE LIST! PROCEED?\n1. Yes\n2. No (Go to main menu)\nEnter choice:");
scanf("%d",&n1);
if(n1==1)
{cl=fopen("Birthday.txt","w");
fclose(cl);
k:printf("\nThe file is empty now! Do you want to add birthday?\n1 - Yes\n2 - No (Go to main menu)\nEnter your choice:");
scanf("%d",&n2);
if(n2==2)boss();
if(n2==1)
add();
if(n2!=1 && n2!=2)
{printf("\nInvalid choice!");goto k;}}
if(n1==2)boss();
if(n1!=1 && n1!=2)
{printf("\nInvalid choice!");goto o;}
}
void bcheck(void)
{
int i=1,flag=0,count=1;
FILE *bd;
char name[50],date[10],input[5];
char *c;
bd = fopen("Birthday.txt","r");
system("cls");
printf("Enter the date:(dd/mm):");
scanf("%s",input);
printf("\nList of people with their birthday falling on %s :",input);
do {
if(i%2!=0)
c = fgets(name,50,bd);
if(i%2==0)
{c=fgets(date,6,bd);
if(!strcmp(input,date))
{flag=1;printf("\n\n%d. %s",count,name);count++;}}
i++;
}while (c != NULL);
if(!flag)
printf("\nNONE!");
fclose(bd);
printf("\n (Press any key to go to main menu)");
getch();
boss();
}

This code was compiled using the compiler - Dev C++, version 4.9.9.2
If you are to use this code, I would recommend the above compiler as some parts of the code may not work on other compilers. You can download Dec C++ compiler here.
(If you want this code but have problems copying from here, contact me at prem.avn@gmail.com)

Note: The file "Birthday.txt" will be created in the directory in which the code is saved.

Blogger and files

0 comments
It occurred on my birthday. I was getting a lot of calls from friends expressing their wishes. I felt kind of guilty of not knowing the birthdays of half of those people. So, I decided to do something with my laptop that could remind me of friends' b'days. First I thought of documenting those in a text file. But then even a diary could do that job! So, I decided to go the 'C' way! I wanted to create an executable file that could do what I wanted.

To store data permanently, a file should be created for that. So, the first thing I did was a 'crash course' on file management using C. Now that I'm well equipped with those stuff essentially needed for creating my 'software' :P, the next thin I have to do is start coding! I'll be completing that work tomorrow and write about the outcome.

As I always like open source software I thought I could upload the file to this blog. Unfortunately blogger doesn't allow file hosting. In order to get that file available on the net, I would have to upload it to some page like the Google Pages service which is free! But as Google Pages has stopped signing up new users, the only option I have is to include the entire code in a post! ;-)