Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib
- import matplotlib.pyplot as plt
- r = 10.;
- h = 2.;
- x = np.linspace(-r, +r, 1000)
- xlarge = np.linspace(-r * 1.5, r*1.5, 1000)
- u = np.sqrt( r**2 - x**2)
- l = -u
- a = np.sqrt( (1+h/r)**2 - 1.);
- right = r + h - a * xlarge;
- left = r + h + a * xlarge;
- plt.fill(x, u, 'b', alpha=0.3)
- plt.fill(x, l, 'b', alpha=0.3)
- plt.plot(xlarge, right, color='g');
- plt.plot(xlarge, left , color='g');
- plt.xlabel("x")
- plt.ylabel("y")
- plt.title("Horizon; what is it?")
- plt.xlim(-r * 1.5, r*1.5)
- plt.ylim(-r * 1.5, r*1.5)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement