import matplotlib.pyplot as plt
# Given data
momentum_electron = 9.0e-21 # kg*m/s
momentum_neutrino = 4.8e-21 # kg*m/s
mass_residual_nucleus = 3.6e-25 # kg
# Calculate the final momentum
final_momentum = momentum_electron + momentum_neutrino
# Calculate the recoil velocity
recoil_velocity = final_momentum / mass_residual_nucleus
# Print the recoil velocity
print("Recoil velocity of the residual nucleus:", recoil_velocity, "m/s")
# Create a diagram
plt.figure()
plt.quiver(0, 0, momentum_electron, 0, angles='xy', scale_units='xy', scale=1, color='blue', label='Electron')
plt.quiver(momentum_electron, 0, momentum_neutrino, 0, angles='xy', scale_units='xy', scale=1, color='red', label='Neutrino')
plt.xlim(0, final_momentum + 1e-21) # Adjust the x-axis limit for visualization
plt.xlabel("Momentum (kg*m/s)")
plt.title("Radioactive Decay Momentum Diagram")
plt.legend()
plt.grid()
plt.show()