One of my homework problems for my modern physics course asked me to calculate the highest velocity of a particle for which the Newtonian approximation of kinetic energy is accurate to within an error of of the actual, relativistic, kinetic energy.
In trying to solve this problem, I decided it would be faster and easier to solve the problem numerically than it would be to work out the math. So, I hacked together a quick bisection solver (compatible with MATLAB or Octave) shown below.
%% Newtonian vs. Relativistic Energy Accuracy
% Determines the maximum speed a particle can have such that its
% kinetic energy described as 0.5*m*v^2 with an error of no greater
% than <tolerance>.
close all; clear all; clc;
% Input - The tolerance of the accuracy of the Newtonian kinetic energy
% compared to the relativistic energy.
= .005;
% Speed of light [m/s]
= 299792458;
% Bisection parameters
= 100;
= ;
= 0;
% How accurate we are in our calculation.
% Not to be confused with tolerance of energy calculation (aka error).
= .0001;
% Use bisection to determine max velocity to keep energy within
% the specified tolerance.
for i=1:
% "Guess" the velocity
= / 2 + ;
% Calculate our energies
= ^; % Gamma
= 0.5*^2; % Newtonian kinetic energy per unit mass
= *^2 - ^2; % Relativistic kinetic energy per unit mass
% Calculate energy error
= abs / ;
fprintf
% Error is too big, try a lower velocity
if >
= ;
% Error is within tolerance
else
% Not close enough to target value, increase velocity
if abs >
= ;
% Error is within accepted tolerance, we're done.
else
break
end
end
end
I later went back and thought it would be interesting (or ironic) to solve for Newtonian error in kinetic energy using Newton's method. This I created a Newton's method script (compatible with MATLAB and Octave) shown below.
%% Newtonian vs. Relativistic Energy Accuracy - Using Newton's Method
% Determines the maximum speed a particle can have such that its
% kinetic energy described as 0.5*m*v^2 with an error of no greater
% than <tolerance>.
close all; clear all; clc;
% Input - The tolerance of the accuracy of the Newtonian kinetic energy
% compared to the relativistic energy.
= .005;
% Speed of light [m/s]
= 299792458;
% Newton's method
= 1e5;
= 1e-4;
= .5*;
% Use Newton's method to solve
for i=1:
% "Guess" the velocity
= ;
% Calculate our energies
= ^; % Gamma
= 0.5*^2; % Newtonian kinetic energy per unit mass
= *^2 - ^2; % Relativistic kinetic energy per unit mass
% Newton's method
= abs - ;
= / ;
= - /;
fprintf
% If close enough, break
if abs <
break
end
end
One quick note, in the bisection method, I have the script exiting based on the difference between the error and the target error, 0.5%. In the Newton's method script, the script exits based on the difference between velocity of consecutive iterations.
I wrote one more version of the bisection approach (here) to use the same tolerance measurement method (i.e. the error in velocity not the error in kinetic energy error). It's a bit slower, but it's also more accurate.
Both method's converge to a result of . But Newton's method takes 4005 iterations, while the bisection approach takes 38 iterations (to produce an answer accurate to .0001 m/s). So, not a great example of Newton's work. I guess we'll call this a win for Einstein.