Complex.Log 方法

定义

返回一个复数的对数。Returns the logarithm of a complex number.

重载

Log(Complex)

返回指定复数的自然对数(底为 e)。Returns the natural (base e) logarithm of a specified complex number.

Log(Complex, Double)

返回指定复数在使用指定底时的对数。Returns the logarithm of a specified complex number in a specified base.

Log(Complex)

返回指定复数的自然对数(底为 e)。Returns the natural (base e) logarithm of a specified complex number.

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

参数

value
Complex

一个复数。A complex number.

返回

e 的自然对数(底为 value)。The natural (base e) logarithm of value.

示例

下面的示例演示 Log 方法。The following example illustrates the Log method. 其中显示,由于缺少 Double 数据类型的精度,将 Log 方法返回的值传递到 Exp 方法会返回原始 Complex 值。It shows that, with some allowance for the lack of precision of the Double data type, passing the value returned by the Log method to the Exp method returns the original Complex value.

using System;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      Complex[] values = { new Complex(1.53, 9.26), 
                           new Complex(2.53, -8.12),
                           new Complex(-2.81, 5.32),
                           new Complex(-1.09, -3.43),
                           new Complex(Double.MinValue/2, Double.MinValue/2) };
      foreach (Complex value in values)
         Console.WriteLine("Exp(Log({0}) = {1}", value, 
                           Complex.Exp(Complex.Log(value)));
   }
}
// The example displays the following output:
//       Exp(Log((1.53, 9.26)) = (1.53, 9.26)
//       Exp(Log((2.53, -8.12)) = (2.53, -8.12)
//       Exp(Log((-2.81, 5.32)) = (-2.81, 5.32)
//       Exp(Log((-1.09, -3.43)) = (-1.09, -3.43)
//       Exp(Log((-8.98846567431158E+307, -8.98846567431158E+307)) = (-8.98846567431161E+307, -8.98846567431161E+307)
Imports System.Numerics

Module Example
   Public Sub Main()
      Dim values() As Complex = { New Complex(1.53, 9.26), 
                                  New Complex(2.53, -8.12),
                                  New Complex(-2.81, 5.32),
                                  New Complex(-1.09, -3.43),
                                  New Complex(Double.MinValue/2, Double.MinValue/2) }
      For Each value As Complex In values
         Console.WriteLine("Exp(Log({0}) = {1}", value, 
                           Complex.Exp(Complex.Log(value)))
      Next                                  
   End Sub
End Module
' The example displays the following output:
'      Exp(Log((1.53, 9.26)) = (1.53, 9.26)
'      Exp(Log((2.53, -8.12)) = (2.53, -8.12)
'      Exp(Log((-2.81, 5.32)) = (-2.81, 5.32)
'      Exp(Log((-1.09, -3.43)) = (-1.09, -3.43)
'      Exp(Log((-8.98846567431158E+307, -8.98846567431158E+307)) = (-8.98846567431161E+307, -8.98846567431161E+307)

注解

复数的 Log(Complex) 方法对应于实数的 Math.Log(Double) 方法。The Log(Complex) method for complex numbers corresponds to the Math.Log(Double) method for real numbers.

另请参阅

Log(Complex, Double)

返回指定复数在使用指定底时的对数。Returns the logarithm of a specified complex number in a specified base.

public:
 static System::Numerics::Complex Log(System::Numerics::Complex value, double baseValue);
public static System.Numerics.Complex Log (System.Numerics.Complex value, double baseValue);
static member Log : System.Numerics.Complex * double -> System.Numerics.Complex
Public Shared Function Log (value As Complex, baseValue As Double) As Complex

参数

value
Complex

一个复数。A complex number.

baseValue
Double

对数的底数。The base of the logarithm.

返回

value 的对数(底为 baseValue)。The logarithm of value in base baseValue.

注解

复数的 Log(Complex, Double) 方法对应于实数的 Math.Log(Double, Double) 方法。The Log(Complex, Double) method for complex numbers corresponds to the Math.Log(Double, Double) method for real numbers.

适用于