Monday, May 9, 2016

3-Body Gravitational Attraction System Simulator

C++ program that calculates the resulting gravitational force in a system with three massive particles.


#include<iostream>
#include <math.h>
using namespace std;
int main () {
double fd1, fd2, fd3, M1, M2, M3, d12, d23, d31, A1, A2, A3, Fr1, Fr2, Fr3, A1M, A2M, A3M, D12, D23, D31, Fd1, Fd2, Fd3, RA1, RA2, RA3, x, y, z, FR1, FR2, FR3, IN1, IN2, IN3, V, AA1, AA2, AA3, a1, a2, a3;
const double G = 0.000000000066741;
const double PI = 3.14159265359;
cout << "///////////////////////////////////////////////////////////////////\n/////////////////////////////TGASS/////////////////////////////////\nWelcome to the Triangular Gravitational Attraction System Simulator\n///////////////////////////////////////////////////////////////////\n///////////////////////////////////////////////////////////////////\n///////////////////Made by Eduardo Monteiro////////////////////////";
cin.get();
cout << "Insert the masses of the three particles and the distance between the barycenters, place the angles between them if they have triangular positions.\nThe gravitational constant is considered 0.000000000066741 and PI is considered 3.14159265359. Insert mass in Kilograms, space in meters and angles in degrees. If the particles are aligned vertically to each other insert 0 in the angles.";
cin.get();
cout << "Mass of particle 1:";
cin >> M1;
cin.get();
cout << "Mass of particle 2:";
cin >> M2;
cin.get();
cout << "Mass of particle 3:";
cin >> M3;
cin.get();
cout << "Distance between particle 1 and 2:";
cin >> d12;
cin.get();
cout << "Distance between particle 2 and 3:";
cin >> d23;
cin.get();
cout << "Distance between particle 3 and 1:";
cin >> d31;
cin.get();
cout << "Angle formed by particle 1:";
cin >> AA1;
cin.get();
cout << "Angle formed by particle 2:";
cin >> AA2;
cin.get();
cout << "Angle formed by particle 3:";
cin >> AA3;
cin.get();
D12 = d12*d12;
D23 = d23*d23;
D31 = d31*d31;
fd1 = M1*M2/D12;
fd2 = M2*M3/D23;
fd3 = M3*M1/D31;
Fd1 = fd1*G;
Fd2 = fd2*G;
Fd3 = fd3*G;
if(AA1 != 0, AA2 != 0, AA3 !=0){
A1 = 180-AA1;
A2 = 180-AA2;
A3 = 180-AA3;
V = PI/180;
RA1 = A1*V;
RA2 = A2*V;
RA3 = A3*V;
x = RA1/2;
y = RA2/2;
z = RA3/2;
IN1 = sin(x);
IN2 = sin(y);
IN3 = sin(z);
FR1 = IN1*Fd1;
FR2 = IN2*Fd2;
FR3 = IN3*Fd3;
Fr1 = FR1;
Fr2 = FR2;
Fr3 = FR3;
a1 = Fr1/M1;
a2 = Fr2/M2;
a3 = Fr3/M3;

cout << "Resultating gravitational force exhibited in particle 1 is:"<< Fr1 << endl;
cout << "Resultating gravitational force exhibited in particle 2 is:"<< Fr2 << endl;
cout << "Resultating gravitational force exhibited in particle 3 is:"<< Fr3 << endl;
cout << "Acceleration of particle 1 is:"<< a1 << endl;
cout << "Acceleration of particle 2 is:"<< a2 << endl;
cout << "Acceleration of particle 3 is:"<< a3 << endl;
cout << "_________1___________\n_________O___________\n_____________________\n_____________________\n_____________________\n__2_______________3__\n__O_______________O__";
}
if(AA1 == 0, AA2 == 0, AA3 == 0){
Fr1 = Fd1+Fd3;
Fr2 = Fd2-Fd1;
Fr3 = Fd3+Fd2;
a1 = Fr1/M1;
   a2 = Fr2/M2;
   a3 = Fr3/M3;
cout << "Resultating gravitational force exhibited in particle 1 is:"<< Fr1 << endl;
cout << "Resultating gravitational force exhibited in particle 2 is (positive result means vector is pointing to the right and negative result means vector is pointing to the left):"<< Fr2 << endl;
cout << "Resultating gravitational force exhibited in particle 3 is:"<< Fr3 << endl;
cout << "Acceleration of particle 1 is:"<< a1 << endl;
cout << "Acceleration of particle 2 is:"<< a2 << endl;
cout << "Acceleration of particle 3 is:"<< a3 << endl;
cout << "_____________________\n_____________________\n_1_______2________3__\n_O_______O________O__\n_____________________\n_____________________\n";

    if(d31 != d12+d23){
cout << "If the angles are zero the distance between the particle 1 and the particle 3 should be the sum of the distance between the particle 1 and the particle 2 and the distance between the particle 2 and the particle 3.";
    cout << "\nTHIS WAS MISCALCULATED BY YOU!";
}
cin.get();
system("PAUSE");
return 0;
}

}

Sunday, May 8, 2016

Gravitational Force Calculator

A simple c++ program to calculate the force between two massive bodies.


#include<iostream>
using namespace std;
int main ()
{
  double d;
  double T;
  double r;
  double M1;
  double M2;
  double Fg;
  double a1;
  double a2;
  const double G = 0.000000000066741;
  cout << "Welcome to the first version of Gravitational Force Calculator.";
  cin.get();
  cout << "This program was made by Eduardo Monteiro.";
  cin.get();
  cout << "Insert the masses of the two objects and them insert the distance between the barycenters of the objects. The gravitational constant is considered 0.000000000066741.";
  cin.get();
  cout << "Mass of point particle 1 (Kilograms) =";
  cin >> M1;
  cin.get();
  cout << "Mass of point particle 2 (Kilograms) =";
  cin >> M2;
  cin.get();
  cout << "Distance between barycenters (Meters) =";
  cin >> r;
  cin.get();
  d = r*r;
  T = M1*M2/d;
  Fg = T*G;
  Fg = M1*a1;
  Fg = M2*a2;
  cout << "Gravitational Force ="<< Fg << endl;
  cout << "Acceleration of particle 1="<< a1 << endl;
  cout << "Acceleration of particle 2=" << a2 << endl;
  cin.get();
  system("PAUSE");
}

Tuesday, March 22, 2016

Design of magnetic lens for particle accelerator II

This one had a better focus and it's a lot more compact.
Blueprint:
Magnetic density and magnetic vectors:
Core with low magnetic density pentagon:


Monday, March 21, 2016

Design of magnetic lens for particle accelerator

This design was made by me. These magnetic lenses don't focus the particle beam too much to the center but it makes an almost perfect circle and the magnetic field around the accelerator is not very big. The magnets chosen were neodymium magnets, but if you use coils instead it's possible to get a better focus of particles.
Blueprint:
Map of magnetic field density:

Map of magnetic field density and magnetic field lines:

Sunday, March 20, 2016

Increased dispersion of magnetic field energy due to ferromagnetic component in neodymium magnets

In this magnetic simulation it was observed an interesting effect caused by a ferromagnetic component inside a neodymium magnet. The magnetic energy of the air around it had an increase when two pieces of iron were placed inside the magnet, but the total of magnetic energy was not changed, them you could say that the magnetic field was better dispersed. This effect happens when the magnet without the ferromagnetic component has a gap in it, as seen by the pictures bellow:
Air- Magnetic field energy of air is 
8.16778 Joules

Iron- Magnetic field energy of air is
8.87539 Joules
Now, what if you had a magnet that doesn't have the air gap when tested without an iron component? Well let's try it by filling the space with cooper metal. Ok, that would not work because the cooper metal would have more magnetic field energy concentrated in one spot, increasing the total magnetic field energy! Here is the data:
Cooper component:
Total field energy: 12.8256 Joules
Air field energy: 4.33302 Joules     
Iron component:
Total field energy: 12.5762 Joules
Air field energy: 4.14083 Joules                 
With this data we can see that this experiment is not accurate because of the concentrated field energy due to the cooper component, and with that damaging the data of the simulator because the air around the magnet is not infinite. So this method cannot be used to determinate the increase of dispersion.


Extraction of cooper sulfate

Mixture 1 is cooper sulfate mixed with unknown composition of different metals compounds that gives mixture 1 a green color. A flame test was made and it was observed green and orange flames, which is probably due to sodium and calcium contamination. It's feasible that mixture 1 is also composed of calcium carbonate. The mixture was poured in a solution of 70% sulfuric acid with ethyl alcohol, both were diluted in water. Cooper sulfate isn't soluble in ethyl alcohol so the by-products will be more easily separated. Gas was released and the solution started to become blue like cooper sulfate. A white precipitate was forming on the bottom of the beaker. The colorless gas is not combustible and doesn't have odor. The gas might be carbon dioxide, product of the reaction bellow:
                                                    H2SO4+CaCO3 → CaSO4+H2O+CO2
The products were gravity filtered. After filtering it was observed a deep blue liquid and a white powder. The liquid was cooper sulfate and water, therefore, the calcium carbonate was mixed with iron and cooper salts as well, that gave the mixture a greenish-blue color.
Final cooper sulfate yield 

Definition of Energy


Energy is a tricky thing to define but after you read this you will understand it in an elementary level. Energy is disturbance, more accurately a disturbance in a medium. We will call a medium that exists in all the infinity of the universe a field. Fields are what gives particles their masses and charges. There are the two types of energy in the universe. For example lets think about kinetic energy, this is a type of energy due to the disturbance of a massive particle created by it's movement in space. When a particle with mass travels in space it creates a disturbance in the higgs field. With that you can confirm that temperature is a state of the kinetic energy. What about light? Well light is the disturbance created by the disturbance of the electromagnetic field in our universe, light it self is just a disturbance traveling at the speed of light without mass.

Particle traveling in higgs field