a+bi vs a+bj, Mathematics vs. Engineering.

In Python (and many other programming languages), the use of “j” instead of “i” for representing the imaginary unit in complex numbers is a convention borrowed from electrical engineering and physics. Let me explain why:

  1. Historical Context:

    • The use of “j” for the imaginary unit dates back to the early days of electrical engineering and circuit analysis.
    • Engineers and scientists working with electrical circuits needed a way to distinguish between current (usually denoted by “I”) and the imaginary unit.
    • To avoid confusion, they adopted “j” to represent the square root of -1.
  2. Electrical Engineering and Physics:

    • In electrical engineering, complex numbers are commonly used to represent impedance, reactance, and other circuit parameters.
    • The use of “j” aligns with the standard notation used in these fields.
    • For example, the impedance of a resistor (purely real) is represented as

      RR

      , while the impedance of an inductor (with an imaginary component) is represented as

      j\omega LjωL

      , where

      \omegaω

      is the angular frequency and

      LL

      is the inductance.
  3. Mathematics vs. Engineering:

    • In mathematics, the imaginary unit is traditionally denoted by “i.”
    • However, in engineering and physics, “i” is often used to represent current.
    • To avoid ambiguity, Python (and other programming languages) adopted “j” to represent the imaginary unit.
  4. Python’s Choice:

    • Python follows the engineering convention and uses “j” for the imaginary unit.
    • When you create a complex number in Python, you use the format a + bj, where a and b are real numbers.
    • For example:
      • z = 3 + 2j represents the complex number

        3 + 2i3+2i

        .
      • z.real gives the real part (3).
      • z.imag gives the imaginary part (2).
  5. Compatibility and Consistency:

    • By using “j,” Python maintains compatibility with other programming languages and tools used in scientific and engineering domains.
    • Consistency across disciplines ensures that complex numbers can be seamlessly used in various contexts.

In summary, while mathematics traditionally uses “i” for the imaginary unit, Python (and other fields like electrical engineering) uses “j” to avoid confusion with other symbols. Both conventions are valid, but Python’s choice aligns with practical applications.

  • 21
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值