March 19, 2013

What really happens when you divide something by a zero

(Disclaimer: This post is merely trying to describe why result of division by zero sometimes written or assumed as infinity. It does not describe detail mathematical aspect of zero division. )
We usually say it is not possible to determine the result of zero division. Sometimes we write the result as an infinite number. In my early days of math education I always wondered why we say it undefined and write as infinity in mathematical expressions. One possible reason is to assume infinity itself as an undefined number or entity. But there was another explanation.

February 5, 2013

PHP code for prime number detection

Find Prime number using PHP code


Here is the procedure the determine if a number is prime or not. I will code it using PHP, but let me show you the algorithm first so that you can rewrite it using any language.

Algorithm:
1. Take the number to be decided as a variable "i"
2. If the number is 1 or 2, it is prime. So flag it as prime under a variable "flag_one". If this variable is TRUE, we will declare the number as prime.
3. If the number is completely divisible by 2, it is an even number and is not prime. Flag it as false in this case.
4. If the number is not divisible by 2 (and not equals to 1, handled in step two), it must be odd. Now we need to check if the number is divisible by any number which is lower in value than the input number. Actually it will suffice to check any number less than half of the input number. For example, if the input number is 17, we need to check untill 17/2=8.5, rounded to 9 and check if 17 is completely divisible by any number starting from 3 to 9. If it is, we do not need to check it any further and declare it as prime under the variable "flag_one". If not, we need to check it untill 9. Finally, if we do not find any number that divides the input with a remainder zero we need to declare the input as NOT prime.

Code:

April 3, 2012

Fibonacci code in Python language

Code to output Fibonacci number in Python


Fibonacci code can be written in Python language very easily and efficiently.
It can be done recursively or non-recursively. I have provided non recursive examples in other post, hence this  Fibonacci code example is written in recursive manner.

Code:
def  fib:
       if (n==0):
            return 0
       elif (n==1):

March 14, 2012

PHP code for Fibonacci series


Fibonacci code in PHP


Here is the PHP code for Fibonacci series. This will just print the series in screen. If you need the sum upto n-th Fibonacci series number, please let me in the comment box. I will provide the code ASAP.

Code:

<?php


   $n=10;//n-th Fibonacci number



     for($a=1,$b=1,$c=0,$i=0;$i<$n;$i++)


        {

          $c=$a+$b;
          if ($i==0) echo $a.' '.$b.' ';
          $a=$b;
          $b=$c;
          echo $c.' ';
         }

?>
You can see the code in action at http://codepad.org/01Z6rQ1o


January 22, 2012

Slip of Induction Machine : The Hidden Power

Ever wondered why slip is so important in induction machine?

(If you do not know, in case: slip is a measure of speed difference between stator and rotor magnetic field in induction machine.) When stator coil is energized in induction machine, it produces a magnetic field. If the energizing force i.e. voltage or current is rotating in nature, generated stator magnetic field is rotating in nature as well.

When this stator magnetic field starts rotating around rotor, it cuts the rotor coil (or the conductor bars embedded in rotor). Therefore, the rotor experiences a changing

May 12, 2011

Induction generator troubleshooting

Induction generators are widely used in diverse places ranging from shops to household. They are popular because of their low cost and simplicity. However, they can face frequent problems as Induction generators are not designed with securities conventional generators have.

In this post I am going to describe how a small but frequent problem in induction generators can be solved. This is my first approach to a series of posts about induction generator troubleshooting.

PROBLEM:

Generator is not producing electricity though it is rotating, or it is not producing its usual power, or it is not powering all equipments as it did couple of days ago.

SOLUTION:

Simply connect the induction generator to  an existing conventional AC power source and run it as a motor for some times. This problem should be solved. 


If you wonder what was the problem and how my solution will solve above mentioned problem, keep reading. I am going to describe it in next paragraph.


Induction generators are constructionally same as induction motors except for the fact that induction generators has a prime mover. This prime mover is run by diesel and in same cases, by other petroleum oils.
However, induction generators exploits the residual magnetism in the rotor and produce electricity. This residual magnetism is the source of electric energy produced in induction generator. Residual magnetism can be lost for a number of reason and I am not going to describe these reasons in this article. However, if residual magnetism is lost, no electricity will be produced even if the generator is running. To restore residual magnetism, just make the generator working as motor for a while. This will recreate the residual magnetism and everything will be fine. And you will make everything okay just after a little troubleshooting.




May 6, 2010

Regenerative braking of electrical machines

   Regenerative braking is one type of electrical braking procedure. Normally energy is
dissipated in any braking procedure and in most cases, energy is lost as heat.Regenerative braking has been designed to utilize this energy,so the amount of energy lost as heat in other braking processes will be used for some productive purpose in this process.For example, in some areas with lot of mountains, a train is allowed to come down from top of mountain only when another is going up, so that one train can transfer its energy to another.Its charming, na!!

Fig:Regenerative braking

Look at the schematic. when we apply braking, stator is of course disconnected from main supply using switch set-4. But the rotor is rotating due to its inertia. In case of DC, synchronous and permanent magnet motor, rotor has distinct flux source. And in case of induction motor, rotor has residual magnetism. Therefore, virtually all machine has some sort of flux source on its rotor. When rotating due to inertia, this flux cuts

April 20, 2010

Dynamic or capacitive braking of electrical machine

Dynamic braking is a process in which kinetic energy of rotor is dissipated in external resistor as heat energy. It is an electrical braking process used in many industrial applications. Dynamic braking allows sudden stop of electrical motor without mechanical wear and tear.

In dynamic braking, stator has no supply at the time of braking. However, rotor is rotating due to inertia. In synchronous motor, rotor has a supply even when stator is disconnected from supply. In permanent magnet synchronous motor, rotor is a permanent magnet. In case of induction motor, rotor is very likely to have a residual magnetism. Therefore, in major types

Electrical braking theory, reason of DC injection

 Electrical braking is needed in many applications and used instead of mechanical braking. The advantage of electrical braking is virtually no wear and tear is experienced.

 Electrical braking may be seen in modern cars, traction motor control, train services, alternators and in automotive industries.

 Here I will discuss the basic principle, I will not elaborate in this post because I believe feeding everything in one pack will result in vomiting. So, for deeper understanding, read my blog time to time. Also, you may search my blog to find the later post. I will post them under the label "electrical braking". also, it is a good idea to subscribe via mail, if you want to get my articles in your inbox.

  We understand if we can dissipate motors' kinetic energy quickly, we can implement a braking. So, all we need is to devise a way to dissipate kinetic energy rapidly.

   The main theory of electrical braking is to use a DC (direct current) injection to provide magneto motive resistance to the running rotor. If a DC flux is provided to the rotor and rotor cuts through it, it eventually slows down because DC injection effectively produces a electrical (or more accurately, magnetic) resistance as described below.

March 23, 2010

Basic principle of induction machine(motor and generator)- simple description

An induction machine is the most simple electrical machine from constructional point of view, in most of the cases. It can be classified into motor and generator. In this post, I want to discuss the characteristic common to both of these. Detailed description of each will be available soon in other posts.

Induction machines work on induction principle, in other words it depends on Faraday's law of induction (i.e. when a conductor moves in a magnetic field, it gets some voltage(induced voltage). this voltage can set up current if construction permits and can set up its own magnetic field.). In this case it should be noted that moving in a magnetic field actually makes the magnetic flux changing to the moving conductor(actually seems to be changing, from the view point of one who is moving), and this changing magnetic field causes voltage and current to be induced on the moving body.

But if the magnetic filed is itself changing in nature, then it can