如何在 Python 中查詢複數的平方根?


你可以使用 cmath 庫在 Python 中查詢複數的平方根。Python 中的 cmath 庫是處理複數的庫。你可以按如下方式使用它來查詢平方根 −

示例

from cmath import sqrt

a = 0.2 + 0.5j
print(sqrt(a))

輸出

它會輸出 

(0.6076662244659689+0.4114100635092987j)

更新於:18-6-2020

491 次觀看

開啟你的 職業生涯

完成課程獲得認證

開始學習
廣告
© . All rights reserved.