我们在C++中介绍并讨论了复数中的概念。套装1
其余带有示例的功能在这里讨论:
- log() –用于返回复数的日志。
// CPP program to illustrate the use of log() #include
// for std::complex, std::log #include using namespace std; // driver program int main () { // initializing the complex: (-1.0+0.0i) complex mycomplex (-1.0, 0.0); // use of log() cout << "The log of " << mycomplex << " is " << log(mycomplex) < 输出:
The log of (-1,0) is (0,3.14159)
- cos() –计算一个复数值z的复余弦。余弦的数学定义是
cos z = (e^(iz) + e^(-iz))/2
- sin() –计算一个复数值z的复正弦值。余弦的数学定义是
sin z = (e^(iz) - e^(-iz))/2i
- tan() –计算复杂值z的复杂切线。切线的数学定义是
tan z = i(e^(-iz) - e^(iz)) / (e^(-iz) + e^iz)
// example to illustrate the use of sin(), cos() and tan() #include
// CPP program to illustrate // std::complex, std::cos, std::sin, std::tan #include using namespace std; // driver program int main () { // initializing the complex: (-1.0+0.0i) complex mycomplex (0.0, 1.0); // use of cos() cout << "The cos of " << mycomplex << " is " << cos(mycomplex) < 输出:
The cos of (0,1) is (1.54308,-0) The sin of (0,1) is (0,1.1752) The tan of (0,1) is (0,0.761594)
- cosh() –查找给定复合体的双曲余弦。双曲余弦的数学函数为:
cosh(z)=(e^z+e^(-z))/2
- sinh() –查找给定复数的双曲正弦值。双曲正弦的数学函数为:
sinh(z)=(e^z-e^(-z))/2.
- tanh() –查找给定复合体的双曲正切。双曲线tan的数学函数为:
tanh(z)=(e^(2z)-1)/(e^(2z)+1)
// CPP program to illustrate the // use of cosh(),sinh(),tanh() #include
#include // For std::complex #include using namespace std; // Driver program int main() { // behaves like real cosh, sinh, tanh along the real line; // z = a + 0i complex z(1, 0); cout << "cosh" << z << " = " << cosh(z) << " (cosh(1) = " << cosh(1) << ")"< z2(0, 1); cout << "cosh" << z2 << " = " << cosh(z2) << " ( cos(1) = " << cos(1) << ")"< 输出:
cosh(1.000000,0.000000) = (1.543081,0.000000) (cosh(1) = 1.543081) sinh(1.000000,0.000000) = (1.175201,0.000000) (sinh(1) = 1.175201) tanh(1.000000,0.000000) = (0.761594,0.000000) (tanh(1) = 0.761594) cosh(0.000000,1.000000) = (0.540302,0.000000) ( cos(1) = 0.540302) sinh(0.000000,1.000000) = (0.000000,0.841471) ( sin(1) = 0.841471) tanh(0.000000,1.000000) = (0.000000,1.557408) ( tan(1) = 1.557408)
要从最佳影片策划和实践问题去学习,检查了C++基础课程为基础,以先进的C++和C++ STL课程基础加上STL。要完成从学习语言到DS Algo等的更多准备工作,请参阅“完整面试准备课程” 。