Saturday, March 21, 2020

Why Do Magnets Work?

Magnets


       From your very childhood you might have played with many magnets. And would have been fascinated on how they attract and repel each other when placed together with opposite poles and same poles respectively. To be clear Magnets are just objects which is capable of producing its own Magnetic Fields for a much longer time.
      You might have learnt that like poles repel each other and unlike poles attract each other. But you may not HOW do they repel or attract each other. In other words you may not know how the magnets produce its own Magnetic Field. In this Blog we shall learn why do magnets and electromagnets work the way it works.
If you haven't watched my youtube video based on "Where does Magnet's Power Come From?".
Kindly watch it from the below video.



Why do Magnets Work:

         In order to know how magnets work you need to know more about electric charges. Hence Electricity and Magnetism are like two faces of a coin. To be simple Moving charges produces Magnetic Field. Now lets study in detail how do magnets work.
         In order to understand how a Magnet work we need to understand the type of material which can be magnetised. So we need to understand the concept of magnetism from micro to macro. In making a magnet work quantum mechanics has a huge part. Now lets learn the concept of magnetism in...
         1.Fundamental Particles.
         2.Atoms.
         3.Crystals.
         4.Domains.

Fundamental Particles:

         Fundamental particles are the smallest constituent of all the matter that we could observe in this entire universe. In order to understand magnetism lets just look into the concepts of Quarks and Electrons. Most fundamental particles have an property called as Intrinsic Magnetic Moment(𝛍).
     Electrons have -𝛍 magnetic moment and quarks have 𝛍/6 magnetic moment, the magnetic behaviour of quarks are neglected due to its miniscule effect of magnetism over electron's magnetism. This magnetic moment is induced due to the spin of electrons.
       Due to the spin of electrons it produces an magnetic field of its own so we can call an electron a Tiny Magnet.

Atoms:

       Atoms make up everything that we can interact with in our day to day life. All the intrinsic magnetic moment of electrons collectively makes up an atom's magnetic moment. But all the atoms are not Magnetic. In order to understand why we need to understand some chemistry. That is, while the electron arrange itself it follows three principles they are...
            1. Aufbau's Principles:
                         It states that electrons are filled into atomic orbitals in the increasing order of orbital energy level.
            2.Pauli's Exclusion Principle:
                         It States that orbital can contain a maximum of only two electrons, the two electrons must have opposing spins.
            3.Hund's Principle:  
                        1. Every orbital in a sublevel is singly occupied before any orbital is doubly occupied.
                         2. All of the electrons in singly occupied orbitals have the same spin.

         The electrons revolves around the nucleus this creates an magnetic field called Orbital Magnetic Fields. But due to the Pauli's exclusion Principle every orbital has two electrons of different spin which produces magnetic field in opposite direction thus cancelling the effect of overall magnetic field. This is the reason why most of the atoms are not magnetic. But in some cases some atoms have half filled electron in its outermost shell which successfully creates its own magnetic field in one direction (Eg:Iron,Cobalt,Nickel,Chromium etc.,).

Crystals:

         Even when all the atoms behave like a magnet it doesn't mean that the material could behave like magnet. All the atoms combine together to form crystal which is the smallest repeating three dimensional structure. While aligning together the materials form three major ferromagnetic substance.
        1. Ferromagnetic Material:
                  This type of material is formed when all the magnetic directions of the atoms gets aligned in one single direction thus increasing the overall magnetic moment in SAME direction.(Eg: Iron)
       2. Ferrimagnetic Material:
                 This type of material is formed when the magnetic direction of the atom gets aligned in opposite direction UNEQUALLY thus it has low magnetic moment in it.(Eg:Zinc)
       3.Anti-Ferromagnetic Materials:
                 This type of material is formed when the magnetic direction of the atom gets aligned in opposite direction EQUALLY. So the magnetic moments cancel each other thus has no overall magnetic moment in it.(Eg:Chromium)



Domain:


          Domain is a region within a magnetic material in which the magnetization is in a uniform direction. Mostly all the domains are found in magnetic material so that the overall magnetic field is zero. But when applied an external magnetic field to the ferromagnetic material then all the domain magnetic field gets aligned to an overall magnetic field which is in same direction. This how an Magnet gets magnetized. This effect you might have experienced when rubbing an magnet to an iron then the iron acts like an magnet for a short amount of time.



THIS IS EXACTLY HOW AN MAGNET WORKS.


THANKS FOR READING.


Friday, March 20, 2020

C++ code for Standard and Scientific Calculator.

Hello Friends

        The C++ code for both standard and scientific calculators will be discussed below this blog. In order to know how to make the code work kindly watch the video from my channel.
                 
                             

        If you haven't subscribed to my channel kindly SUBSCRIBE and hit the BELL icon in order to get notified about my future videos.

          https://www.youtube.com/channel/UC9QngUvOPO-NfuOLZbY3pdg/featured

C++ Code for Standard and Scientific Calculator:


#include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;
int main()
{
system("color 4f");
long double a,b;
char e,c,d;
lab:
cout<<"If you want to use Standard Calculator press 'a'";
cout<<"\nIf you want to use Scientific Calculator press 'b'";
cout<<"\nPress 'a'(or)'b'=";
cin>>e;
system("cls");
system("color 30");
switch(e)
{
case 'a':
cout<<"\n*********************** WELCOME TO STANDARD CALCULATOR ************************";
cout<<"\n"<<"                                                        "<<"BY:";
cout<<"\n"<<"                                                           N.ANTO JUDE GEOFFREY"<<endl;
cout<<"\nRound(up)=<             Round(down)=d";
cout<<"\nAdd=+                   Substract=-";
cout<<"\nMultiply=*              Divide=/";
cout<<"\nPercentage=%            Less/Greater than=>"<<endl;
cout<<"\nEnter the operation(+,-,*,/,%,>,<,d)=";
cin>>c;
label:
switch(c)
{
case '+':
cout<<"\nEnter the first number for adding=";
cin>>a;
cout<<"\nEnter the second number for adding=";
cin>>b;
cout<<"\nAddition=";
cout<<a+b;
break;
case '-':
cout<<"\nEnter the first number for substracting=";
cin>>a;
cout<<"\nEnter the second number for substracting=";
cin>>b;
cout<<"\nsubstraction=";
cout<<a-b;
break;
case '*':
cout<<"\nEnter the first number for multiplying=";
cin>>a;
cout<<"\nEnter the second number for multiplying=";
cin>>b;
cout<<"\nMultiplication=";
cout<<a*b;
break;
case '/':
cout<<"\nEnter the first number for dividing=";
cin>>a;
cout<<"\nEnter the second number for dividing=";
cin>>b;
cout<<"\nDivision=";
cout<<a/b;
break;
case '%':
cout<<"\nEnter the number for which you need to find percentage=";
cin>>a;
cout<<"\nEnter the number out of which you need to find the percentage=";
cin>>b;
cout<<"\nPercentage value =";
cout<<(a*100)/b<<" %";
break;
case '>':
cout<<"\nEnter the first number for comparison=";
cin>>a;
cout<<"\nEnter the second number for comparison=";
cin>>b;
cout<<"\nThe operation is ";
if (a<b)
cout<<a<<"<"<<b;
else
cout<<a<<">"<<b;
break;
case '<':
cout<<"\nEnter the first number to round off(up)=";
cin>>a;
cout<<"\nEnter the second number to round off(up)=";
cin>>b;
cout<<"\nRound off(up) number of value 1=";
cout<<ceil(a);
cout<<"\nRound off(up) number of value 2=";
cout<<ceil(b);
break;
case 'd':
cout<<"\nEnter the first number to round off(down)=";
cin>>a;
cout<<"\nEnter the second number to round off(down)=";
cin>>b;
cout<<"\nRound off(down) number of value 1=";
cout<<floor(a);
cout<<"\nRound off(down) number of value 2=";
cout<<floor(b);
break;
default:
cout<<"ERROR OCCURRED";
break;
}
cout<<endl;
system("pause");
system("cls");
system("color 64");
cout<<"\nPress 's' key to continue and 'n' key to select the calculator and 'e' key to exit=";
cin>>d;
system("cls");
system("color f0");
switch(d)
{
case 's':
cout<<"\nNice Job!!!"<<"\nPlease continue";
cout<<"\nRound(up)=<     Round(down)=d"<<"\nAdd=+           Substract=-";
cout<<"\nMultiply=* Divide=/"<<"\nPercentage=%    Less/Greater than=>"<<endl;
cout<<"\nEnter the operation(+,-,*,/,%,>,<,d)=";
cin>>c;
goto label;
break;
case 'n':
cout<<"\nGood Job!!!";
cout<<"\nKeep Working..."<<endl;
goto lab;
break;
case'e':
cout<<"\nThank you!!!!!!!!!!!!!!";
break;
default:
cout<<"ERROR OCCURRED";
break;
}
break;
case 'b':
cout<<"*********************** WELCOME TO SCIENTIFIC CALCULATOR ***********************";
cout<<"\n                                                           BY:";
cout<<"\n                                                           N.ANTO JUDE GEOFFREY";
cout<<"\nSin=+    Sec=% Sqrt=r";
cout<<"\nCos=-    Cot=> Power=d";
cout<<"\nTan=*    Log=< Modulus=m";
cout<<"\nCosec=/";
cout<<"\nEnter the operation(+,-,*,/,%,>,<,m,r,d)=";
cin>>c;
labe:
switch(c)
{
case '+':
cout<<"\nEnter the Sine value=";
cin>>a;


cout<<"\nSine value for first value=";
cout<<sin(a);


break;
case '-':
cout<<"\nEnter the cos value =";
cin>>a;


cout<<"\nCosine of value =";
cout<<cos(a);


break;
case '*':
cout<<"\nEnter the tan value =";
cin>>a;


cout<<"\nTangent of value =";
cout<<tan(a);


break;
case '/':
cout<<"\nEnter the cosec value =";
cin>>a;


cout<<"\nCosecant of value =";
cout<<1/sin(a);


break;
case '%':
cout<<"\nEnter the sec value =";
cin>>a;


cout<<"\nSecant of value =";
cout<<1/cos(a);


break;
case '>':
cout<<"\nEnter the cot value =";
cin>>a;


cout<<"\nCotangent of value =";
cout<<1/tan(a);


break;
case '<':
cout<<"\nEnter the log value =";
cin>>a;


cout<<"\nLogarithm of value =";
cout<<log(a);


break;
case 'm':
cout<<"\nEnter the mod value =";
cin>>a;


cout<<"\nModulus of value =";
cout<<fabs(a);


break;
case 'r':
cout<<"\nEnter the sqrt value =";
cin>>a;


cout<<"\nSquare root of value =";
cout<<sqrt(a);


break;
case 'd':
cout<<"\nEnter the base value=";
cin>>a;
cout<<"\nEnter the power value=";
cin>>b;
cout<<"\nPower the numbers=";
cout<<pow(a,b);
break;
default:
cout<<"ERROR OCCURRED";
break;
}
cout<<endl;
system("pause");
system("cls");
system("color a1");
cout<<"\nPress 's' key to continue and 'n' key to select the calculator and 'e' key to exit=";
cin>>d;
system("cls");
system("color 8c");
switch(d)
{
case 's':
cout<<"\nNice Job!!!";
cout<<"\nPlease continue";
cout<<"\nSin=+    Sec=% Sqrt=r";
cout<<"\nCos=-    Cot=> Power=d";
cout<<"\nTan=*    Log=< Modulus=m";
cout<<"\nCosec=/";
cout<<"\nEnter the operation(+,-,*,/,%,>,<,m,r,d)=";
cin>>c;
goto labe;
break;
case 'n':
cout<<"\nGood Job!!!";
cout<<"\nKeep Working..."<<endl;
goto lab;
break;
case'e':
cout<<"\nThank you!!!!!!!!!!!!!!";
break;
default:
cout<<"ERROR OCCURRED";
break;
}
break;
default:
cout<<"ERROR OCCURRED";
break;
}
cout<<endl;
system("pause");
return 0;
}

COPY THE CODE AND PASTE AND ENJOY!!!