use crate::complex::{Complex, Cmplx};
use crate::traits::One;
impl Complex::<f64> {
#[inline]
pub fn sinh(&self) -> Complex::<f64> {
Cmplx::new(self.real.sinh() * self.imag.cos(), self.real.cosh() * self.imag.sin())
}
#[inline]
pub fn cosh(&self) -> Complex::<f64> {
Cmplx::new(self.real.cosh() * self.imag.cos(), self.real.sinh() * self.imag.sin())
}
#[inline]
pub fn tanh(&self) -> Complex::<f64> {
self.sinh() / self.cosh()
}
#[inline]
pub fn sech(&self) -> Complex::<f64> {
Cmplx::one() / self.cosh()
}
#[inline]
pub fn csch(&self) -> Complex::<f64> {
Cmplx::one() / self.sinh()
}
#[inline]
pub fn coth(&self) -> Complex::<f64> {
Cmplx::one() / self.tanh()
}
#[inline]
pub fn asinh(&self) -> Complex::<f64> {
let z = self.clone();
( ( z * z + 1.0 ).sqrt() + z ).ln()
}
#[inline]
pub fn acosh(&self) -> Complex::<f64> {
let z = self.clone();
( ( z - 1.0 ).sqrt() * ( z + 1.0 ).sqrt() + z ).ln()
}
#[inline]
pub fn atanh(&self) -> Complex::<f64> {
let z = self.clone();
( ( z + 1.0 ).ln() - ( Cmplx::one() - z ).ln() ) * 0.5
}
#[inline]
pub fn asech(&self) -> Complex::<f64> {
let inv = Cmplx::one() / self.clone();
inv.acosh()
}
#[inline]
pub fn acsch(&self) -> Complex::<f64> {
let inv = Cmplx::one() / self.clone();
inv.asinh()
}
#[inline]
pub fn acoth(&self) -> Complex::<f64> {
let inv = Cmplx::one() / self.clone();
inv.atanh()
}
}