Mathematica:以极坐标形式显示复数
我想以三角函数形式显示复数。例如:
z = (-4)^(1/4);
我不确定该命令是什么,而且写起来很愚蠢:
我想,该命令是 ExpToTrig
,但解决方案不可能只是 1+i
(或者可以,但我误用了它?)。如何以三角函数形式显示复数。
编辑:
命令是 ExpToTrig
,它只是没有给出所有解决方案(或者我无法找出如何解决)。终于通过编写纯函数 NrootZpolar[n][z]
解决了我的问题:
NrootZpolar :=
Function[x,
Function[y,
( Abs[y] ^ (1/x) *
( Cos[((Arg[y] + 360° * Range[0, x - 1]) / x)] +
I*Sin[((Arg[y] + 360° * Range[0, x - 1]) / x)]))
]
]
并使用:
In[689]:= FullSimplify[NrootZpolar1[4][-4]]
Out[689]= {1 + I, -1 + I, -1 - I, 1 - I}
可视化:
ComplexListPlot[list_] := ListPlot[Transpose[{Re[list], Im[list]}], AxesLabel -> {Re, Im}, PlotLabel -> list, PlotMarkers -> Automatic]
Manipulate[ComplexListPlot[FullSimplify[NrootZpolar1[n][z]]], {z, -10, 10}, {n, 1, 20}]
I want to display complex numbers in trig form. For example:
z = (-4)^(1/4);
I'm not sure what the command for that is, and its silly to write:
I thought, that the command was ExpToTrig
, but solution can't possibly be just 1+i
(Or can it, and I'm misusing it?). How do display complex number in trig form.
Edit:
Command is ExpToTrig
, it just does not give all the solutions (or i have failed to find out how). Finally solved my problem with writing a pure function NrootZpolar[n][z]
:
NrootZpolar :=
Function[x,
Function[y,
( Abs[y] ^ (1/x) *
( Cos[((Arg[y] + 360° * Range[0, x - 1]) / x)] +
I*Sin[((Arg[y] + 360° * Range[0, x - 1]) / x)]))
]
]
And use:
In[689]:= FullSimplify[NrootZpolar1[4][-4]]
Out[689]= {1 + I, -1 + I, -1 - I, 1 - I}
To visualize:
ComplexListPlot[list_] := ListPlot[Transpose[{Re[list], Im[list]}], AxesLabel -> {Re, Im}, PlotLabel -> list, PlotMarkers -> Automatic]
Manipulate[ComplexListPlot[FullSimplify[NrootZpolar1[n][z]]], {z, -10, 10}, {n, 1, 20}]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以用极坐标形式 r(cos theta + i sin theta) 表示复数 z,其中 r = Abs[z] 且 theta = Arg[z]。因此,您需要的唯一 Mathematica 命令是 Abs[] 和 Arg[]。
You can express a complex number z in polar form r(cos theta + i sin theta) where r = Abs[z] and theta = Arg[z]. So the only Mathematica commands you need are Abs[] and Arg[].
如果您只需要偶尔这样做,那么您可以定义一个类似的函数
,
以便扩展函数(不是您问题的一部分),您使用
最后,如果您总是希望以极坐标形式编写复数,则类似
将使转换自动进行
请注意,这仅适用于显式复数 - 即具有
FullForm
为Complex[a,b]
的数字。除非您对其使用类似Simpify
的内容,否则它将在上面定义的z
上失败。If you only need to do it occasionally, then you could just define a function like
so that
For expanding out functions (not that this was part of your question) you use
Finally, if you always want complex numbers written in polar form then something like
will make the conversion automatic
Note that this will only work on explicitly complex numbers -- ie those with the
FullForm
ofComplex[a,b]
. It will fail on thez
defined above unless you use something likeSimpify
on it.从数学上来说,(-1)^(1/4) 是对符号的滥用。没有这样的数字。
您使用该令人厌恶的内容(:))表达的是方程的根:
在 Mathematica 中(就像一般的数学一样)使用弧度比使用角度更方便。以弧度表示,您可以定义例如
或
根据您的符号偏好(三角或指数......但最后一个是首选)。
要获取所需的
(-4)^(1/5)
表达式,只需键入Mathematically speaking, (-1)^(1/4) is an abuse on notation. There is no such a number.
What you are expressing using that abomination ( :) ) are the roots of an equation:
In Mathematica (as in math in general) is more convenient to use radians than degrees. Expressed in radians, you may define for example
or
depending on your notation preference (trig or exponential ... but the last is preferred).
To get your desired expression for
(-4)^(1/5)
just type