Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 5,647
Registered: 2/7/05
Re: Decoupling E and I
Posted: Jun 25, 2013 2:51 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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!
>
> Thanks in advance,
> Dave Snead
>
>


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







Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.