Re: Unprotecting "I"
- To: mathgroup at smc.vnet.net
- Subject: [mg64817] Re: Unprotecting "I"
- From: ted.ersek at tqci.net
- Date: Sat, 4 Mar 2006 02:35:33 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
A user wanted to Unprotect the symbol I so they could use it for something
other than Sqrt[-1]. That can't be done because I has the Locked
attribute. Very few symbols have that attribute. This is only for the ones
WRI wants to make sure you don't change, but there is still a way to get
around it! Use the following:
In[1]:=
$PreRead=(#/."I"->"VariableI")&;
MakeBoxes[VariableI, form:(StandardForm|TraditionalForm) ]:="I"
I think you can then use I just like you use {x, y, t, ...}.
Just beware that this code will make it so that (I) and (VariableI)
are one and the same.
Then if you want to use the complex number type
[Esc]ii[Esc] (where [Esc] means press the Esc key.)
In the event you are using $PreRead for something else, you can probably
combine the my $PreRead code with yours.
I think it' possible to get the same result with MakeExpression
definitions instead of an assignment to $PreRead, but I had trouble
getting it to work.
Regards,
Ted Ersek