Complex.Reciprocal(Complex) 方法

定义

返回复数的乘法反数。

public:
 static System::Numerics::Complex Reciprocal(System::Numerics::Complex value);
public static System.Numerics.Complex Reciprocal (System.Numerics.Complex value);
static member Reciprocal : System.Numerics.Complex -> System.Numerics.Complex
Public Shared Function Reciprocal (value As Complex) As Complex

参数

value
Complex

复数。

返回

value的倒数。

示例

以下示例使用 Reciprocal 方法计算多个复数的对等值。 它还表明,将复数乘以复数的结果 Complex.One

using System;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      Complex[] values = { new Complex(1, 1),
                           new Complex(-1, 1),
                           new Complex(10, -1),
                           new Complex(3, 5) };
      foreach (Complex value in values)
      {
         Complex r1 = Complex.Reciprocal(value);
         Console.WriteLine("{0:N0} x {1:N2} = {2:N2}",
                           value, r1, value * r1);
      }
   }
}
// The example displays the following output:
//       (1, 1) x (0.50, -0.50) = (1.00, 0.00)
//       (-1, 1) x (-0.50, -0.50) = (1.00, 0.00)
//       (10, -1) x (0.10, 0.01) = (1.00, 0.00)
//       (3, 5) x (0.09, -0.15) = (1.00, 0.00)
open System.Numerics

let values =
    [ Complex(1., 1.); Complex(-1., 1.); Complex(10., -1.); Complex(3., 5.) ]

for value in values do
    let r1 = Complex.Reciprocal value
    printfn $"{value:N0} x {r1:N2} = {value * r1:N2}"
// The example displays the following output:
//       (1, 1) x (0.50, -0.50) = (1.00, 0.00)
//       (-1, 1) x (-0.50, -0.50) = (1.00, 0.00)
//       (10, -1) x (0.10, 0.01) = (1.00, 0.00)
//       (3, 5) x (0.09, -0.15) = (1.00, 0.00)
Imports System.Numerics

Module Example
   Public Sub Main()
      Dim values() As Complex = { New Complex(1, 1), 
                                  New Complex(-1, 1), 
                                  New Complex(10, -1),
                                  New Complex(3, 5) }
      For Each value As Complex In values         
         Dim r1 As Complex = Complex.Reciprocal(value)                   
         Console.WriteLine("{0:N0} x {1:N2} = {2:N2}", 
                           value, r1, value * r1)
      Next
   End Sub
End Module
' The example displays the following output:
'       (1, 1) x (0.50, -0.50) = (1.00, 0.00)
'       (-1, 1) x (-0.50, -0.50) = (1.00, 0.00)
'       (10, -1) x (0.10, 0.01) = (1.00, 0.00)
'       (3, 5) x (0.09, -0.15) = (1.00, 0.00)

注解

数字 x 的倒数或乘数是一个数字 y,其中 x * y 生成 1。 复数的对数是当两个数字相乘时产生 Complex.One 复数的复数。 如果复数由 a + bi表示,则其倒数由以下表达式表示:

$\frac{a}{a^2 + b^2} + -\frac{b}{a^2 + b^2}$

如果值为 Complex.Zero,该方法将返回 Complex.Zero。 否则,它将返回表达式 Complex.One/value的结果。

适用于