#!/usr/bin/perl
#
# Calculate the radial function for Schroedinger equation
#   of hydrogen, and probability density.

use POSIX;

$a0 = 1.0;

$start_r = 0.0;
$end_r = 100.0;
$dr = 0.1;
for ($r = $start_r; $r <= $end_r; $r += $dr) {

  $r1 = 2*exp(-$r/$a0);
  $r2 = ((2*$a0)**-1.5)*(2 - ($r/$a0))*exp(-$r/(2*$a0));
  $r3 = ($a0**-1.5)*(2.0/(81*sqrt(3.0)))*(27 - (18*$r/$a0) + 2*$r*$r/($a0*$a0))
                 *exp(-$r/(3*$a0));

  $prob1 = $r1*$r1;
  $prob2 = $r2*$r2;
  $prob3 = $r3*$r3;

  printf "%9.4e  %9.4e %9.4e  %9.4e %9.4e   %9.4e %9.4e \n",
         $r, $r1, $prob1, $r2, $prob2, $r3, $prob3;

}


exit 0;
