MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Primed Variables in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50707] Re: [mg50652] Primed Variables in Mathematica
  • From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
  • Date: Fri, 17 Sep 2004 01:17:24 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

>-----Original Message-----
>From: David Park [mailto:djmp at earthlink.net]
To: mathgroup at smc.vnet.net
>Sent: Wednesday, September 15, 2004 7:50 AM
>To: mathgroup at smc.vnet.net
>Subject: [mg50707] [mg50652] Primed Variables in Mathematica
>
>
>Primed variables are in such common use in textbooks and 
>papers that I don't understand why Mathematica doesn't allow them.
>
>Of course, x' represents a derivative, but there is a prime 
>character that can be obtained by esc ' esc or by \[Prime]. 
>
>x\[Prime] // Head
>Symbol
>
>But the problem is that the \[Prime] character is not raised 
>but sits at the same level as x. It would be much better if 
>the \[Prime] character were raised to the normal level to give 
>better looking expressions. I admit that there could be some 
>visual confusion, but not Mathematica confusion, with 
>derivatives, but it would usually be clear from context.
>
>I wish that WRI would fix the Prime, DoublePrime, ReversePrime 
>and ReverseDoublePrime characters so they displayed at the 
>correct vertical level in expressions.
>
>David Park
>djmp at earthlink.net
>http://home.earthlink.net/~djmp/ 
>
>
>

Dear David,

this seems to be one of the cases where parsing and semantic action on input (expression formation) come across.

If you use from the basic input palette...

Cell[BoxData[
    SuperscriptBox["\[Placeholder]", 
      "\[Placeholder]"]], "Input"]

...and insert a and Prime into the placeholders you get


In[10]:= \!\(a\^\[Prime]\)
Out[10]=  
\!\(\*
  SuperscriptBox["a", "\[Prime]",
    MultilineFunction->None]\)

In[11]:= % // FullForm
Out[11]//FullForm= Derivative[1][a]


But using b for Prime for the same placeholder gives

In[12]:= \!\(a\^b\)
Out[12]= \!\(a\^b\)

In[13]:= % // FullForm
Out[13]//FullForm= Power[a, b]



But for linear input the "substitution" is not being made

In[8]:= Power[a, \[Prime]]
Out[8]= \!\(a\^\[Prime]\)

In[9]:= % // FullForm
Out[9]//FullForm= Power[a, \[Prime]]



Perhaps you might use Superscript for your application

In[4]:= Superscript[a, b]
Out[4]= 
\!\(\*
  InterpretationBox[\(a\^b\),
    Superscript[ a, b],
    Editable->False]\)
In[5]:= % // FullForm
Out[5]//FullForm= Superscript[a, b]


In[6]:= Superscript[a, \[Prime]]
Out[6]= 
\!\(\*
  InterpretationBox[\(a\^\[Prime]\),
    Superscript[ a, \[Prime]],
    Editable->False]\)

In[7]:= % // FullForm
Out[7]//FullForm= Superscript[a, \[Prime]]

Where the behavior is uniform 
(Perhaps create a palette for that. This may have to be symbolized, though, for your application in mind.)


But I fully agree with your quest.

--
Hartmut


  • Prev by Date: Re: Primed Variables in Mathematica
  • Next by Date: Re: Re: Package and options, subroutines Mathematica programming 3GL function procedure
  • Previous by thread: Re: Primed Variables in Mathematica
  • Next by thread: anyone else have same problems? partition grahics