File size: 1,158 Bytes
354a78a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
DarkEnergy Flight: import numpy as np import matplotlib.pyplot as plt # Define the parameters c = 1.0 n = 2.0 φ0 = 0.5 # Define the function f(z) def f(z): return c * np.abs(z)**n * (np.cos(n * np.angle(z)) + 1j * np.sin(n * np.angle(z))) # Define the radius range r_min = 0.0 r_max = 10.0 num_points = 100 # Create a list of radii r_list = np.linspace(r_min, r_max, num_points) # Calculate the scalar field values phi_list = φ0 + c * np.abs(r_list)**n * np.cos(n * np.angle(r_list)) # Calculate the function f(r) values f_r_list = f(r_list) # Calculate the inverse of the function f(r) values inv_f_r_list = 1 / f_r_list # Plot the results plt.figure(figsize=(10, 6)) plt.plot(r_list, phi_list, label=r"$\phi$", color="blue") plt.plot(r_list, np.abs(f_r_list), label=r"|f(r)|", color="green") plt.plot(r_list, np.real(f_r_list), label=r"Re[f(r)]", color="red") plt.plot(r_list, np.imag(f_r_list), label=r"Im[f(r)]", color="purple") plt.plot(r_list, inv_f_r_list, label=r"1/f(r)", color="black") plt.xlabel(r"Radius (r)") plt.ylabel(r"Value") plt.title(r"Scalar field, function f(r), and its inverse") plt.legend() plt.grid(True) plt.show() |