oxilean_std/complex/complex_cos_group.rs
1//! # Complex - cos_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 /// Complex cosine: cos(z) = (e^(iz) + e^(-iz)) / 2.
11 pub fn cos(self) -> Self {
12 let iz = Self::i().mul(self);
13 let e1 = iz.exp();
14 let e2 = iz.neg().exp();
15 e1.add(e2).scale(0.5)
16 }
17 /// Complex tangent: tan(z) = sin(z)/cos(z).
18 pub fn tan(self) -> Option<Self> {
19 self.sin().div(self.cos())
20 }
21}