Complex.Addition Operator
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Lägger till ett angivet tal till ett annat angivet tal, där minst ett av dem är ett komplext tal, och det andra kan vara ett reellt tal med dubbel precision.
Överlagringar
| Name | Description |
|---|---|
| Addition(Complex, Complex) |
Lägger till två komplexa tal. |
| Addition(Complex, Double) |
Lägger till ett komplext tal till ett reellt tal med dubbel precision. |
| Addition(Double, Complex) |
Lägger till ett reellt tal med dubbel precision till ett komplext tal. |
Exempel
I följande exempel visas tillägg med komplexa tal:
using System;
using System.Numerics;
public class Example
{
public static void Main()
{
Complex[] values= { new Complex(12.3, -1.4),
new Complex(-6.2, 3.1),
new Complex(8.9, 1.5) };
foreach (var c1 in values)
foreach (var c2 in values)
Console.WriteLine("{0} + {1} = {2}", c1, c2, c1 + c2);
}
}
// The example displays the following output:
// (12.3, -1.4) + (12.3, -1.4) = (24.6, -2.8)
// (12.3, -1.4) + (-6.2, 3.1) = (6.1, 1.7)
// (12.3, -1.4) + (8.9, 1.5) = (21.2, 0.1)
// (-6.2, 3.1) + (12.3, -1.4) = (6.1, 1.7)
// (-6.2, 3.1) + (-6.2, 3.1) = (-12.4, 6.2)
// (-6.2, 3.1) + (8.9, 1.5) = (2.7, 4.6)
// (8.9, 1.5) + (12.3, -1.4) = (21.2, 0.1)
// (8.9, 1.5) + (-6.2, 3.1) = (2.7, 4.6)
// (8.9, 1.5) + (8.9, 1.5) = (17.8, 3)
open System.Numerics
let values = [ Complex(12.3, -1.4); Complex(-6.2, 3.1); Complex(8.9, 1.5) ]
for c1 in values do
for c2 in values do
printfn $"{c1} + {c2} = {c1 + c2}"
// The example displays the following output:
// (12.3, -1.4) + (12.3, -1.4) = (24.6, -2.8)
// (12.3, -1.4) + (-6.2, 3.1) = (6.1, 1.7)
// (12.3, -1.4) + (8.9, 1.5) = (21.2, 0.1)
// (-6.2, 3.1) + (12.3, -1.4) = (6.1, 1.7)
// (-6.2, 3.1) + (-6.2, 3.1) = (-12.4, 6.2)
// (-6.2, 3.1) + (8.9, 1.5) = (2.7, 4.6)
// (8.9, 1.5) + (12.3, -1.4) = (21.2, 0.1)
// (8.9, 1.5) + (-6.2, 3.1) = (2.7, 4.6)
// (8.9, 1.5) + (8.9, 1.5) = (17.8, 3)
Imports System.Numerics
Module modMain
Public Sub Main()
Dim values() As Complex = { New Complex(12.3, -1.4),
New Complex(-6.2, 3.1),
New Complex(8.9, 1.5) }
For Each c1 In values
For Each c2 In values
Console.WriteLine("{0} + {1} = {2}", c1, c2, c1 + c2)
Next
Next
End Sub
End Module
' The example displays the following output:
' (12.3, -1.4) + (12.3, -1.4) = (24.6, -2.8)
' (12.3, -1.4) + (-6.2, 3.1) = (6.1, 1.7)
' (12.3, -1.4) + (8.9, 1.5) = (21.2, 0.1)
' (-6.2, 3.1) + (12.3, -1.4) = (6.1, 1.7)
' (-6.2, 3.1) + (-6.2, 3.1) = (-12.4, 6.2)
' (-6.2, 3.1) + (8.9, 1.5) = (2.7, 4.6)
' (8.9, 1.5) + (12.3, -1.4) = (21.2, 0.1)
' (8.9, 1.5) + (-6.2, 3.1) = (2.7, 4.6)
' (8.9, 1.5) + (8.9, 1.5) = (17.8, 3)
Kommentarer
Operatorn Addition tillåter att du utför tilläggsåtgärder som omfattar komplexa tal. Den aktiverar kod, till exempel följande:
Complex c1 = new Complex(1.2, 2.3);
Complex c2 = new Complex(2.1, 3.2);
Complex c3 = c1 + c2;
let c1 = Complex(1.2, 2.3)
let c2 = Complex(2.1, 3.2)
let c3 = c1 + c2
Dim c1 As New Complex(1.2, 2.3)
Dim c2 As New Complex(2.1, 3.2)
Dim c3 As Complex = c1 + c2
Om tillägget resulterar i ett spill i antingen den verkliga eller imaginära komponenten är värdet för komponenten antingen Double.PositiveInfinity eller Double.NegativeInfinity.
Språk som inte stöder anpassade operatorer kan anropa Add motsvarande grupp med metoder i stället.
De Addition operatorer som tar emot en dubbel är effektivare än de operatorer som tar emot två komplexa tal.
Addition(Complex, Complex)
- Källa:
- Complex.cs
- Källa:
- Complex.cs
- Källa:
- Complex.cs
- Källa:
- Complex.cs
- Källa:
- Complex.cs
Lägger till två komplexa tal.
public:
static System::Numerics::Complex operator +(System::Numerics::Complex left, System::Numerics::Complex right);
public:
static System::Numerics::Complex operator +(System::Numerics::Complex left, System::Numerics::Complex right) = System::Numerics::IAdditionOperators<System::Numerics::Complex, System::Numerics::Complex, System::Numerics::Complex>::op_Addition;
public static System.Numerics.Complex operator +(System.Numerics.Complex left, System.Numerics.Complex right);
static member ( + ) : System.Numerics.Complex * System.Numerics.Complex -> System.Numerics.Complex
Public Shared Operator + (left As Complex, right As Complex) As Complex
Parametrar
- left
- Complex
Det första komplexa värdet som ska läggas till.
- right
- Complex
Det andra komplexa värdet som ska läggas till.
Returer
Summan av left och right.
Implementeringar
Kommentarer
Tillägget av ett komplext tal, a + bi, och ett andra komplext tal, c + di, har följande form:
$(a + c) + (b + d)i$
Språk som inte stöder anpassade operatorer kan anropa Complex.Add(Complex, Double) motsvarande metod i stället.
Se även
Gäller för
Addition(Complex, Double)
- Källa:
- Complex.cs
- Källa:
- Complex.cs
- Källa:
- Complex.cs
- Källa:
- Complex.cs
- Källa:
- Complex.cs
Lägger till ett komplext tal till ett reellt tal med dubbel precision.
public:
static System::Numerics::Complex operator +(System::Numerics::Complex left, double right);
public static System.Numerics.Complex operator +(System.Numerics.Complex left, double right);
static member ( + ) : System.Numerics.Complex * double -> System.Numerics.Complex
Public Shared Operator + (left As Complex, right As Double) As Complex
Parametrar
- left
- Complex
Det komplexa värde som ska läggas till.
- right
- Double
Det verkliga värdet med dubbel precision att lägga till.
Returer
Summan av left och right som ett komplext tal.
Kommentarer
Tillägget av ett komplext tal (a + bi) och ett verkligt tal (som kan betraktas som det komplexa talet c + 0i) har följande form:
$(a + c) + bi$
Språk som inte stöder anpassade operatorer kan anropa Complex.Add(Double, Complex) motsvarande metod i stället.
Se även
Gäller för
Addition(Double, Complex)
- Källa:
- Complex.cs
- Källa:
- Complex.cs
- Källa:
- Complex.cs
- Källa:
- Complex.cs
- Källa:
- Complex.cs
Lägger till ett reellt tal med dubbel precision till ett komplext tal.
public:
static System::Numerics::Complex operator +(double left, System::Numerics::Complex right);
public static System.Numerics.Complex operator +(double left, System.Numerics.Complex right);
static member ( + ) : double * System.Numerics.Complex -> System.Numerics.Complex
Public Shared Operator + (left As Double, right As Complex) As Complex
Parametrar
- left
- Double
Det verkliga värdet med dubbel precision att lägga till.
- right
- Complex
Det komplexa värde som ska läggas till.
Returer
Summan av left och right som ett komplext tal.
Kommentarer
Tillägget av ett verkligt tal (som kan betraktas som det komplexa talet a + 0i) och ett komplext tal (c + di) har följande form:
$(a + c) + di$
Språk som inte stöder anpassade operatorer kan anropa Complex.Add(Double, Complex) motsvarande metod i stället.