Mathematica Reference Guide
1.10 Input and Output in Notebooks
1.10.2 Entering Two-Dimensional Input
When Mathematica reads the text x^y, it interprets it as x raised to the power y.
In[1]:= x^y Out[1]= xy
In a notebook, you can also give the two-dimensional input xy directly. Mathematica again interprets this as a power.
In[2]:= xy Out[2]= xy
One way to enter a two-dimensional form such as xy into a Mathematica notebook is to copy this form from a palette by clicking the appropriate button in the palette.
Here is a palette for entering some common two-dimensional notations.
There are also several ways to enter two-dimensional forms directly from the keyboard.
x ‚Î ^Ï y ‚Î â Ï use control keys that exist on most keyboards x ‚Î 6Ï y ‚Î â Ï use control keys that should exist on all keyboards î !îH x î ^ y î L followed by Make 2D use only ordinary printable characters
Ways to enter a superscript directly from the keyboard. ‚ÎâÏ stands for Control-Space.
You type ‚Î^Ï by holding down the Control key, then hitting the ^ key. As soon as you do this, your cursor will jump to a superscript position. You can then type anything you want and it will appear in that position.
When you have finished, press ‚ÎâÏ to move back down from the superscript position. ‚ÎâÏ stands for Control-Space;
you type it by holding down the Control key, then pressing the space bar.
This sequence of keystrokes enters xy.
In[3]:= x ‚Î^Ï y Out[3]= xy
Here the whole expression y+z is in the superscript.
In[4]:= x ‚Î^Ï y + z Out[4]= xy+z
Pressing ‚ÎâÏ (Control-Space) takes you down from the superscript.
In[5]:= x ‚Î^Ï y ‚Î Ï + z Out[5]= xy+ z
You can remember the fact that ‚Î^Ï gives you a superscript by thinking of ‚Î^Ï as just a more immediate form of
^. When you type x^y, Mathematica will leave this one-dimensional form unchanged until you explicitly process it.
But if you type x ‚Î^Ï y then Mathematica will immediately give you a superscript.
On a standard English-language keyboard, the character ^ appears as the shifted version of 6. Mathematica therefore accepts ‚Î6Ï as an alternative to ‚Î^Ï. Note that if you are using something other than a standard English-language keyboard, Mathematica will almost always accept ‚Î6Ï but may not accept ‚Î^Ï.
This is an alternative input form that avoids the use of control characters.
In[6]:= \!\( x \^ y \) Out[6]= xy
With this input form, Mathematica automatically understands that the + z does not go in the superscript.
In[7]:= \!\( x \^ y + z \) Out[7]= xy+ z
Using control characters minimizes the number of keystrokes that you need to type in order to enter a superscript. But particularly if you want to save your input in a file, or send it to another program, it is often more convenient to use a form that does not involve control characters. You can do this using î! sequences.
If you copy a î! sequence into Mathematica, it will automatically jump into two-dimensional form. But if you enter the sequence directly from the keyboard, you explicitly need to choose the Make 2D menu item in order to get the two-dimensional form.
When entered from the keyboard î( … î) sequences are shown in literal form.
Choosing the Make 2D item in the Edit menu converts these sequences into two-dimensional forms.
x ‚Î _Ï y ‚Î â Ï use control keys that exist on most keyboards x ‚Î −Ï y ‚Î â Ï use control keys that should exist on all keyboards î !îH x î _ y î L followed by Make 2D use only ordinary printable characters
Ways to enter a subscript directly from the keyboard.
Subscripts in Mathematica work very much like superscripts. However, whereas Mathematica automatically interprets xy as x raised to the power y, it has no similar interpretation for xy. Instead, it just treats xy as a purely symbolic object.
This enters y as a subscript.
In[8]:= x ‚Î_Ï y Out[8]= xy
Here is another way to enter y as a subscript.
In[9]:= \!\( x \_ y \) Out[9]= xy
x ‚Î êÏ y ‚Î â Ï use control keys
î !îH x î ê y î L followed by Make 2D use only ordinary printable characters
Ways to enter a built-up fraction directly from the keyboard.
This enters the built-up fraction ÅÅÅÅxy. In[10]:= x ‚Î/Ï y
Out[10]= x y
Here the whole y + z goes into the denominator.
In[11]:= x ‚Î/Ï y + z Out[11]= x
y + z
But pressing Control-Space takes you out of the denominator, so the + z does not appear in the denominator.
In[12]:= x ‚Î/Ï y ‚Î Ï + z Out[12]= x
y + z
Mathematica automatically interprets a built-up fraction as a division.
In[13]:= 8888 2222 Out[13]= 4
Here is another way to enter a built-up fraction.
In[14]:= \!\( 8888 \/ 2222 \) Out[14]= 4
‚Î @Ï x ‚Î â Ï use control keys that exist on most keyboards
This enters a square root.
In[15]:= ‚Î@Ï x + y Out[15]= è!!!!!!!!!!!x + y
Control-Space takes you out of the square root.
In[16]:= ‚Î@Ï x ‚Î Ï + y Out[16]= è!!!x + y
Here is a form without control characters.
In[17]:= \!\( \@ x + y \) Out[17]= è!!!x + y
And here is the usual one-dimensional Mathematica input that gives the same output expression.
In[18]:= Sqrt[x] + y Out[18]= è!!!x + y
‚Î ^Ï or ‚Î 6Ï go to the superscript position
‚Î _Ï or ‚Î −Ï go to the subscript position
‚Î @Ï or ‚Î 2Ï go into a square root
‚Î %Ï or ‚Î 5Ï go from subscript to superscript or
vice versa, or to the exponent position in a root
‚Î êÏ go to the denominator for a fraction
‚Î â Ï return from a special positionHControl-SpaceL
Special input forms based on control characters. The second forms given should work on any keyboard.
This puts both a subscript and a superscript on x.
In[19]:= x ‚Î^Ï y ‚Î%Ï z Out[19]= xzy
Here is another way to enter the same expression.
In[20]:= x ‚Î_Ï z ‚Î%Ï y Out[20]= xzy
î !îH …î L all two-dimensional input and grouping within it x î ^ y superscript xy withinî !îH …î L
x î _ y subscript xy withinî !îH …î L
x î ^ y î % z subscript and superscript xzy withinî !îH …î L î @ x square root è!!!x within î !îH …î L
x î ê y built-up fraction ÅÅÅÅxy withinî !îH …î L
Special input forms that generate two-dimensional input with the Make 2D menu item.
You must preface the outermost î( with î!.
In[21]:= \!\(a \/ b + \@ c \) + d Out[21]= a
b + è!!!c + d
You can use î( and î) to indicate the grouping of elements in an expression without introducing explicit parentheses.
In[22]:= \!\(a \/ \( b + \@ c \) \) + d Out[22]= a
b + è!!!c + d
In addition to subscripts and superscripts, Mathematica also supports the notion of underscripts and overscripts—elements that go directly underneath or above. Among other things, you can use underscripts and over-scripts to enter the limits of sums and products.
x ‚Î +Ï y ‚Î â Ï or x ‚Î =Ï y ‚Î â Ï create an underscript x
y
î !îH x î + y î L followed by Make 2D create an underscript x
y
x ‚Î &Ï y ‚Î â Ï or x ‚Î 7Ï y ‚Î â Ï create an overscript xy î !îH x î & y î L followed by Make 2D create an overscript xy
Creating underscripts and overscripts.