共用方式為


Complex.Log 方法

定義

傳回複數的對數。

多載

Log(Complex)

傳回指定複數的自然 (底數 e) 對數。

Log(Complex, Double)

傳回指定底數中指定複數的對數。

Log(Complex)

來源:
Complex.cs
來源:
Complex.cs
來源:
Complex.cs

傳回指定複數的自然 (底數 e) 對數。

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

複數。

傳回

value 的自然對數 (底數 e)。

範例

下列範例說明 Log 方法。 它顯示,由於缺少數據類型的有效 Double 位數,將方法所 Log 傳回的值傳遞至 Exp 方法會傳回原始 Complex 值。

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)
open System
open System.Numerics

let values =
    [ Complex(1.53, 9.26)
      Complex(2.53, -8.12)
      Complex(-2.81, 5.32)
      Complex(-1.09, -3.43)
      Complex(Double.MinValue / 2.0, Double.MinValue / 2.0) ]

for value in values do
    printfn $"Exp(Log({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)實數的方法。

另請參閱

適用於

Log(Complex, Double)

來源:
Complex.cs
來源:
Complex.cs
來源:
Complex.cs

傳回指定底數中指定複數的對數。

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

複數。

baseValue
Double

對數的底數。

傳回

底數 value 中的對數 baseValue

備註

Log(Complex, Double)複數的方法會對應至Math.Log(Double, Double)實數的方法。

適用於