Wolfram Research, Inc.

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]=

In a notebook, you can also give the two-dimensional input directly. Mathematica again interprets this as a power.

In[2]:=

Out[2]=

One way to enter a two-dimensional form such as 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.

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 .

In[3]:= x ^ y

Out[3]=

Here the whole expression y+z is in the superscript.

In[4]:= x ^ y + z

Out[4]=

Pressing (Control-Space) takes you down from the superscript.

In[5]:= x ^ y + z

Out[5]=

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]=

With this input form, Mathematica automatically understands that the + z does not go in the superscript.

In[7]:= \!\( x \^ y + z \)

Out[7]=

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.

Ways to enter a subscript directly from the keyboard.

Subscripts in Mathematica work very much like superscripts. However, whereas Mathematica automatically interprets as x raised to the power y, it has no similar interpretation for . Instead, it just treats as a purely symbolic object.

This enters y as a subscript.

In[8]:= x _ y

Out[8]=

Here is another way to enter y as a subscript.

In[9]:= \!\( x \_ y \)

Out[9]=

Ways to enter a built-up fraction directly from the keyboard.

This enters the built-up fraction .

In[10]:= x / y

Out[10]=

Here the whole y + z goes into the denominator.

In[11]:= x / y + z

Out[11]=

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]=

Mathematica automatically interprets a built-up fraction as a division.

In[13]:=

Out[13]=

Here is another way to enter a built-up fraction.

In[14]:= \!\( 8888 \/ 2222 \)

Out[14]=

Ways to enter a square root directly from the keyboard.

This enters a square root.

In[15]:= @ x + y

Out[15]=

Control-Space takes you out of the square root.

In[16]:= @ x + y

Out[16]=

Here is a form without control characters.

In[17]:= \!\( \@ x + y \)

Out[17]=

And here is the usual one-dimensional Mathematica input that gives the same output expression.

In[18]:= Sqrt[x] + y

Out[18]=

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]=

Here is another way to enter the same expression.

In[20]:= x _ z % y

Out[20]=

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]=

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]=

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 overscripts to enter the limits of sums and products.

Creating underscripts and overscripts.