Re: Unprotecting "I"
- To: mathgroup at smc.vnet.net
- Subject: [mg64829] Re: Unprotecting "I"
- From: Chris Young <c1572young at earthlink.net>
- Date: Sun, 5 Mar 2006 03:18:47 -0500 (EST)
- References: <du83rr$t12$1@smc.vnet.net> <dubisu$gbn$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Thanks very much, I would never have guessed this.
On 2006-03-04 03:25:02 -0500, ted.ersek at tqci.net said:
> 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