usencrypt.acos#

usencrypt.acos(x, n=30, debug=False)#

Computes the arcosine 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 30.

Returns

The arcosine of x.

Return type

usencrypt.cipher.Float

Note

It takes 48 iterations to get convergence on the values of \(−0.9 < x < 0.9\).

Warning

Even for a large amount of iterations of Newton-Raphson, it does not converge well for values at the edges of the domain.

Examples
>>> import usencrypt as ue
>>> a = ue.encrypt(0.75)
>>> a_acos = ue.acos(a)
>>> a_acos
(0x7f843b02e610) Float: 0x5e9282db4ac25bcf2f07e16843b999f6fb350f15bef5ef769966feaf40fb954d
>>> ue.decrypt(a_acos)
0.7227342547848821