RuntimeWarning: invalid value encountered in arccos
Question: I am new to using Python but getting along with it fairly well. I keep getting
the error you see below and not sure what the problem is exactly as I believe
the values are correct and stated. What do you think the problem exactly is? I
am trying to graph from t = 0 to t=PM, and the formula you see below is angle
arccos.

Couldn't find the troubleshooting of this arccos error online. Running Python
3.5.

    
    
    import numpy as np
    import matplotlib
    from matplotlib import pyplot
    from __future__ import division
    
    rE = 1.50*(10**11)
    rM = 3.84*(10**8)
    PE = 3.16*(10**7)
    PM = 2.36*(10**6)
    
    t = np.linspace(0, PM, 200)
    
    # anaconda/lib/python3.5/site-packages/ipykernel/__main__.py:1: RuntimeWarning: invalid value encountered in arccos
    y = 0.5*(np.arccos(2*(np.pi)*t*((1/PM)-(1/PE))+90))
    


Answer: Well, if you do

    
    
    np.arccos(90)
    

(which is your first element), you'll get the same warning - simplifying your
example considerably.

Why is that? The [arccos
function](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#arccos)
is the _x_ for which _cos(x) = 90_. From basic trignometry, you can tell
there's [no such
value](https://en.wikipedia.org/wiki/Trigonometric_functions#cosine).

