### relativity maths

i am making a calculator thing that does math based around particles and need some equations i couldn't find on wikipedia
i have gamma, beta, rest mass energy, and kinetic energy calculations
to complete this calculator i need acceleration and mass calculations
if anybody is interested maybe i could post the code for you
update after a long bit of internet searching i found
force = velocity * acceleration * gamma^3
Last edited on
I think you are looking for invariant mass and acceleration if I'm understanding you correctly?

http://en.wikipedia.org/wiki/Mass_in_special_relativity#Invariant_mass

The two equations are there. I'd be quite interested to see your code to see what you're doing. Presumably working out special relativity equations for a user given particle?
thanks that helped
my code is not even half complete and is 12000+ characters
is it considered spam if i post it between two replys
I don't think that is considered spam. If you are worried, you can upload it to somewhere and just post the link. ;)

Nope, it's relevant information so I guess the admin wouldn't have a problem with it.

He's pretty chill with most things, as long as you don't post naughty pictures.
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252`` ``````#include #include using namespace std; int main () { int w = 1; double gamma; double gammaA; double gammaB; double beta; double betaSQ; double C = 299792458; double CSQ = 89875517873681764; double Gc = 6.67384 / 100000000000; double Ge = 9.78; double G; double V; double Va; double Vb; double VSQ; double VCU; double Vstr; double Vend; double length; double M; double Mr; double Mn; double A; double F; double T; double Ep; double Em; double Ek; double Et; double x; double y; double z; double a; double b; double c; while (w == 1){ cout << "all variables are metric (meters, seconds, newtons, kilograms, joules) \n"; cout << "relative 1 or newtonian 2 \n"; cin >> y; if (y == 1){ cout << "solve for gamma 1, beta 2, gravity 3, mass 4, acceleration 5, force 6, time 7, mass energy 8, kinetic energy 9, total energy 10 \n"; cin >> x; if (x == 1) { cout << "input beta \n"; cin >> beta; betaSQ = beta * beta; gammaA = 1 - betaSQ; gammaB = sqrt(gammaA); gamma = 1 / gammaB; cout << "\ngamma is " << gamma; } else if (x == 2) { cout << "input velocity \n"; cin >> V; beta = V / C; cout << "\nbeta is " << beta; } else if (x == 3) { } else if (x == 4) { cout << "rest mass 1 or moving mass 2 \n"; cin >> z; if (z == 1) { cout << "mass energy 1 or total energy 2 \n"; cin >> a; if (a == 1) { cout << "input mass energy \n"; cin >> Em; Mn = Em / CSQ; cout << "\nthe rest mass is " << Mn; } else { cout << "input total energy \n"; cin >> Et; cout << "\ninput gamma \n"; cin >> gamma; cout << "\ninput velocity \n"; cin >> velocity; Em = (Et / gamma) / V; Mn = Em / CSQ; cout << "\nthe rest mass is " << Mn; } } else { } } else if (x == 5) { } else if (x == 6) { } else if (x == 7) { } else if (x == 8) { cout << "input rest mass \n"; cin >> Mn; Em = M * CSQ; cout << "\nthe mass energy is " << CSQ; } else if (x == 9) { cout << "input gamma \n"; cin >> gamma; cout << "\ninput rest mass \n"; cin >> Mn; cout << "\ninput V \n"; cin >> V; Em = Mn * CSQ; Et = Em * gamma * V; Ek = Et - Em; cout << "\nthe kinetic energy is " << Ek; } else { cout << "input gamma \n"; cin >> gamma; cout << "\ninput rest mass \n"; cin >> Mn; cout << "\ninput velocity \n"; cin >> V; Em = Mn * CSQ; Et = Em * gamma * V; cout << "\nthe total energy is " << Et; } } else { cout << "solve for velocity 1, mass 2, acceleration 3, force 4, time 5, kinetic energy 6, gravity 7 \n"; cin >> x; if (x == 1) { cout << "timed acceleration 1 or kinetic energy and mass 2 \n"; cin >> z; if (z == 1) { cout << "input time \n"; cin >> T; cout << "\ninput acceleration \n"; cin >> A; V = A * T; cout << "\nthe velocity is " << V; } else { cout << "input mass \n"; cin >> M; cout << "\ninput kinetic energy \n"; cin >> Ek; Va = Ek / M; Vb = Va * 2; V = sqrt (Vb); cout << "\nthe velocity is " << V; } } else if (x == 2) { cout << "input kinetic energy \n"; cin >> Ek; cout << "\ninput velocity \n"; cin >> V; VSQ = V * V; M = Ek * 2 / VSQ; cout << "\nthe mass is " << M; } else if (x == 3) { cout << "input force \n"; cin >> F; cout << "\ninput mass \n"; cin >> M; A = F / M; cout << "\nthe acceleration is " << A; } else if (x == 4) { cout << "input mass \n"; cin >> M; cout << "\ninput acceleration \n"; cin >> A; F = M * A; cout << "\nthe force is " << F; } else if (x == 5) { cout << "input acceleration \n"; cin >> A; cout << "\ninput start velocity \n"; cin >> Vstr; cout << "\ninput velocity end \n"; cin >> Vend; V = Vend - Vstr; T = A / V; cout << "\nthe time is " << T; } else if (x == 6) { cout << "input velocity \n"; cin >> V; cout << "\ninput mass \n"; cin >> M; VSQ = V * V; Ek = VSQ * M / 2; cout << "\nthe kinetic energy is " << Ek; } else { cout << "graitational force 1, potential energy 2, or acceleration 3 \n"; cin >> z; if (z == 1) { cout << "\ninput mass \n"; cin >> M; cout << "\ninput other mass \n"; cin >> Mn; cout << "\ninput distance \n"; cin >> length; G = M * Mn * Gc / (length * length); cout << "\nthe gravitational force is " << G; } else if (z == 2) { cout << "\ntotal potential energy 1, lengthed/timed fall 2, or lengthed/timed fall on earth 3 \n"; cin >> a; if (a == 1) { } else if (a == 2) { cout << "\n potential energy 1, end veloctiy 2, or average veloctiy 3 \n"; cin >> b; if (b == 1) { cout << "\ninput gravitation \n"; cin >> G; cout << "\ninput fall length \n"; cin >> length; cout << "\ninput mass \n"; cin >> M; Ep = G * length * M; cout << "\nthe potential energy is " << Ep; } else if (b == 2) { cout << "\ntime 1 or length 2 \n"; cin >> c; if (c == 1) { cout << "\ninput fall time \n"; cin >> T; cout << "\ninput gravitation \n"; cin >> G; length = G * T * T / 2; Ep = G * length; VSQ = Ep * 2; V = sqrt(VSQ); cout << "\nthe end velocity is " << V; }``````
Last edited on
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105`` ``````} else { cout << "\ninput fall length \n"; cin >> length; cout << "\ninput gravitation \n"; cin >> G; Ep = G * length; VSQ = Ep * 2; V = sqrt(VSQ); cout << "\nthe end velocity is " << V; } } else { cout << "\ntime 1 or length 2 \n"; cin >> c; if (c == 1) { cout << "\ninput fall time \n"; cin >> T; cout << "\ninput gravitation \n"; cin >> G; V = T * G / 2; cout << "\nthe average velocity is " << V; } else { cout << "\ninput fall length \n"; cin >> length; cout << "\ninput gravitation \n"; cin >> G; T = sqrt(length * 2 / G); V = T * G / 2; cout << "\nthe average velocity is " << V; } } } else { cout << "\npotential energy 1, end velocity 2, or average velocity 3 \n"; cin >> b; if (b == 1) { cout << "\ntime 1 or length 2 \n"; cin >> c; if (c == 1) { cout << "\ninput time \n"; cin >> T; cout << "\ninput mass \n"; cin >> M; length = Ge * T * T / 2; Ep = length * M * Ge; cout << "\nthe potential energy is " << Ep; } else { cout << "\ninput fsll length \n"; cin >> length; cout << "\ninput mass \n"; cin >> M; Ep = length * M * Ge; cout << "\nthe potential energy is " << Ep; } } else if (b == 2) { cout << "\ntime or length \n"; cin >> c; if (c == 1) { cout << "\ninput fall time \n"; cin >> T; length = Ge * T * T / 2; Ep = length * Ge; VSQ = Ep * 2; V = sqrt(VSQ); cout << "\nthe end velocity is " << V; } else { cout << "\ninput fall length \n"; cin >> length; Ep = length * Ge; VSQ = Ep * 2; V = sqrt(VSQ); cout << "\nthe end velocity is " << V; } } else { cout << "\ntime or length \n"; cin >> c; if (c == 1) { cout << "\ninput time \n"; cin >> T; V = T * Ge / 2; cout << "\nthe average velocity is " << V; } else { cout << "\ninput length \n"; cin >> length; T = sqrt(length * 2 / Ge); V = T * Ge / 2; cout << "\nthe average velocity is " << V; } } } } } } cout << "\n would you like to do another equation? 1 yes 2 no \n"; cin >> w; } }``````

i like if statements
Last edited on