6

I would like to use the I as a symbol for the electrical current. How can I redefine it, so it is not interpreted as the imaginary unity?

6

I would like to use the I as a symbol for the electrical current. How can I redefine it, so it is not interpreted as the imaginary unity?

20

The short answer is *don't do it*. Really, it's just not a good idea. You can use other symbols, such as `\[CapitalIota]`

which looks almost exactly like `I`

and is entered with `Esc``I`

`Esc`.

If you're really determined you could substitute symbols using `$PreRead`

and `MakeBoxes`

but again I don't recommend it. For example:

```
MakeBoxes[I, _] := "\[ImaginaryJ]"
MakeBoxes[currentI, _] := "I"
$PreRead = # /. {"I" -> "currentI", "j" -> "I"} &;
```

I understand your recomandation Oleksandr, but what sense does it make for Mathematica to permit using j as imaginary unity (typical in electrotechnics), if I is still reserved (so not accessible to symbolise currents)? Consequently using j as imaginary unity, should permit to use I as current – Diegos – 2013-01-11T13:57:59.580

@Diegos *Mathematica* isn't set up to make those kinds of changes, perhaps unfortunately. In the long run you will almost certainly want to find alternatives to what you are describing. – Mr.Wizard – 2013-01-11T13:59:41.263

1Thank you anyways, I will use capital iota in this case. But it would certainly be an improvement, if in a future time one could replace predefined symbols for one's own computations: something like a "local redefinition bracket". – Diegos – 2013-01-11T14:09:20.457

@Diegos I added an example to my answer that may interest you. When you say "local redefinition bracket" do you mean something like Leonid used here? That is possible.

– Mr.Wizard – 2013-01-11T14:14:40.010
I thought you guys used J or j? – cormullion – 2013-01-11T13:47:06.600

13I would strongly recommend against doing so since complex numbers are fundamental in

Mathematica. Instead, you should use some other symbol, which you can easily make print as "I" if you so wish. – Oleksandr R. – 2013-01-11T13:49:21.137Yes, we use j for the imaginary unit, and i and I for currents. But if I use I for a current, mathematica interprets it as the imaginary unity. So, how can I get Mathematica to interpret I as my own symbol instead of the imaginary Unit? – Diegos – 2013-01-11T13:54:23.990

1@Diegos Do you find using

`\[CapitalIota]`

unacceptable? If youreallywant to use raw`I`

I'll show you how, but using it is against my better judgement. – Mr.Wizard – 2013-01-11T13:55:38.353Thank you, I will use capital iota – Diegos – 2013-01-11T14:17:35.747

Mathematica is a programming language, and therefore it has constraints on the notation you can use. It is much more flexible in this regard than other languages, but it still has a precise syntax that you need to follow. You'll have to adapt to it instead of trying to force it to adapt to you, otherwise you're just asking for trouble. – Szabolcs – 2013-04-13T16:48:26.523

I would do it like this:

`Module[{I}, (*Stuff with I*) ]`

. – swish – 2013-04-13T23:23:58.560