If you copy and paste the program source code below into a text editor, you can easily compile and run this.
(This class file name is MathMethod, so save this text editor as "MathMethod.java", and compile it.)
In this program, first we input the atomic number Z ( 1 = hydrogen atom, 2 = helium ion ) and reduced mass condition ( 0 = reduced mass, 1 = usual electron mass ).
From these values, it outputs theoretical values of total energy and (Bohr) radius of the hydrogen-like atoms.
Then we input the initial x-coordinate r1 (in MM) of electron, and the absolute value of the total energy E (in eV) of atoms.
From these inputted values, this program outputs the y component of electron's velocity after a quarter of its orbit, and last y coordinate, and WN (the number of de Broglie's waves included in one quarter of the orbital).
Here 1 SS = 1 × 10-23 second and 1 MM = 1 × 10-14 meter.
The initial x-coodinate is automatically increased per calculation until +100.
This method is the same as neutral helium program.
In hydrogen atom (H), total energy = -13.60569 eV, and Bohr radius = 5291.77 MM.
Using reduced mass, total energy = 13.59829 eV, and radius = 5294.65 MM.
In helium ion (He+), total energy = -54.42277 eV, and radius = 2645.89 MM.
Using reduced mass, total energy = -54.41531 eV, and radius = 2646.25 MM.
In these values, last VY is just zero. Try them.
import java.util.Scanner;
class MathMethod {
public static void main(String[] args) {
// hydrogen like atoms (ions)
// input atomic number Z and reduced mass condition.
Scanner stdIn=new Scanner(System.in);
System.out.println("Atomic number Z ( H = 1, He+ = 2 ) ? ");
double Z=stdIn.nextDouble();
System.out.println("You use reduced mass (= 0 ) or usual electron mass (= 1 ) ? ");
double whi=stdIn.nextDouble();
double me=9.1093826e-31;
double pai=3.141592653589793; double epsi=8.85418781787346e-12;
double h=6.62606896e-34; double ele=1.60217653e-19;
double mp=1.67262171e-27; // proton mass
double alph = 6.64465650e-27; // He alpha particle
double rm=me;
if (Z==1) { rm=(me*mp)/(me+mp); } // reduced mass
if (Z==2) { rm=(me*alph)/(me+alph);}
if (whi == 1 ) { rm=me; }
// theoretical values of total energy and (Bohr) radius
double toenergy = -(Z*Z*rm*ele*ele*ele*ele)/(8.0*epsi*epsi*h*h);
double radius = (epsi*h*h)/(pai*rm*Z*ele*ele);
toenergy = toenergy * 6.241509e18; // J to eV
radius = radius * 1.0e14; // meter to MM
System.out.printf("Total energy: %.5f ", toenergy);
System.out.printf("Radius: %.2f \n", radius);
// input r1 and |E| for computing
System.out.println("r1 between nucleus and electron 1 (MM)? ");
double r=stdIn.nextDouble();
System.out.println("total energy |E| of hydrogen like atom (eV) ? ");
double E=stdIn.nextDouble();
for (int i=1;i < 100;i++) { // repeat until r1=initial r1+100
// poten = potential energy
double poten=-(Z*ele*ele)/(4.0*pai*epsi*r);
//vya= total E-potential energy
double vya=-(E*1.60217646e-19)-poten*1.0e14;
if (vya > 0) {
// vyb=electron initial velocity (m/sec)
double vyb=Math.sqrt((2*vya)/rm);
double VY=vyb*1.0e-9; // change m/sec to MM/SS
double prexx=r; double VX=0.0; double WN=0.0; double preyy=0.0;
double yy,vk,preVY,preWN,midWN,leng,wav; double xx=0.0;
do {
xx=prexx+VX; yy=preyy+VY; //electron 1 position after 1SS
preVY=VY;preWN=WN ;
vk=VX*VX+VY*VY;
leng=Math.sqrt(vk)*1.0e-14; // moving length (m) for 1 SS
wav=h/(rm*Math.sqrt(vk)*1.0e9); // de Broglie wavelength (m)
WN=WN+leng/wav; // add de Broglie wavelength
//calculation of VX,VY from Coulomb force
double ra=Math.sqrt(prexx*prexx+preyy*preyy); // between nucleus and electron
// change MM to meter
ra=ra*1.0e-14;
prexx=prexx*1.0e-14; preyy=preyy*1.0e-14;
double ac=(ele*ele)/(4.0*pai*epsi*rm);
// acceleration (MM/SS^2)
VX=VX+1.0e-32*ac*prexx*(-Z/(ra*ra*ra));
VY=VY+1.0e-32*ac*preyy*(-Z/(ra*ra*ra));
prexx=xx;preyy=yy;
} while (xx >=0); // electron has moved one quater of an orbit?
if (VY > -0.0001 && VY < 0.0001) { // last VY condition
System.out.print("r1: "+r+" ");
System.out.printf("VX:%.6f ", VX);
System.out.printf("VY:%.6f ", VY);
System.out.printf("last y:%.2f ", yy);
midWN=(preWN+WN)/2.0; System.out.printf("midWN:%.6f\n", midWN);
}
} r=r+1;
}}}