Tim Lahey wrote: > > On Dec 2, 2008, at 10:14 PM, Jason Grout wrote: > >> >> Tim Lahey wrote: >>> Hi, >>> >>> The discussion of imaginary numbers reminded me of a >>> question I've had for some time. Is there a way to set >>> what's used for the imaginary unit? I often set it to >>> _j in Maple and I was wondering if there was any way to >>> do it in Sage. >> >> >> Do you mean the variable that you use, or just how it is printed? >> >> If it's the variable that you use, then you can just set it using normal >> assignment: >> >> sage: i = CC(I) >> >> Now i is the CC i instead of the symbolic i. > > Well, both actually. I'd prefer to use _j instead and have it > printed as that, because I'd like to use i (and I) for something > else.
I imagine that you could just change the _repr_ function in the symbolic constant: sage: I._repr_?? Type: instancemethod Base Class: <type 'instancemethod'> String Form: <bound method I_class._repr_ of I> Namespace: Interactive File: /home/grout/sage/local/lib/python2.5/site-packages/sage/functions/constants.py Definition: I._repr_(self, simplify=True) Source: def _repr_(self, simplify=True): """ EXAMPLES: sage: repr(I) 'I' """ return "I" Change that function to return "_j" if you want. sage: def complex_repr(simplify=True): ....: return "_j" ....: sage: I._repr_ = complex_repr sage: I _j sage: i^3 -1*_j Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---