In [1]:

```
import math
#Variable declaration
g = 9.8; # Acceleration due to gravity, m/sec^2
H = 10000; # Altitude of the aeroplane above the surface of earth, m
c = 3.00e+008; # Speed of light in free space, m/s
T = 45*3600; # Time taken by the airplane to from eastward to westward trip, s
#Calculations
delta_T_G = g*H*T/(c**2*1e-009); # Time difference in the two clocks due to gravitational redshift, ns
C = 4e+007; # Circumference of the earth, m
v = 300; # Speed of the jet airplane, m/s
T0 = C/v; # Time of flight of jet airplane very near the surface of the earth, s
bita = v/c; # Boost parameter
# As from special relativity time dilation relation, T = T0*sqrt(1-bita^2), solving for T0 - T = delta_T_R, we have
delta_T_R = T0*(1-math.sqrt(1-bita**2))/1e-009; # Time difference in the two clocks due to special relativity, ns
#Result
print "The gravitational time dilation effect of %d ns is larger than the approximate %4.1f ns of that of special relativity."%(math.ceil(delta_T_G), delta_T_R)
```

In [2]:

```
import math
#Variable declaration
c = 3.00e+008; # Speed of light in free space, m/s
G = 6.67e-011; # Newton's gravitational constant, N-Sq.m/per kg square
M_S = 2.0e+030; # Mass of the sun, kg
M_E = 6.0e+024; # Mass of the earth, kg
#Calculations
r_S = 2*G*M_S/(c**2*1e+003); # Schwarzschild radius for sun, km
r_E = 2*G*M_E/(c**2*1e-003); # Schwarzschild radius for earth, mm
#Results
print "The Schwarzschild radius for sun = %d km"%math.ceil(r_S)
print "The Schwarzschild radius for earth = %d mm"%math.ceil(r_E)
```

In [3]:

```
import math
import scipy
from scipy.integrate import quad
#Variable declaration
c = 3.00e+008; # Speed of light in free space, m/s
G = 6.67e-011; # Newton's gravitational constant, N-Sq.m/per kg square
h = 6.62e-034; # Planck's constant, Js
#Calculations
h_bar = h/(2*math.pi); # Reduced Planck's constant, Js
sigma = 5.67e-008; # Stefan-Boltzmann constant, W per Sq.m per K^4
k = 1.38e-023; # Boltzmann constant, J/K
M0 = 1.99e+030; # Mass of the sun, kg
alpha = 2*sigma*h_bar**4*c**6/((8*math.pi)**3*k**4*G**2); # A constant, kg^3/s
T = lambda M: 1/alpha*M**2
t,err = scipy.integrate.quad(T,0, 3*M0)
#Result
print "The time required for the 3-solar-mass black hole to evaporate = %3.1e y"%(t/(365.25*24*60*60))
```