usencrypt.atan#

usencrypt.atan(x, n=10, debug=False)#

Computes the arctangent of \(x\) using the Newton-Raphson method.

Parameters
  • x (usencrypt.cipher.Float or float) – The input value.

  • n (int) – The number of iterations for the Newton-Raphson method. Defaults to 10.

Returns

The arctangent of x.

Return type

usencrypt.cipher.Float

Note

  • It takes 30 iterations to get negligible error (i.e., \(< 0.000001\)) convergence on values of \(−8\pi < x < 8\pi\).

  • Depends on the usencrypt.sin() and usencrypt.cos() functions to compute the arctangent.

Warning

See the warnings of usencrypt.cos().

Examples
>>> import usencrypt as ue
>>> a = ue.encrypt(0.75)
>>> a_atan = ue.atan(a)
>>> a_atan
(0x7f843af52f70) Float: 0x6d7cefa3b657d816cb38772689fc401650a22d78ebc9b93a833eb819bd2d70ec
>>> ue.decrypt(a_atan)
0.6435011103749275