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 a notebook, you can also give the two-dimensional input directly. Mathematica again interprets this as a power.
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:= x ^ y
Here the whole expression y+z is in the superscript.
In:= x ^ y + z
Pressing (Control-Space) takes you down from the superscript.
In:= x ^ y + 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:= \!\( x \^ y \)
With this input form, Mathematica automatically understands that the + z does not go in the superscript.
In:= \!\( x \^ y + 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.
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:= x _ y
Here is another way to enter y as a subscript.
In:= \!\( x \_ y \)
Ways to enter a built-up fraction directly from the keyboard.
This enters the built-up fraction .
In:= x / y
Here the whole y + z goes into the denominator.
In:= x / y + z
But pressing Control-Space takes you out of the denominator, so the + z does not appear in the denominator.
In:= x / y + z
Mathematica automatically interprets a built-up fraction as a division.
Here is another way to enter a built-up fraction.
In:= \!\( 8888 \/ 2222 \)
Ways to enter a square root directly from the keyboard.
This enters a square root.
In:= @ x + y
Control-Space takes you out of the square root.
In:= @ x + y
Here is a form without control characters.
In:= \!\( \@ x + y \)
And here is the usual one-dimensional Mathematica input that gives the same output expression.
In:= Sqrt[x] + y
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:= x ^ y % z
Here is another way to enter the same expression.
In:= x _ z % y
Special input forms that generate two-dimensional input with the Make 2D menu item.
You must preface the outermost \( with \!.
In:= \!\(a \/ b + \@ c \) + d
You can use \( and \) to indicate the grouping of elements in an expression without introducing explicit parentheses.
In:= \!\(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 overscripts to enter the limits of sums and products.
Creating underscripts and overscripts.