[英]Python coding on datatypes i.e. for complex number arithmetic
In Python -在 Python -
x3 = 23/2j
print(x3)
#output = -11.5j
and when什么时候
x3 = 23j/2
print(x3)
#output = 11.5j
whats the reason什么原因
see, value of j is sq-root of -1, and so value of j-square j^2 = -1看,j 的值是 -1 的平方根,所以 j 平方 j^2 的值 = -1
Multiple both numerator and denominator by j in first equation在第一个方程中将分子和分母都乘以 j
x3 = (23 * j)/ (2j * j)
=> x3 = 23j/(-2)
because j-square = -1 =>
x3 = 23j/(-2)
因为 j 方 = -1
=> x3 = -23j/2
=>
x3 = -23j/2
Suppose you have 23j/2 ie a complex number and if you want j in denominator, you can shift it to denominator but the condition is you have to place a negative sign as it is an imaginary number( For ex. 2+3j, here 2 is real and 3 is imaginary part of the equation. You can also write it as 2-3/j) so your number becomes -23/2j.假设你有 23j/2 即一个复数,如果你想要 j 作为分母,你可以把它移到分母,但条件是你必须放一个负号,因为它是一个虚数(例如 2+3j,这里2 是实数,3 是等式的虚数部分。你也可以把它写成 2-3/j),这样你的数就变成了 -23/2j。 I hope this will be helpful for you
我希望这对你有帮助
It's to do with syntax/representation of the complex part.这与复杂部分的语法/表示有关。 (ie the
#j
is one single unit) (即
#j
是一个单一的单位)
23/2j = 23/(2j) = -11.5j
and NOT (23/2)*j
. 23/2j = 23/(2j) = -11.5j
而不是(23/2)*j
。
23j/2 = (23j)/2 = 11.5j
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.