cosh() cho số phức (trong <complex>) tính hyperbolic cosine của số phức, khác với cosh() thực (trong <cmath>).
Công thức toán học
cosh(z) = (e^z + e^(-z)) / 2
với z = a + bi là số phức.
Khai báo số phức
complex<double> name(real_part, imag_part);
Cần include <complex>.
Ví dụ
#include <iostream>
#include <complex>
using namespace std;
int main() {
complex<double> cno(1, 3); // 1 + 3i
cout << "cosh(1+3i) = " << cosh(cno) << endl;
return 0;
}
Kết quả
cosh(1+3i) = (-1.52764,0.165844)
Định dạng output: (real, imag).
Ví dụ khác
Input: complex(5, 5) → Output: (-27.0349, -3.85115)
Hàm liên quan
sinh(z): hyperbolic sinetanh(z): hyperbolic tangentcos(z),sin(z),tan(z): lượng giác phứcexp(z),log(z),sqrt(z): mũ, log, căn
Tất cả trong <complex>, namespace std.