Complex.FromPolarCoordinates(Double, Double) Método
Definição
Cria um número complexo de coordenadas polares de um ponto.Creates a complex number from a point's polar coordinates.
public:
static System::Numerics::Complex FromPolarCoordinates(double magnitude, double phase);
public static System.Numerics.Complex FromPolarCoordinates (double magnitude, double phase);
static member FromPolarCoordinates : double * double -> System.Numerics.Complex
Public Shared Function FromPolarCoordinates (magnitude As Double, phase As Double) As Complex
Parâmetros
- magnitude
- Double
A magnitude, que é a distância da origem (a interseção entre os eixos x e y) para o número.The magnitude, which is the distance from the origin (the intersection of the x-axis and the y-axis) to the number.
- phase
- Double
A fase, que é o ângulo da para o eixo horizontal, medido em radianos.The phase, which is the angle from the line to the horizontal axis, measured in radians.
Retornos
Um número complexo.A complex number.
Exemplos
O exemplo a seguir usa o FromPolarCoordinates método para criar uma instância de um número complexo com base em suas coordenadas polares e, em seguida, exibe o valor de suas Magnitude Phase Propriedades e.The following example uses the FromPolarCoordinates method to instantiate a complex number based on its polar coordinates and then displays the value of its Magnitude and Phase properties.
using System;
using System.Numerics;
public class Example
{
public static void Main()
{
Complex c1 = Complex.FromPolarCoordinates(10, 45 * Math.PI / 180);
Console.WriteLine("{0}:", c1);
Console.WriteLine(" Magnitude: {0}", Complex.Abs(c1));
Console.WriteLine(" Phase: {0} radians", c1.Phase);
Console.WriteLine(" Phase {0} degrees", c1.Phase * 180/Math.PI);
Console.WriteLine(" Atan(b/a): {0}", Math.Atan(c1.Imaginary/c1.Real));
}
}
// The example displays the following output:
// (7.07106781186548, 7.07106781186547):
// Magnitude: 10
// Phase: 0.785398163397448 radians
// Phase 45 degrees
// Atan(b/a): 0.785398163397448
Imports System.Numerics
Module Example
Public Sub Main()
Dim c1 As Complex = Complex.FromPolarCoordinates(10, 45 * Math.Pi / 180)
Console.WriteLine("{0}:", c1)
Console.WriteLine(" Magnitude: {0}", Complex.Abs(c1))
Console.WriteLine(" Phase: {0} radians", c1.Phase)
Console.WriteLine(" Phase {0} degrees", c1.Phase * 180/Math.Pi)
Console.WriteLine(" Atan(b/a): {0}", Math.Atan(c1.Imaginary/c1.Real))
End Sub
End Module
' The example displays the following output:
' (7.07106781186548, 7.07106781186547):
' Magnitude: 10
' Phase: 0.785398163397448 radians
' Phase 45 degrees
' Atan(b/a): 0.785398163397448
Comentários
O FromPolarCoordinates método instancia um número complexo com base em suas coordenadas polares.The FromPolarCoordinates method instantiates a complex number based on its polar coordinates.
Como há várias representações de um ponto em um plano complexo, o valor de retorno do FromPolarCoordinates método é normalizado.Because there are multiple representations of a point on a complex plane, the return value of the FromPolarCoordinates method is normalized. A magnitude é normalizada para um número positivo e a fase é normalizada para um valor no intervalo de- PI para PI .The magnitude is normalized to a positive number, and the phase is normalized to a value in the range of -PI to PI. Como resultado, os valores das Phase Magnitude Propriedades e do número complexo resultante podem não ser iguais aos valores originais dos magnitude phase parâmetros e.As a result, the values of the Phase and Magnitude properties of the resulting complex number may not equal the original values of the magnitude and phase parameters.
Para converter um valor de graus em radianos para o phase parâmetro, multiplique-o por Math.PI /180.To convert a value from degrees to radians for the phase parameter, multiply it by Math.PI/180.