The Naked Scientists
  • Login
  • Register
  • Podcasts
      • The Naked Scientists
      • eLife
      • Naked Genetics
      • Naked Astronomy
      • In short
      • Naked Neuroscience
      • Ask! The Naked Scientists
      • Question of the Week
      • Archive
      • Video
      • SUBSCRIBE to our Podcasts
  • Articles
      • Science News
      • Features
      • Interviews
      • Answers to Science Questions
  • Get Naked
      • Donate
      • Do an Experiment
      • Science Forum
      • Ask a Question
  • About
      • Meet the team
      • Our Sponsors
      • Site Map
      • Contact us

User menu

  • Login
  • Register
  • Home
  • Help
  • Search
  • Tags
  • Recent Topics
  • Login
  • Register
  1. Naked Science Forum
  2. Non Life Sciences
  3. Physics, Astronomy & Cosmology
  4. Special Relativity Mass Calculator
« previous next »
  • Print
Pages: [1]   Go Down

Special Relativity Mass Calculator

  • 13 Replies
  • 17727 Views
  • 0 Tags

0 Members and 1 Guest are viewing this topic.

Offline UltimateTheory (OP)

  • Sr. Member
  • ****
  • 107
  • Activity:
    0%
  • Thanked: 1 times
    • Ultimate Theory of the Universe
Special Relativity Mass Calculator
« on: 26/12/2012 08:46:37 »
Hello!

I have Christmas present to you:

on-line Special Relativity Mass Calculator

http://www.ultimate-theory.com/en/2012/12/26/special-relativity-mass-calculator

It takes rest mass m0, velocity and speed of light as parameters, in units you want, and calculates final mass.

It's working with floating point precision of web browser - it's using JavaScript to calculate mass.

ps. It appears that the latest version of Chrome is buggy and there is need to click Calculate button. In Firefox it's immediately calculating after change of value.
Logged
Ultimate Theory of the Universe
http://www.ultimate-theory.com
 



Offline syhprum

  • Naked Science Forum King!
  • ******
  • 5198
  • Activity:
    0%
  • Thanked: 74 times
Re: Special Relativity Mass Calculator
« Reply #1 on: 26/12/2012 16:59:36 »
I was a little disappointed I put in a slightly greater velocity than c but it made no attempt at an answer, could not the energy be included too
Logged
 

Offline UltimateTheory (OP)

  • Sr. Member
  • ****
  • 107
  • Activity:
    0%
  • Thanked: 1 times
    • Ultimate Theory of the Universe
Re: Special Relativity Mass Calculator
« Reply #2 on: 27/12/2012 01:06:24 »
Quote from: syhprum on 26/12/2012 16:59:36
I was a little disappointed I put in a slightly greater velocity than c but it made no attempt at an answer, could not the energy be included too

You're disappointed by mr. Einstein not by mine calculator.

Equation is:

m=m0/sqrt(1-v*v/c*c)

This equation was designed to always be infinity after using v>c

If v==c then sqrt(1-c*c/c*c) = sqrt(1-1) = sqrt(0) - division m0/0 - not possible.

If v>c then sqrt(negative value) and it's illegal in math.
Logged
Ultimate Theory of the Universe
http://www.ultimate-theory.com
 

Offline UltimateTheory (OP)

  • Sr. Member
  • ****
  • 107
  • Activity:
    0%
  • Thanked: 1 times
    • Ultimate Theory of the Universe
Re: Special Relativity Mass Calculator
« Reply #3 on: 27/12/2012 01:42:41 »
The largest velocity that I am able to enter is

v = 299792457.99999997

after using 299792457.999999971 there is produced error/infinity (floating precision of computer, it might differ between web browsers, they have different implementations of JavaScript)

1 kg at rest mass has in such speed 54794158.00594377 kg (55 million times bigger)
Logged
Ultimate Theory of the Universe
http://www.ultimate-theory.com
 

Offline JP

  • Naked Science Forum King!
  • ******
  • 3346
  • Activity:
    0%
  • Thanked: 3 times
Re: Special Relativity Mass Calculator
« Reply #4 on: 27/12/2012 03:15:08 »
Quote from: UltimateTheory on 27/12/2012 01:06:24
If v>c then sqrt(negative value) and it's illegal in math.

The square root of a negative is defined as an imaginary number.  Most physicists agree that such a particle can't exist, but it has been proposed and is called a tachyon: http://en.wikipedia.org/wiki/Tachyon
Logged
 



Offline UltimateTheory (OP)

  • Sr. Member
  • ****
  • 107
  • Activity:
    0%
  • Thanked: 1 times
    • Ultimate Theory of the Universe
Re: Special Relativity Mass Calculator
« Reply #5 on: 27/12/2012 05:47:05 »
I was talking about from point of view of programming that sqrt(-value) is causing error.

But if you want I can change equation to:

m=m0/sqrt(abs(1-v*v/c*c))

I have tested this and surprisingly when v=2c, the result is m=m0/sqrt(3), so if m0 = 1 kg, m=0.577 kg.
Logged
Ultimate Theory of the Universe
http://www.ultimate-theory.com
 

Offline flr

  • Sr. Member
  • ****
  • 302
  • Activity:
    0%
  • Thanked: 2 times
Re: Special Relativity Mass Calculator
« Reply #6 on: 27/12/2012 06:47:57 »

Rather poorly programmed utility and impractical to use.

- The speed of light shall be as a constant in program and not as input.
- There should be only a single line with the result, in units that can be selected with a selector at the end.
- There should be a reset button.
- Add compute on paste event and on key up event; that may remove the compute button and save the user of one click.
- Add compute on select units.

And most importantly: debug it. If fails sometimes: It generated NaN at speeds lower than the speed of light.
Logged
 

Offline UltimateTheory (OP)

  • Sr. Member
  • ****
  • 107
  • Activity:
    0%
  • Thanked: 1 times
    • Ultimate Theory of the Universe
Re: Special Relativity Mass Calculator
« Reply #7 on: 27/12/2012 08:07:05 »
Quote
- The speed of light shall be as a constant in program and not as input.

It's input because one person might want to use 3*10^8, second might want to use proper 299792458 m/s - which is default value, so user has nothing to enter..

Quote
- There should be only a single line with the result, in units that can be selected with a selector at the end.

It's for user convenience to show result in couple units at the same time. Especially it's so easy to do it.

I was rather thinking about reverse - handling British & USA inches, foots and miles.

Quote
- There should be a reset button.

True. Done.

Quote
- Add compute on paste event and on key up event; that may remove the compute button and save the user of one click.

Changed onchange to onkeyup. Works fine in Firefox & Chrome (unlike onchange which doesn't work in Chrome).

But web browser doesn't send onkeyup event when user picked unit from drop-down list. And onchange must be present to handle it.

Quote
- Add compute on select units.

Web browsers are buggy. Firefox is computing while changing units in drop-down list, Chrome doesn't. I don't have other web browsers (IE) to check it.

Quote
And most importantly: debug it. If fails sometimes: It generated NaN at speeds lower than the speed of light.

Give example for v and m0 which is showing it.
And when you find it-check in other web browser.


« Last Edit: 27/12/2012 08:12:07 by UltimateTheory »
Logged
Ultimate Theory of the Universe
http://www.ultimate-theory.com
 

Offline JP

  • Naked Science Forum King!
  • ******
  • 3346
  • Activity:
    0%
  • Thanked: 3 times
Re: Special Relativity Mass Calculator
« Reply #8 on: 27/12/2012 15:45:39 »
Quote from: UltimateTheory on 27/12/2012 05:47:05
I was talking about from point of view of programming that sqrt(-value) is causing error.

But if you want I can change equation to:

m=m0/sqrt(abs(1-v*v/c*c))

I have tested this and surprisingly when v=2c, the result is m=m0/sqrt(3), so if m0 = 1 kg, m=0.577 kg.


Technically, the mass becomes imaginary when v>c, so you'd need an if statement to set m=i m0/sqrt(abs(1-v*v/c*c)). You do get the odd property that you noted: the magnitude of energy of mass decreases as speed increases. 

Of course, you could also have it return a statement saying that velocities above c aren't attainable by any known matter (tachyons are an interesting theoretical aside, but probably don't exist and certainly haven't been observed).
Logged
 



Offline flr

  • Sr. Member
  • ****
  • 302
  • Activity:
    0%
  • Thanked: 2 times
Re: Special Relativity Mass Calculator
« Reply #9 on: 27/12/2012 17:16:41 »
It looks much better now. And easier to use.

The difference in behavior from browser to browser is not that much due to the fact "browsers are buggy" but rather due to slight different implementations of (for example) javascript engine (and other things like default styling, etc). People who design web pages or small web utilities knows these differences and write their codes accordingly such that it works similar in all main browsers.

If you do the exercise of changing your code such that it work similar in IE && firefox && chrome && safari && opera, you will see. 
Logged
 

Offline UltimateTheory (OP)

  • Sr. Member
  • ****
  • 107
  • Activity:
    0%
  • Thanked: 1 times
    • Ultimate Theory of the Universe
Re: Special Relativity Mass Calculator
« Reply #10 on: 27/12/2012 17:45:23 »
Anyone interested in reversed calculator? Input mass and velocity. Output rest mass.

Or enter mass and rest mass. Output velocity.
Logged
Ultimate Theory of the Universe
http://www.ultimate-theory.com
 

Offline yor_on

  • Naked Science Forum GOD!
  • *******
  • 81639
  • Activity:
    100%
  • Thanked: 178 times
  • (Ah, yes:) *a table is always good to hide under*
Re: Special Relativity Mass Calculator
« Reply #11 on: 29/12/2012 08:31:01 »
Nice Xmas present UT, and yeah, one for next year too, maybe? :)

You could maybe make it in two versions, using the original formula for the first, then add a button saying 'tachyons' and, if pressed, change to the other? (2in1)
Logged
URGENT:  Naked Scientists website is under threat.    https://www.thenakedscientists.com/sos-cambridge-university-killing-dr-chris

"BOMB DISPOSAL EXPERT. If you see me running, try to keep up."
 

Offline AndroidNeox

  • Sr. Member
  • ****
  • 291
  • Activity:
    0%
  • Thanked: 2 times
Re: Special Relativity Mass Calculator
« Reply #12 on: 13/01/2013 01:58:17 »
You could probably easily add fields for space and time dilation, too. Maybe just a field to show how much length contracts and time slows.

Thanks. It's a fun toy.
Logged
 



Offline UltimateTheory (OP)

  • Sr. Member
  • ****
  • 107
  • Activity:
    0%
  • Thanked: 1 times
    • Ultimate Theory of the Universe
Re: Special Relativity Mass Calculator
« Reply #13 on: 25/08/2013 17:34:44 »
Quote from: AndroidNeox on 13/01/2013 01:58:17
You could probably easily add fields for space and time dilation, too. Maybe just a field to show how much length contracts and time slows.

I added Lorentz Factor output.
And new unit "c" for velocity, for easier calculating relativistic velocities.
Logged
Ultimate Theory of the Universe
http://www.ultimate-theory.com
 



  • Print
Pages: [1]   Go Up
« previous next »
Tags:
 
There was an error while thanking
Thanking...
  • SMF 2.0.15 | SMF © 2017, Simple Machines
    Privacy Policy
    SMFAds for Free Forums
  • Naked Science Forum ©

Page created in 2.105 seconds with 60 queries.

  • Podcasts
  • Articles
  • Get Naked
  • About
  • Contact us
  • Advertise
  • Privacy Policy
  • Subscribe to newsletter
  • We love feedback

Follow us

cambridge_logo_footer.png

©The Naked Scientists® 2000–2017 | The Naked Scientists® and Naked Science® are registered trademarks created by Dr Chris Smith. Information presented on this website is the opinion of the individual contributors and does not reflect the general views of the administrators, editors, moderators, sponsors, Cambridge University or the public at large.