[Python] What is the difference between numpy.atan and numpy.arctan?

Discussão em 'Python' iniciado por Stack, Abril 8, 2025.

  1. Stack

    Stack Membro Participativo

    When looking for the 2-pi range version of np.atan (which turns out to be np.atan2) I found that there's a np.arctan as well - is there some difference between np.arctan and np.atan? The test below doesn't seem to show any difference between atan and arctan , or between atan2 and arctan2:

    import numpy as np
    for i in np.arange(0,2*np.pi,.1):
    x = np.cos(i)
    y = np.sin(i)
    th = np.atan(y/x)
    th2 = np.atan2(y,x)
    th3 = np.arctan(y/x)
    th4 = np.arctan2(y,x)
    print(f'atan {th} atan2 {th2} arctan {th3} arctan2 {th4}')

    Continue reading...

Compartilhe esta Página