INTRODUCTION:
Today, science has been an integral part of life. Everything that we see, touch and feel is science. Physics (from Ancient Greek: φύσις physis "nature") is a part of natural philosophy and a natural science that involves the study of matter and its motion through space and time, along with related concepts such as energy and force. More broadly, it is the general analysis of nature, conducted in order to understand how the universe behaves.
The physics solver is a program to enhance the efficiency of solving physics numerical while providing some interesting facts at the same time about the numerical. It is created as tool to empower user with knowledge of problem tackling. By using simple command structures such as loops and switches we have created this program. It will encompass all the respective fields of physics and hundreds of interesting and motivational facts. Some of the salient features of this program are:
• It is user friendly.
• It can solve wide variety of problem in all physics
• It encompasses hundreds of motivational and counter-intuitive interesting facts.
• It is economically efficient.
• It is upgradable and versatile.
OBJECTIVES:
• To solve wide variety of physics problems.
• To create a user intuitive program.
• To give time efficient outputs
• To provide interesting and motivational facts and tricks for solving a program.
CASE STUDY:
As we found that physics is very essential for everyday life, we tried to create a time efficient program that could tell us the numerical value or magnitude of some events. For example: it could tell us what intensity of light is needed to cause some phenomenon, what height and potential is needed to accomplish some task. This was lacking in our everyday work so this program can make us aware of beauty of things and create curiosity in respective fields
Source code:
#include<stdio.h> //defining of header files
#include<conio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
void rs(void); //user defined function prototype
void srk(void);
void bp(void);
void mc(void);
void oscillation(void);
void waves(void);
void acoustics(void);
void interference(void);
void diffraction(void);
void polarization(void);
void geometricaloptics(void);
void laser(void);
void fiber(void);
void electrostats(void);
void capacitance(void);
void electricfield(void);
void electromagnetism(void);
void emi(void);
void emwaves(void);
void mwaves(void);
void swaveeqn(void);
void pphysics(void);
void cosmology(void);
void interestingfact(void);
void main(void) //main menu showing basic content
{
char choice;
while(1)
{
clrscr();
printf(" \n \t \t \t **PRESS**");
printf("------------------------------------------------------------");
printf("\n \t a | waves and acoustics");
printf("\n \t s | optics");
printf("\n \t d | electrostats and electromagnetism");
printf("\n \t f | quantum physics");
printf("\n \t g | intresting facts");
printf("\n \t esc. to terminate program");
choice=getche();
if(choice==27)
break;
else
{
switch (choice) //using switch statement to direct the flow
{
case 'a':
bp(); //call to functions
break;
case 's':
rs();
break;
case 'd':
mc();
break;
case 'f':
srk();
break;
case 'g':
interestingfact();
break;
default:
printf(" \n please eneter a valid case.");
}
}
}
printf("\n thanks for using this program!!!");
printf("\n please give us feedback about it");
getch();
}
void bp(void) //sub menu stating the multi choice feature of program
{
char choice;
while(1)
{
clrscr();
printf("\n \t \t \t **PRESS**");
printf(" \n ----------------------------------------------------");
printf("\n \t a | oscillations");
printf("\n \t s | wave motion");
printf("\n \t d | acoustics");
printf("\n \t esc. | to go previous menu");
choice=getche();
if(choice==27)
break;
else
{
switch (choice)
{
case 'a':
oscillation();
break;
case 's':
waves();
break;
case 'd':
acoustics();
break;
default:
printf("\n please enter valid case.");
}
}
}
}
void rs(void) //another sub menu of optics
{
char choice;
while(1)
{
clrscr();
printf("\n \t \t \t **PRESS**");
printf(" \n -----------------------------------------------------------");
printf("\n \t a | interference");
printf("\n \t s | diffraction");
printf("\n \t d | polarization");
printf("\n \t f | geometrical optics");
printf("\n \t q | laser");
printf("\n \t w | fiber");
printf("\n \t esc. | to go previous menu");
choice=getche();
if(choice==27)
break;
else
{
switch(choice)
{
case 'a':
interference();
break;
case 's':
diffraction();
break;
case 'd':
polarization();
break;
case 'f':
geometricaloptics();
break;
case 'q':
laser();
break;
case 'w':
fiber();
break;
default:
printf("\n please enter a valid case");
}
}
}
}
void mc(void) //sub menu of electrostats and electromagnetism
{
char choice;
while(1)
{
clrscr();
printf("\n \t \t \t **PRESS**");
printf("\n \t a | electrostats");
printf("\n \t s | electromagnetism");
printf("\n \t esc. | to go previous menu");
choice=getche();
if(choice==27)
break;
else
{
switch(choice)
{
case 'a':
electrostats();
break;
case 's':
electromagnetism();
break;
default:
printf(" \n please enter a valid case");
}
}
}
}
void srk(void) //sub menu of quantum physics
{
char choice;
while(1)
{
clrscr();
printf("\n \t \t \t **PRESS**");
printf("\n ---------------------------------------------------------");
printf("\n \t a | matter waves");
printf("\n \t s | schrodinger wave equation");
printf("\n \t d | particle physics");
printf("\n \t f | cosmology");
printf("\n \t esc. to go previous menu");
choice=getche();
if(choice==27)
break;
else
{
switch(choice)
{
case 'a':
mwaves();
break;
case 's':
swaveeqn();
break;
case 'd':
pphysics();
break;
case 'f':
cosmology();
break;
default:
printf("\n please enter a valid case");
}
}
}
}
void electrostats(void)
{
char choice;
while(1)
{
printf("\n \t \t \t **PRESS**");
printf("\n \t a | capacitance");
printf("\n \t s | electric field");
printf("\n \t esc.| to go previous menu");
choice=getche();
if(choice==27)
break;
else
{
switch(choice)
{
case 'a':
capacitance();
break;
case 's':
electricfield();
break;
default:
printf("\n please enter a valid case");
}
}
}
}
void electromagnetism(void)
{
char choice;
while(1)
{
printf("\n \t \t \t **PRESS**");
printf("\n \t a | electro-magnetic induction");
printf("\n \t s | electro magnetic waves");
printf("\n \t esc.| to go previous menu");
choice=getche();
if(choice==27)
break;
else
{
switch(choice)
{
case 'a':
emi();
break;
case 's':
emwaves();
break;
default:
printf("\n please enter a valid case");
}
}
}
}
void interestingfact(void)
{
int choice;
char ch;
time_t t;
while(1)
{
srand((unsigned)time(&t));
choice=rand()%100;
switch(choice)
{
case 1:
printf("\n Weight (force of gravity) decreases as you move away from the earth by distance squared.");
break;
case 2:
printf("\n Mass and inertia are the same thing.");
break;
case 3:
printf("\n Constant velocity and zero velocity means the net force is zero and acceleration is zero.");
break;
case 4:
printf("\n Weight (in newtons) is mass x acceleration (w = mg). Mass is not weight!");
break;
case 5:
printf("\n Velocity, displacement [s], momentum, force and acceleration are vectors.");
break;
case 6:
printf("\n Speed, distance [d], time, and energy (joules) are scalar quantities.");
break;
case 7:
printf("\n The slope of the velocity-time graph is acceleration.");
break;
case 8:
printf("\n At zero (0) degrees two vectors have a resultant equal to their sum. At 180 degrees two vectors have a resultant equal to their difference. From the difference to the sum is the total range of possible resultants.");
break;
case 9:
printf("\n Centripetal force and centripetal acceleration vectors are toward the center of the circle- while the velocity vector is tangent to the circle.");
break;
case 10:
printf("\n An unbalanced force (object not in equilibrium) must produce acceleration.");
break;
case 11:
printf("\n The slope of the distance-tine graph is velocity.");
break;
case 12:
printf("\n The equilibrant force is equal in magnitude but opposite in direction to the resultant vector.");
break;
case 13:
printf("\n Momentum is conserved in all collision systems.");
break;
case 14:
printf("\n Magnitude is a term use to state how large a vector quantity is.");
break;
case 15:
printf("\n Mechanical energy is the sum of the potential and kinetic energy.");
break;
case 16:
printf("\n Units: a = [m/sec2], F = [kg•m/sec2] (newton), work = pe= ke = [kg•m2/sec2] (joule)");
break;
case 17:
printf("\n An ev is an energy unit equal to 1.6 x 10-19 joules");
break;
case 18:
printf("\n Gravitational potential energy increases as height increases.");
break;
case 19:
printf("\n Kinetic energy changes only if velocity changes.");
break;
case 20:
printf("\n Mechanical energy (pe + ke) does not change for a free falling mass or a swinging pendulum. (Ignoring air friction)");
break;
case 21:
printf("\n The units for power are [joules/sec] or the rate of change of energy.");
break;
case 22:
printf("\n A coulomb is charge, an amp is current [coulomb/sec] and a volt is potential difference [joule/coulomb].");
break;
case 23:
printf("\n Short fat cold wires make the best conductors.");
break;
case 24:
printf("\n Electrons and protons have equal amounts of charge (1.6 x 10-19 coulombs each).");
break;
case 25:
printf("\n Adding a resistor in parallel decreases the total resistance of a circuit.");
break;
case 26:
printf("\n Adding a resistor in series increases the total resistance of a circuit.");
break;
case 27:
printf("\n All resistors in series have equal current (I).");
break;
case 28:
printf("\n All resistors in parallel have equal voltage (V).");
break;
case 29:
printf("\n If two charged spheres touch each other add the charges and divide by two to find the final charge on each sphere.");
break;
case 30:
printf("\n Insulators contain no free electrons.");
break;
case 31:
printf("\n Ionized gases conduct electric current using positive ions, negative ions and electrons.");
break;
case 32:
printf("\n Electric fields all point in the direction of the force on a positive test charge.");
break;
case 33:
printf("\n Electric fields between two parallel plates are uniform in strength except at the edges.");
break;
case 34:
printf("\n Millikan determined the charge on a single electron using his famous oil-drop experiment.");
break;
case 35:
printf("\n All charge changes result from the movement of electrons not protons (an object becomes positive by losing electrons)");
break;
case 36:
printf("\n The direction of a magnetic field is defined by the direction a compass needle points.");
break;
case 37:
printf("\n Magnetic fields point from the north to the south outside the magnet and south to north inside the magnet.");
break;
case 38:
printf("\n Magnetic flux is measured in webers.");
break;
case 39:
printf("\n Left hands are for negative charges and right hands are for positive charges.");
break;
case 40:
printf("\n The first hand rule deals with the B-field around a current bearing wire, the third hand rule looks at the force on charges moving in a B-field, and the second hand rule is redundant.");
break;
case 41:
printf("\n Solenoids are stronger with more current or more wire turns or adding a soft iron core.");
break;
case 42:
printf("\n Sound waves are longitudinal and mechanical.");
break;
case 43:
printf("\n Light slows down, bends toward the normal and has a shorter wavelength when it enters a higher (n) value medium.");
break;
case 44:
printf("\n All angles in wave theory problems are measured to the normal.");
break;
case 45:
printf("\n Blue light has more energy. A shorter wavelength and a higher frequency than red light (remember- ROYGBIV).");
break;
case 46:
printf("\n The electromagnetic spectrum (radio, infrared, visible. Ultraviolet x-ray and gamma) are listed lowest energy to highest.");
break;
case 47:
printf("\n A prism produces a rainbow from white light by dispersion (red bends the least because it slows the least).");
break;
case 48:
printf("\n Light wave are transverse (they can be polarized).");
break;
case 49:
printf("\n The speed of all types of electromagnetic waves is 3.0 x 108 m/sec in a vacuum.");
break;
case 50:
printf("\n The amplitude of a sound wave determines its energy.");
break;
case 51:
printf("\n Constructive interference occurs when two waves are zero (0) degrees out of phase or a whole number of wavelengths (360 degrees.) out of phase.");
break;
case 52:
printf("\n At the critical angle a wave will be refracted to 90 degrees.");
break;
case 53:
printf("\n According to the Doppler effect a wave source moving toward you will generate waves with a shorter wavelength and higher frequency.");
break;
case 54:
printf("\n Double slit diffraction works because of diffraction and interference.");
break;
case 55:
printf("\n Single slit diffraction produces a much wider central maximum than double slit.");
break;
case 56:
printf("\n Diffuse reflection occurs from dull surfaces while regular reflection occurs from mirror type surfaces.");
break;
case 57:
printf("\n As the frequency of a wave increases its energy increases and its wavelength decreases.");
break;
case 58:
printf("\n Transverse wave particles vibrate back and forth perpendicular to the wave direction.");
break;
case 59:
printf("\n Wave behavior is proven by diffraction, interference and the polarization of light.");
break;
case 60:
printf("\n Shorter waves with higher frequencies have shorter periods.");
break;
case 61:
printf("\n Radiowaves are electromagnetic and travel at the speed of light (c).");
break;
case 62:
printf("\n Monochromatic light has one frequency.");
break;
case 63:
printf("\n Coherent light waves are all in phase.");
break;
case 64:
printf("\n Real images are always inverted.");
break;
case 65:
printf("\n Virtual images are always upright.");
break;
case 66:
printf("\n Diverging lens (concave) produce only small virtual images.");
break;
case 67:
printf("\n Light rays bend away from the normal as they gain speed and a longer wavelength by entering a slower (n) medium {frequency remains constant}.");
break;
case 68:
printf("\n The focal length of a converging lens (convex) is shorter with a higher (n) value lens or if blue light replaces red.");
break;
case 69:
printf("\n The particle behavior of light is proven by the photoelectric effect.");
break;
case 70:
printf("\n A photon is a particle of light {wave packet}.");
break;
case 71:
printf("\n Large objects have very short wavelengths when moving and thus cannot be observed behaving as a wave. (DeBroglie Waves)");
break;
case 72:
printf("\n All electromagnetic waves originate from accelerating charged particles.");
break;
case 73:
printf("\n The frequency of a light wave determines its energy (E = hf).");
break;
case 74:
printf("\n The lowest energy state of a atom is called the ground state.");
break;
case 75:
printf("\n Increasing light frequency increases the kinetic energy of the emitted photo-electrons.");
break;
case 76:
printf("\n As the threshold frequency increase for a photo-cell (photo emissive material) the work function also increases.");
break;
case 77:
printf("\n Increasing light intensity increases the number of emitted photo-electrons but not their KE.");
break;
case 78:
printf("\n Internal energy is the sum of temperature (ke) and phase (pe) conditions.");
break;
case 79:
printf("\n Steam and liquid water molecules at 100 degrees have equal kinetic energies.");
break;
case 80:
printf("\n Degrees Kelvin (absolute temp.) Is equal to zero (0) degrees Celsius.");
break;
case 81:
printf("\n Temperature measures the average kinetic energy of the molecules.");
break;
case 82:
printf("\n Phase changes are due to potential energy changes.");
break;
case 83:
printf("\n Internal energy always flows from an object at higher temperature to one of lower temperature.");
break;
case 84:
printf("84. Alpha particles are the same as helium nuclei and have the symbol .");
break;
case 85:
printf("85. The atomic number is equal to the number of protons (2 for alpha)");
break;
case 86:
printf("86. Deuterium ( ) is an isotope of hydrogen ( )");
break;
case 87:
printf("87. The number of nucleons is equal to protons + neutrons (4 for alpha)");
break;
case 88:
printf("88. Only charged particles can be accelerated in a particle accelerator such as a cyclotron or Van Der Graaf generator.");
break;
case 89:
printf("89. Natural radiation is alpha ( ), beta ( ) and gamma (high energy x-rays)");
break;
case 90:
printf("90. A loss of a beta particle results in an increase in atomic number.");
break;
case 91:
printf("91. All nuclei weigh less than their parts. This mass defect is converted into binding energy. (E=mc2)");
break;
case 92:
printf("92. Isotopes have different neutron numbers and atomic masses but the same number of protons (atomic numbers).");
break;
case 93:
printf("93. Geiger counters, photographic plates, cloud and bubble chambers are all used to detect or observe radiation.");
break;
case 94:
printf("94. Rutherford discovered the positive nucleus using his famous gold-foil experiment.");
break;
case 95:
printf("95. Fusion requires that hydrogen be combined to make helium.");
break;
case 96:
printf("96. Fission requires that a neutron causes uranium to be split into middle size atoms and produce extra neutrons.");
break;
case 97:
printf("97. Radioactive half-lives can not be changed by heat or pressure.");
break;
case 98:
printf("98. One AMU of mass is equal to 931 meV of energy (E = mc2).");
break;
case 99:
printf("99. Nuclear forces are strong and short ranged.");
break;
default:
break;
}
printf("\n enter esc. to exit");
ch=getche();
if(ch==27)
break;
}
}
void oscillation(void)// functional function that will solve the program
{
char choice,choice1;
float m,A,T,F,k,w;
float g=9.81,s,f;
int L;
clrscr();
printf("\n \t please enetr:");
printf("\n \t 'a' for mass spring system");
printf("\n \t 's' for torsional pendulum");
choice=getche();
switch(choice)
{
case 'a':
printf("\n \t please enter:");
printf("\n 'a' for finding max. force");
printf("\n 's' for finding sping constant");
choice1=getche();
printf("\n Enter the value of mass of body:");
scanf("%f",&m);
printf("\n Enter the value of amplitude:");
scanf("%f",&A);
printf("\n Enter the value of Time period:");
scanf("%f",&T);
w=(2*3.14)/T;
F=m*(pow(w,2))*A;
k=F/A;
switch(choice1)
{
case 'a':
printf("\n Maximum force=%0.2f N",F);
break;
case 's':
printf("\n Spring constant=%0.2f",k);
break;
default:
printf("\n please enter a valid case!!");
}
break;
case 's':
printf("\n Enter the length of the ruler:");
scanf("%d",&L);
// l=L/2;
// I=(m*pow(L,2))/3;
// f=sqrt((m*g*l)/I)/(2*3.14);
// f=(sqrt(3*g)/2)/(2*3.14);
s=(3*g)/(2*L);
f=sqrt(s)/(2*3.14);
printf("Frequency of oscillation=%f",f);
break;
default:
printf("\n please enter a valid case");
}
interestingfact();
getch();
//codes arre still to write
}
void acoustics()
{
float d,f,a,v,I;
clrscr();
printf("\n Enter the value of velocity,frequency,amplitude and density:");
scanf("%f%f%f%f",&v,&f,&a,&d);
I=2*3.14*3.14*d*f*f*a*a*v;
printf("\n Enery transferred per area-time=%0.2f",I);
interestingfact();
//codes are still to be written
}
void waves()
{
char choice;
float m,A,v,a,E,w,T;
printf("\n please enter:");
printf("\n 'a' for finding max velocity");
printf("\n 's' for finding accleration");
printf("\n 'd' for finding kinetic energy");
choice=getche();
clrscr();
printf("\n Enter the value of mass of body:");
scanf("%f",&m);
printf("\n Enter the value of Time period:");
scanf("%f",&T);
printf("\n Enter the value of amplitude in m:");
scanf("%f",&A);
{
w=(2*3.14)/T;
v=w*A;
a=pow(w,2)*A;
E=(m*pow(v,2))/2;
}
switch(choice)
{
case 'a':
printf("\n Maximum velocity=%0.2f m/s",v);
break;
case 's':
printf("\n Acceleration=%0.2f m/s2",a);
break;
case 'd':
printf("\n Maximum K.E=%f J",E);
break;
default:
printf("\n please enter a valid case");
}
interestingfact();
getch();
//codes are still to be written
}
void interference()
{
float a,D,x,w;
clrscr();
printf("\n Enter the value of screen distance,slit width and fringe width");
scanf("%f%f%f",&D,&a,&x);
w=(a*x)/D;
printf("\n Wavelength=%f",w);
interestingfact();
getch();
//codes are still to be written
}
void diffraction()
{
printf("\n sorry the page is still under construction!!!");
interestingfact();
getch();
//codes are still to be written
}
void polarization()
{
float S,a,l,v,m;
clrscr();
printf("Enter the value of length of tube,angle,volume and specific rotation");
scanf("%f%f%f%f",&l,&a,&v,&S);
m=(10*a*v)/(S*l);
printf("Mass=%0.2fgm.",m);
interestingfact();
getch();
//codes are still to be written
}
void geometricaloptics()
{
float R,f,n;
clrscr();
printf("Enter the value of radius and n");
scanf("%f%f",&R,&n);
f=-R/(n-1);
printf("Focal length=0.2f",f);
interestingfact();
getch();
//codes are still to be written
}
void laser()
{
printf("\n sorry the page is still under construction!!!");
interestingfact();
getch();
//codes are still to be written
}
void fiber()
{
printf("\n sorry the page is still under construction!!!");
interestingfact();
getch();
//codes are still to be written
}
void capacitance()
{
float C,A,d,E=(8.85*pow(10,-12));
clrscr();
printf("Enter the value of capacitance and separation distance");
scanf("%f%f",&C,&d);
A=(C*d)/E;
printf("Area of the plate=%0.2f",A);
interestingfact();
getch();
//codes are still to be written
}
void electricfield()
{
float q,V,r,E=9.0*pow(10,9);
clrscr();
printf("Enter the value of charge and voltage");
scanf("%f%f",&q,&V);
r=(q*E)/V;
printf("Radius of the drop=%0.2f",r);
interestingfact();
getch();
//codes are still to be written
}
void emwaves()
{
float C,V,L,I;
clrscr();
printf("Enter the vale of capacitor,voltage and inductance");
scanf("%f%f%f",&C,&V,&L);
I=V*sqrt(C/L);
printf("Maximum current=%f",I);
interestingfact();
getch();
//codes are still to be written
}
void emi()
{
float I,B,n=8.1+pow(10,28),t,V,e=1.9*pow(10,-19);
clrscr();
printf("Enter the value of current,magnetic field,thickness");
scanf("%f%f%f",&I,&B,&t);
V=(I*B)/(n*e*t);
printf("Hall voltage=%f",V);
interestingfact();
getch();
//codes are still to be written
}
void mwaves()
{
printf("\n sorry the page is still under construction!!!");
interestingfact();
getch();
//codes are still to be written
}
void swaveeqn()
{
printf("\n sorry the page is still under construction!!!");
interestingfact();
getch();
//codes are still to be written
}
void pphysics()
{
float V,v,e=1.6*pow(10,-19),m=9.1*pow(10,-31),s;
clrscr();
printf("Enter the value of voltage");
scanf("%f",&V);
s=(2*e*V)/m;
v=sqrt(s);
printf("Speed of electron=%0.2f",v);
interestingfact();
getch();
//codes are still to be written
}
void cosmology()
{
printf("\n sorry the page is still under construction!!!");
interestingfact();
getch();
//codes is still to be written
}
Limitations:
As no object and creation is perfect. There is always a flaw in perfection and this project is also no exception to that. The main limitation to this program is, it is still incomplete. As a matter of fact that physics itself is very enormous topic and we had limited time, we couldn’t encompass all variety of problems. Except to that it has no limitations.
Further enhancements:
As we have already mentioned in previous topic and in its salient features, we have written this program in simplest form that can be imaginable. This in turn proves to be beneficial.
• Further problems can be added to stock
• Interesting facts can be updated
• The program can be dissembled and each part works in its own
• With use of graphics it can be tutorial program that teaches
• Further in future with the use of 6th generation A.I. technology it can be much more than being perceived today