Skip to main content

oxilean_std/complex/
complex_acos_group.rs

1//! # Complex - acos_group Methods
2//!
3//! This module contains method implementations for `Complex`.
4//!
5//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
6
7use super::complex_type::Complex;
8
9impl Complex {
10    /// Inverse cosine: arccos(z) = -i * log(z + i*sqrt(1 - z^2)).
11    pub fn acos(self) -> Option<Self> {
12        let one = Self::one();
13        let z2 = self.mul(self);
14        let inner = one.sub(z2).sqrt();
15        let arg = self.add(Self::i().mul(inner));
16        let log = arg.log()?;
17        Some(Self::i().neg().mul(log))
18    }
19}