Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Decoupling E and I
Replies: 7   Last Post: Jun 29, 2013 4:48 AM

 Messages: [ Previous | Next ]
 Nasser Abbasi Posts: 6,677 Registered: 2/7/05
Re: Decoupling E and I
Posted: Jun 25, 2013 2:51 AM

On 6/24/2013 2:53 AM, Dave Snead wrote:
> Hi,
>
> Anyone know of a way to decouple capital E and capital I
> from their exponential and imaginary uses
> so they can be used as ordinary user defined variables?
> I don't want to change the current use of Exp
> or the lower case double struck e and i however!
>
>
>

You can use ClearAttributes[E, Protected] but that
would not be the right way to do things.

Some other option is to use as variables CapitolEpsilon which
looks just like E and use CapitolIota which looks very much like I.

But I also do not like this solution, since when reading the code, one
has to look very hard to see that this is the official I vs. the
look-alike one.

Another solution if these are meant to be constants, is to use
a With:

In[3]:= With[{E = 2, I = 4}, E*I]
Out[3]= 8

Another option if they are variables, is to use a Module

-----------------------------
foo := Module[{E, I},
E = 2;
I = 4;
E*I
]

In[7]:= foo
Out[7]= 8
----------------------------

But I really think the best solution is to just accept that Mathematica
uses UpperCase for symbols and use lower case.

Small price to pay for having consistency in code, then your code
will be readable by others and less confusing.

--Nasser

Date Subject Author