Replace All and underscore in Mathematica

From: symbio (symbio_at_h0tmail.com)
Date: 10/10/04


Date: Sun, 10 Oct 2004 05:27:54 GMT

I am facing 2 problems with Mathematica:
 1st problem)
With replace all command, when I use it with subscripts I get an unintended
effect, this is what I do:
E * (Eo) /. E -> (Eo)
I intend to replace only E with Eo, but Mathematica instead replaces all E's
with (Eo) and I get this instead:
(Eo) * (Eo)o
Please note the 'o' in Eo is supposed to be a subscript here and reads Enot.
Can anyone please help?
here is the Mathematica code:

In[1]:=
\!\(E\ *\ E\_0\ /. \ E -> \ E\_0\)
Out[1]=
\!\(\[ExponentialE]\_0\ \((\[ExponentialE]\_0)\)\_0\)

2nd problem)
I like to use descriptive names for my variables with Underscore to separate
the names, it's really easier to read, but of course underscore is a special
character in Mathematica unfortunately, so is there an alternative?? For
example, I like to use variable Dynamic_Energy_of_Stars_With_Sand = 123; Is
there something else equally as obvious as Underscore that maybe used for
purpose of separting words in a variables names??

Thanks a lot for your help



Relevant Pages

  • two Mathematica questions
    ... With replace all command, when I use it with subscripts I get an unintended ... I intend to replace only E with Eo, but Mathematica instead replaces all E's ... I like to use descriptive names for my variables with Underscore to separate ...
    (sci.math)
  • Re: two Mathematica questions
    ... On 10 Oct 2004, symbio wrote: ... when I use it with subscripts I get an unintended ... >I intend to replace only E with Eo, but Mathematica instead replaces all E's ... >I like to use descriptive names for my variables with Underscore to separate ...
    (sci.math)
  • Re: [Mathematica 5.1] bug report. ArrayPlot[] locks system when fed bad inpput
    ... > I posted earlier about a problem I had where Mathematica 5.1 would ... > a warning in any one command. ... > Right now if one has many commands in one cell, ... could avoid some trouble. ...
    (sci.math.symbolic)
  • Re: Reassigning Commands Should NOT Be Allowed
    ... command. ... Mathematica solved this problem very easily. ... anything that starts with Uppercase letter is/will be used by Mathematica. ... It is too late to do anything with Matlab now, just be careful when you name ...
    (comp.soft-sys.matlab)
  • Re: mathematica question; anybody knows how to obtain a direct product of two sets in mathematica?
    ... In Mathematica, the "Outer" command sounds like what you need... ... Not sure, but for your "direct product" question, change List to Times. ... HTH ...
    (sci.math)