Complex.FromPolarCoordinates(Double, Double) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
从点的极坐标创建复数。
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
参数
- magnitude
- Double
量值,它是从原点(x 轴与 y 轴的交点)到数字的距离。
- phase
- Double
相位,它是直线相对于水平轴的角度,以弧度为单位。
返回
一个复数。
示例
以下示例使用 FromPolarCoordinates 方法根据复数的极坐标实例化复数,然后显示其 Magnitude 和 Phase 属性的值。
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
open System
open System.Numerics
let c1 = Complex.FromPolarCoordinates(10., 45. * Math.PI / 180.)
printfn $"{c1}:"
printfn $" Magnitude: {Complex.Abs(c1)}"
printfn $" Phase: {c1.Phase} radians"
printfn $" Phase {c1.Phase * 180. / Math.PI} degrees"
printfn $" Atan(b/a): {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
注解
方法 FromPolarCoordinates 根据其极坐标实例化复数。
由于复杂平面上一个点有多个表示形式,因此方法的 FromPolarCoordinates 返回值被规范化。 数量级规范化为正数,相位规范化为 - 到 PI范围内的PI值。 因此,生成的复数的 Phase 和 Magnitude 属性的值可能不等于 和 phase
参数的原始值magnitude
。
若要将参数的值从度数转换为弧度 phase
,请将其 Math.PI乘以 /180。
适用于
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈