Complex.Multiply 方法

定义

将指定数字乘以另一个指定数字,其中至少有一个是复数,另一个数字可以是双精度实数。

重载

Multiply(Double, Complex)

返回双精度实数和复数的乘积。

Multiply(Complex, Double)

返回复数和双精度实数的乘积。

Multiply(Complex, Complex)

返回两个复数的乘积。

示例

以下示例将复数数组中的每个元素乘以复数。

using System;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      Complex number1 = new Complex(8.3, 17.5);
      Complex[] numbers = { new Complex(1.4, 6.3),
                            new Complex(-2.7, 1.8),
                            new Complex(3.1, -2.1) };
      foreach (Complex number2 in numbers)
         Console.WriteLine("{0} x {1} = {2}", number1, number2,
                           Complex.Multiply(number1, number2));
   }
}
// The example displays the following output:
//       (8.3, 17.5) x (1.4, 6.3) = (-98.63, 76.79)
//       (8.3, 17.5) x (-2.7, 1.8) = (-53.91, -32.31)
//       (8.3, 17.5) x (3.1, -2.1) = (62.48, 36.82)
open System.Numerics

let number1 = Complex(8.3, 17.5)
let numbers = [ Complex(1.4, 6.3); Complex(-2.7, 1.8); Complex(3.1, -2.1) ]

for number2 in numbers do
    printfn $"{number1} x {number2} = {Complex.Multiply(number1, number2)}"
// The example displays the following output:
//       (8.3, 17.5) x (1.4, 6.3) = (-98.63, 76.79)
//       (8.3, 17.5) x (-2.7, 1.8) = (-53.91, -32.31)
//       (8.3, 17.5) x (3.1, -2.1) = (62.48, 36.82)
Imports System.Numerics

Module Example
   Public Sub Main()
      Dim number1 As New Complex(8.3, 17.5)
      Dim numbers() As Complex = { New Complex(1.4, 6.3), 
                                   New Complex(-2.7, 1.8), 
                                   New Complex(3.1, -2.1) }
      For Each number2 In numbers
         Console.WriteLine("{0} x {1} = {2}", number1, number2, 
                           Complex.Multiply(number1, number2))
      Next
   End Sub
End Module
' The example displays the following output:
'       (8.3, 17.5) x (1.4, 6.3) = (-98.63, 76.79)
'       (8.3, 17.5) x (-2.7, 1.8) = (-53.91, -32.31)
'       (8.3, 17.5) x (3.1, -2.1) = (62.48, 36.82)

注解

Multiply 方法允许执行涉及复数的乘法运算。

如果乘法导致真实或虚构分量溢出,则该分量的值是 Double.PositiveInfinityDouble.NegativeInfinity

Multiply 方法针对不支持自定义运算符的语言实现。 其行为与使用乘法运算符的乘法相同。

Multiply(Double, Complex)

Source:
Complex.cs
Source:
Complex.cs
Source:
Complex.cs

返回双精度实数和复数的乘积。

public:
 static System::Numerics::Complex Multiply(double left, System::Numerics::Complex right);
public static System.Numerics.Complex Multiply (double left, System.Numerics.Complex right);
static member Multiply : double * System.Numerics.Complex -> System.Numerics.Complex
Public Shared Function Multiply (left As Double, right As Complex) As Complex

参数

left
Double

要相乘的双精度实数。

right
Complex

要相乘的复数。

返回

leftright 参数的乘积。

注解

实数的乘法(可视为复数 a + 0i)和复数(c + di)采用以下形式:

$ac + adi$

另请参阅

适用于

Multiply(Complex, Double)

Source:
Complex.cs
Source:
Complex.cs
Source:
Complex.cs

返回复数和双精度实数的乘积。

public:
 static System::Numerics::Complex Multiply(System::Numerics::Complex left, double right);
public static System.Numerics.Complex Multiply (System.Numerics.Complex left, double right);
static member Multiply : System.Numerics.Complex * double -> System.Numerics.Complex
Public Shared Function Multiply (left As Complex, right As Double) As Complex

参数

left
Complex

要相乘的复数。

right
Double

要相乘的双精度实数。

返回

leftright 参数的乘积。

注解

复数(a + bi)和实数的乘法(可视为复数 c + 0i)采用以下形式:

$ac + bci$

另请参阅

适用于

Multiply(Complex, Complex)

Source:
Complex.cs
Source:
Complex.cs
Source:
Complex.cs

返回两个复数的乘积。

public:
 static System::Numerics::Complex Multiply(System::Numerics::Complex left, System::Numerics::Complex right);
public static System.Numerics.Complex Multiply (System.Numerics.Complex left, System.Numerics.Complex right);
static member Multiply : System.Numerics.Complex * System.Numerics.Complex -> System.Numerics.Complex
Public Shared Function Multiply (left As Complex, right As Complex) As Complex

参数

left
Complex

要相乘的第一个复数。

right
Complex

要相乘的第二个复数。

返回

leftright 参数的乘积。

注解

复数、a + bi和第二个复数 c + di乘法采用以下形式:

$(ac - bd) + (ad + bc)i$

另请参阅

适用于