次の方法で共有


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
    基本クラスは、メンバー関数でに発生すること累乗である複素数のパラメーターの型である整数型または複合型または数。

戻り値

指定したに指定された条件を発生させることによって取得される複素数。

解説

関数は、戻り値の型に効果的にどちらのオペランドに変換して、right強制的に変換された left を返します。

分岐の切り取りが負の実際の軸に沿ってあります。

使用例

// 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; 
}
  
  
  
  

必要条件

ヘッダー: <complex>

名前空間: std