How should I troubleshoot "RuntimeWarning: invalid value encountered in arccos" in NumPy?

41 views Asked by At

I am plotting histograms showing distributions of an angle tau. I used a random normal distribution as shown:

import numpy as np
N = 100000
tau = np.arccos(np.random.normal(-1, 1, N))

I got the error "RuntimeWarning: invalid value encountered in arccos tau = np.arccos(np.random.normal(-1, 1, N))".

This did not pop up with a uniform distribution. Why did this happened with the normal distribution?

0

There are 0 answers