若要檢視英文版的文章,請選取 [原文] 核取方塊。您也可以將滑鼠指標移到文字上,即可在快顯視窗顯示英文原文。
譯文
原文

pow

 

評估引發取得複數要傳遞至另一個複數的強大功能的基礎。


      template<class Type>
   complex<Type> pow(
      const complex<Type>& _Base, 
      int _Power
   );
template<class Type>
   complex<Type> pow(
      const complex<Type>& _Base,
      const Type& _Power
   );
template<class Type>
   complex<Type> pow(
      const complex<Type>& _Base,
      const complex<Type>& _Power
   );
template<class Type>
   complex<Type> pow(
      const Type& _Base,
      const complex<Type>& _Power
   );

_Base

是複數的參數型別是會引發基底提升為由成員函式的複數或數字。

_Power

是複數的參數型別是二的次方整數或複數或數字基底要引發至成員函式。

取得引發事件的複數指定基底至指定的乘冪數。

每個函式有效地轉換為兩個運算元為傳回型別,然後傳回已轉換的 left 提升為 right

分支剪下是沿著負數真正的座標軸。

// complex_pow.cpp
// compile with: /EHsc
#include <complex>
#include <iostream>

int main( )
{
   using namespace std;
   double pi = 3.14159265359;

   // First member function
   // type complex<double> base & type integer power
   complex <double> cb1 ( 3 , 4);
   int cp1 = 2;
   complex <double> ce1 = pow ( cb1 ,cp1 );

   cout << "Complex number for base cb1 = " << cb1 << endl;
   cout << "Integer for power = " << cp1 << endl;
   cout << "Complex number returned from complex base and integer power:"
        << "\n ce1 = cb1 ^ cp1 = " << ce1 << endl;
   double absce1 = abs ( ce1 );
   double argce1 = arg ( ce1 );
   cout << "The modulus of ce1 is: " << absce1 << endl;
   cout << "The argument of ce1 is: "<< argce1 << " radians, which is " 
        << argce1 * 180 / pi << " degrees." << endl << endl; 

   // Second member function
   // type complex<double> base & type double power
   complex <double> cb2 ( 3 , 4 );
   double cp2 = pi;
   complex <double> ce2 = pow ( cb2 ,cp2 );

   cout << "Complex number for base cb2 = " << cb2 << endl;
   cout << "Type double for power cp2 = pi = " << cp2 << endl;
   cout << "Complex number returned from complex base and double power:"
        << "\n ce2 = cb2 ^ cp2 = " << ce2 << endl;
   double absce2 = abs ( ce2 );
   double argce2 = arg ( ce2 );
   cout << "The modulus of ce2 is: " << absce2 << endl;
   cout << "The argument of ce2 is: "<< argce2 << " radians, which is " 
        << argce2 * 180 / pi << " degrees." << endl << endl;

   // Third member function
   // type complex<double> base & type complex<double> power
   complex <double> cb3 ( 3 , 4 );
   complex <double> cp3 ( -2 , 1 );
   complex <double> ce3 = pow ( cb3 ,cp3 );

   cout << "Complex number for base cb3 = " << cb3 << endl;
   cout << "Complex number for power cp3= " << cp3 << endl;
   cout << "Complex number returned from complex base and complex power:"
        << "\n ce3 = cb3 ^ cp3 = " << ce3 << endl;
   double absce3 = abs ( ce3 );
   double argce3 = arg ( ce3 );
   cout << "The modulus of ce3 is: " << absce3 << endl;
   cout << "The argument of ce3 is: "<< argce3 << " radians, which is " 
        << argce3 * 180 / pi << " degrees." << endl << endl; 

   // Fourth member function
   // type double base & type complex<double> power
   double cb4 = pi;
   complex <double> cp4 ( 2 , -1 );
   complex <double> ce4 = pow ( cb4 ,cp4 );

   cout << "Type double for base cb4 = pi = " << cb4 << endl;
   cout << "Complex number for power cp4 = " << cp4 << endl;
   cout << "Complex number returned from double base and complex power:"
        << "\n ce4 = cb4 ^ cp4 = " << ce4 << endl;
   double absce4 = abs ( ce4 );
   double argce4 = arg ( ce4 );
   cout << "The modulus of ce4 is: " << absce4 << endl;
   cout << "The argument of ce4 is: "<< argce4 << " radians, which is " 
        << argce4 * 180 / pi << " degrees." << endl << endl; 
}
基底的複數 cb1 = (3,4)。
乘冪的整數 = 2
複數從複雜基底和整數次方傳回:
 ce1 = cb1 ^ cp1 = (- 7,24)
ce1 模數是:25
ce1 的引數是:1.85459 弧度,為 106.26 度。

基底的複數 cb2 = (3,4)。
輸入的兩 cp2 = = 3.14159 * pi 弧度。
複數從複雜基底和雙力量會傳回:
 ce2 = cb2 ^ cp2 = (152.915, 35.5475)
ce2 模數是:156.993
ce2 的引數是:2.91318 弧度,為 166.913 度。

基底的複數 cb3 = (3,4)。
cp3= 乘冪的複數 (- 2,1)
從複雜基本和複雜功能傳回複數:
 ce3 = cb3 ^ cp3 = (0.0153517, 0.00384077) -
ce3 模數是:0.0158249
ce3 的引數是:-0.245153 弧度,為 -14.0462 度。

輸入基底的雙 cb4 = = 3.14159 * pi 弧度。
乘冪的複數 cp4 = (2, 1) -
從雙基底和複雜功能傳回複數:
 ce4 = cb4 ^ cp4 = (4.07903, 8.98725) -
ce4 模數是:9.8696
ce4 的引數是:-1.14473 弧度,為 -65.5882 度。

需求

標題: <複雜>

命名空間: std

顯示: