I work with piecewise functions a lot in the courses I teach, and sometimes to do a quick reality check I would enter a piecewise function on Mathematica. Mathematica (the old version 5 I have) can do piecewise functions by declaring a function beginning with a replaceable parameter:
f[x_]:=
After this, I press <ESC>pw<ESC><CTRL+ENTER> and I get:
with four placeholders for math expressions and their restrictions, which can be added by pressing CTRL+ENTER. I can add more by pressing CTRL+ENTER again. If I want an exponent, I type the base, then CTRL+6 then my exponent. Mathematica 5 makes it only partially clear what keyboard shortcuts to use for math expressions so that you don’t have to go to the pallette each time, but they are there.
Also the hints are not always there if you glide your mouse on the palette, so you will need to look for “keyboard shortcuts” in the documentation.
Here is a table of some shortcuts you might frequently use:
Character | Keypress | Comments |
---|---|---|
x^{3} | Ctrl+6 | Superscript or exponent |
Ctrl+/ | Fraction | |
square root | Ctrl+2 | |
x_{3} | Ctrl+_ | Subscript |
Ctrl+Spacebar | Moves cursor out of a formula by 1 level | |
Ctrl+Enter | Adds another matrix row or creates a 2×2 if one does not exist | |
α | ESC+a+ESC | Greek alpha |
β | ESC+b+ESC | Greek beta |
π | ESC+pi+ESC | Greek pi |
∞ | ESC+\infty+ESC | One of many TEX-style ways of getting special characters |
Δ | ESC+D+ESC | Greek capital delta |