Compartir a través de


Complex.Pow Method (Complex, Double)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns a specified complex number raised to a power specified by a double-precision floating-point number.

Namespace:  System.Numerics
Assembly:  System.Numerics (in System.Numerics.dll)

Syntax

'Declaration
Public Shared Function Pow ( _
    value As Complex, _
    power As Double _
) As Complex
public static Complex Pow(
    Complex value,
    double power
)

Parameters

  • power
    Type: System.Double
    A double-precision floating-point number that specifies a power.

Return Value

Type: System.Numerics.Complex
The complex number value raised to the power power.

Remarks

If value is Complex.Zero, the method returns Complex.Zero. For other values, if power is 0, the method returns Complex.One, and if power is 1, it returns value.

This method corresponds to the Math.Pow method for primitive numeric types.

Examples

The following example illustrates exponentiation using a complex number and an exponent whose value ranges from -1 to 10.

Imports System.Numerics

Module Example
   Public Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
      Dim value As New Complex(12, -6)
      For power As Integer = -1 To 10
         outputBlock.Text += String.Format("{0} ^ {1,2} = {2:N2}", value, power,  
                           Complex.Pow(value, power)) + vbCrLf
      Next
   End Sub
End Module
' The example displays the following output:
'    (12, -6) ^ -1 = (0.07, 0.03)
'    (12, -6) ^  0 = (1.00, 0.00)
'    (12, -6) ^  1 = (12.00, -6.00)
'    (12, -6) ^  2 = (108.00, -144.00)
'    (12, -6) ^  3 = (432.00, -2,376.00)
'    (12, -6) ^  4 = (-9,072.00, -31,104.00)
'    (12, -6) ^  5 = (-295,488.00, -318,816.00)
'    (12, -6) ^  6 = (-5,458,752.00, -2,052,864.00)
'    (12, -6) ^  7 = (-77,822,208.00, 8,118,144.00)
'    (12, -6) ^  8 = (-885,157,632.00, 564,350,976.00)
'    (12, -6) ^  9 = (-7,235,785,728.00, 12,083,157,504.00)
'    (12, -6) ^ 10 = (-14,330,483,712.00, 188,412,604,416.00)
using System;
using System.Numerics;

public class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      Complex value = new Complex(12, -6);
      for (int power = -1; power <= 10; power++)
         outputBlock.Text += String.Format("{0} ^ {1,2} = {2:N2}", value, power,
                           Complex.Pow(value, power)) + "\n";
   }
}
// The example displays the following output:
//    (12, -6) ^ -1 = (0.07, 0.03)
//    (12, -6) ^  0 = (1.00, 0.00)
//    (12, -6) ^  1 = (12.00, -6.00)
//    (12, -6) ^  2 = (108.00, -144.00)
//    (12, -6) ^  3 = (432.00, -2,376.00)
//    (12, -6) ^  4 = (-9,072.00, -31,104.00)
//    (12, -6) ^  5 = (-295,488.00, -318,816.00)
//    (12, -6) ^  6 = (-5,458,752.00, -2,052,864.00)
//    (12, -6) ^  7 = (-77,822,208.00, 8,118,144.00)
//    (12, -6) ^  8 = (-885,157,632.00, 564,350,976.00)
//    (12, -6) ^  9 = (-7,235,785,728.00, 12,083,157,504.00)
//    (12, -6) ^ 10 = (-14,330,483,712.00, 188,412,604,416.00)

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.