Reinforcement Learning
Flair
medical
music
legal
code
chemistry
Cherub / DarkEnergy Flight.txt
CravenMcin22's picture
Upload 59 files
354a78a
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()