為什麼 Python 中的複數形式是 (a + bj) 而不是 (a + bi) ?
01-13
好了,我睡不著無聊,剛才查了一下。
Imaginary Unit的不同表示,wiki: http://en.wikipedia.org/wiki/Imaginary_unit#Alternative_notations用i還是j,這個問題曾經在Python的Bug Issue裡面出現討論過: http://bugs.python.org/issue10562
其中Bo?tjan Mejak指出,在電氣工程里,虛部用j表示而不是i,是為了區別於電流隨時間變化的函數,這個函數通常寫為i(t)。 (我不是學電氣的)另一個重要的回復來自Nick Coghlan (核心開發者之一) :
While this thread was amusing to read, *changing* Python from the engineering notation to mathematical notation for imaginary numbers is not going to happen. "i" has ambiguity problems relative to "1" and "l" in too many fonts - "j", on the other hand, almost always uses a visually distinct glyph. And whether "i" or "j" seems more natural to you will depend on whether or not you have an electrical engineering background (as noted earlier in the thread, "i" refers to current in electrical engineering). If you care about the precise formatting of a complex number, write your own formatting function rather than relying on the exact format produced by "repr(num)". Having an alternate constructor for complex objects that was more forgiving about "i" vs "j" also doesn"t offer a huge benefit over the simple "x = complex(arg.replace("i", "j")". So while I have some sympathy for mathematicians that are frustrated by having to train their fingers to hit "j" instead of "i", that"s not a good enough reason to change the language syntax or the behaviour of the complex() builtin. (See also http://www.boredomandlaziness.org/2011/02/status-quo-wins-stalemate.html)我覺得最後的鏈接文章status quo wins stalemate解釋一切了:已成定局。
另外數學家之所以更習慣用i,可能是因為j在別的語境下表示與i不同的意義,參考wiki: Bicomplex http://en.wikipedia.org/wiki/Tessarine 雙複數wiki: Split-Complex http://en.wikipedia.org/wiki/Split-complex_number 雙曲複數工程上大多時候用j表示虛數,科學上用i
高中學複數是用i,當時我就奇怪為什麼不用 j,k... 。現在如願了。
推薦閱讀:
※py交易的梗是怎麼出現的?
※我用flask-sqlalchemy為什麼無法更新我的sqlite文件?
※Python 中 a+=b 和 a=a+b 的區別有哪些?
※現在哪些編程技術比較火爆。需求量很大且待遇看漲?
※你用 Python 做過什麼有趣的數據挖掘/分析項目?
TAG:Python |