MathGroup Archive 2004

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

Search the Archive

Re: Primed Variables in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50712] Re: [mg50652] Primed Variables in Mathematica
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 17 Sep 2004 01:17:43 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Hartmut,

The point is: if I type

x'[z]

the quote character is positioned at the correct level. Of course, it has
its own syntactic meaning so we can't use it to represent primed variables.

If I type

x\[Prime]

I get a two character symbol but the \[Prime] sits on the floor, so to
speak, instead of being positioned at the correct level and thus defeating
easy access to nice looking primed variables.

What possible reason is there for this? The only reason I can think of is
that someone thought that these characters were to be inserted into a
SuperscriptBox and they didn't want them raised again. But is that ever
done? Are there many users, or any, that make primed variables that way?

I thought that Superscript was deprecated. So wouldn't it be much easier to
type

x esc ' esc    than

DisplayForm[SuperscriptBox[x, esc ' esc]]

especially considering that the first form is actually a Symbol and the
second form isn't.

I definitely think that a wrong choice was made here and it could be easily
corrected. If quote can be formatted correctly, so can \[Prime] and
\[DoublePrime].

I bet there are a lot of users who would like to have easy primed and double
primed variables as symbols.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


From: Wolf, Hartmut [mailto:Hartmut.Wolf at t-systems.com]
To: mathgroup at smc.vnet.net

>From: David Park [mailto:djmp at earthlink.net]
To: mathgroup at smc.vnet.net

>
>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: anyone else have same problems? partition grahics
  • Next by Date: Re: Primed Variables in Mathematica
  • Previous by thread: Re: Primed Variables in Mathematica
  • Next by thread: Re: Primed Variables in Mathematica