Skip to content

Change 'j' for imaginary unit into an 'i' #54771

Closed

Description

@Retro
mannequin
BPO 10562
Nosy @malemburg, @gvanrossum, @ncoghlan, @merwok, @briancurtin, @ericsnowcurrently

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2011-11-21.19:26:59.297>
created_at = <Date 2010-11-28.15:19:14.854>
labels = ['interpreter-core', 'type-feature']
title = "Change 'j' for imaginary unit into an 'i'"
updated_at = <Date 2011-11-21.20:12:36.555>
user = 'https://bugs.python.org/Retro'

bugs.python.org fields:

activity = <Date 2011-11-21.20:12:36.555>
actor = 'gvanrossum'
assignee = 'none'
closed = True
closed_date = <Date 2011-11-21.19:26:59.297>
closer = 'brian.curtin'
components = ['Interpreter Core']
creation = <Date 2010-11-28.15:19:14.854>
creator = 'Retro'
dependencies = []
files = []
hgrepos = []
issue_num = 10562
keywords = []
message_count = 60.0
messages = ['122662', '122663', '122669', '122672', '122722', '122728', '122729', '122730', '122731', '122732', '122733', '122734', '123101', '123102', '123105', '123106', '123108', '123110', '123111', '123112', '123114', '123115', '123117', '123118', '123119', '123120', '123121', '123122', '123127', '123131', '123134', '123135', '123140', '123146', '123179', '123188', '123189', '123200', '123208', '123212', '123217', '123219', '123220', '123235', '123245', '123256', '123269', '123272', '123274', '123276', '123279', '123281', '148010', '148011', '148015', '148071', '148072', '148073', '148081', '148083']
nosy_count = 8.0
nosy_names = ['lemburg', 'gvanrossum', 'ncoghlan', 'lehmannro', 'eric.araujo', 'Retro', 'brian.curtin', 'eric.snow']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue10562'
versions = ['Python 3.3']

Activity

  1. Retro commented on Nov 28, 2010

    Retromannequin
    MannequinAuthor

    In Python, the letter 'j' denotes the imaginary unit. It would be great if we would follow mathematics in this regard and let the imaginary unit be denoted with an 'i'.

  2. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    type-featureA feature request or enhancement
    on Nov 28, 2010
  3. voidspace commented on Nov 28, 2010

    @voidspace
    Contributor

    We follow engineering which uses j.

    (I was about to close this as wontfix but Antoine is particularly keen that Mark deals with this issue...)

  4. mdickinson commented on Nov 28, 2010

    @mdickinson
    Member

    Glad to oblige. :-)

  5. mdickinson commented on Nov 28, 2010

    @mdickinson
    Member

    Just to add my own thoughts: 'j' for *a* (not *the* </pedantry>) square root of -1 has, as Michael points out, a history of use in engineering (particularly electrical engineering) and physics. Personally, I would have preferred 'i' to 'j' here, but changing it now would cause (IMO) gratuitous breakage. It really doesn't seem a big enough issue to be worth making a fuss about.

  6. Retro commented on Nov 28, 2010

    Retromannequin
    MannequinAuthor

    "The Python programming language also uses j to denote the imaginary unit.
    MATLAB associates both i and j with the imaginary unit."
    -Wikipedia<http://en.wikipedia.org/wiki/Imaginary_unit#Alternative_notations\>

    It would be a welcome feature in Python if the programming language would,
    like MATLAB, associate both i and j with the imaginary unit.

  7. abalkin commented on Nov 28, 2010

    @abalkin
    Member

    Why not allow complex('1i')?

    (Tongue in cheek: I am really looking for arguments against lax parsing in number builtins. See bpo-10557.)

  8. mdickinson commented on Nov 28, 2010

    @mdickinson
    Member

    It would be a welcome feature in Python if the programming language
    would, like MATLAB, associate both i and j with the imaginary unit.

    I suggest taking this to the python-ideas mailing list. A working patch might increase the idea's chances.

  9. mdickinson commented on Nov 28, 2010

    @mdickinson
    Member

    Why not allow complex('1i')?

    Indeed, if 4i were permitted as an imaginary literal, I'd expect to allow complex('3 + 4i') as well.

    (And possible just plain complex('i') too, since complex('j') is currently allowed. Grr.)

  10. abalkin commented on Nov 28, 2010

    @abalkin
    Member

    On Sun, Nov 28, 2010 at 3:58 PM, Mark Dickinson <report@bugs.python.org> wrote:
    ..

    I'd expect to allow complex('3 + 4i') as well.

    And with spaces surrounding '+' too.

  11. Retro commented on Nov 28, 2010

    Retromannequin
    MannequinAuthor

    It would be great if the feature of having both j and i would exist in the
    interpreter core, as well as the built-in function complex() to accept i.

  12. pitrou commented on Nov 28, 2010

    @pitrou
    Member

    There should be an environment variable to make the symbol settable.

    $ PYTHONIMAGINARYSYMBOL=i python -c "import cmath; print(cmath.sqrt(-1))"
    1i
  13. 42 remaining items

  14. Retro commented on Nov 20, 2011

    Retromannequin
    MannequinAuthor

    What's up with that now? Any interests in changing the imaginary unit from "j" to "i" ?

  15. Retro commented on Nov 20, 2011

    Retromannequin
    MannequinAuthor

    Come on, let's do this.

  16. reopened this on Nov 20, 2011
  17. ncoghlan commented on Nov 20, 2011

    @ncoghlan
    Contributor

    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)

  18. Retro commented on Nov 21, 2011

    Retromannequin
    MannequinAuthor

    It's stupid that the imaginary unit in Python is denoted by a "j" just for ambiguity reasons that "i" can be mistaken with a "1" or an "l". It's true that "1" and "l" can look the same in some fonts, but that is *certainly not true* for the small letter "i".

    Just fix the "j" into an "i" already.

  19. reopened this on Nov 21, 2011
  20. reopened this on Nov 21, 2011
  21. Retro commented on Nov 21, 2011

    Retromannequin
    MannequinAuthor

    Please fix this in Python 3.3 and don't forget to fix the complex() function/method as well.

  22. briancurtin commented on Nov 21, 2011

    @briancurtin
    Member

    Please stop re-opening this thread. The reasons it will not be fixed have been laid out.

  23. ericsnowcurrently commented on Nov 21, 2011

    @ericsnowcurrently
    Member

    @brian.curtin: +1

    @retro: as noted in bpo-10621, please take this to python-ideas@python.org

  24. gvanrossum commented on Nov 21, 2011

    @gvanrossum
    Member

    This will not be fixed. For one thing, the letter 'i' or upper case 'I' look too much like digits. The way numbers are parsed either by the language parser (in source code) or by the built-in functions (int, float, complex) should not be localizable or configurable in any way; that's asking for huge disappointments down the road. If you want to parse complex numbers using 'i' instead of 'j', you have plenty of solutions available already.

  25. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions