Mathematica has a rich syntax carefully designed for consistency and efficient, readable entry of
Mathematica's many language, mathematical, and other constructs. In addition to ordinary linear ASCII input,
Mathematica also supports full 2D mathematical input.
f[x,y] — function arguments go in square brackets
Exp,
Do,
... — built-in symbols have names beginning with capital letters
x=val — set a value (
=. to clear a value)
x==val — test equality, or represent a symbolic equation (
!= for unequal)
lhs:=rhs — function etc. definition
a->b,
a→b — rule for transformations, options, etc. (
:> for delayed rule)
expr/.rule — replace using a rule ("slash dot")
+ ▪ - ▪ * ▪ / ▪ ^ (
Power)
▪ && (
And)
▪ || (
Or)
▪ ! (
Not)
▪ <> (
StringJoin)
a b c — spaces stand for multiplication
nn*^ee — scientific notation
b^^nnnn — number in a base
x_ — any expression ("
x blank")
x__,
x___ — sequences of arbitrary expressions ("
x double blank", ...)
_,
__,
___ — unnamed patterns
#,
#2, etc. — arguments in a pure function
f@expr — prefix function application
expr//f — postfix function application ("slash slash")
<<file — input a file (
>>file,
>>>file for outputting to a file)
ccc`nnn — symbol in context
ccc
Mathematica Session Syntax
% — most recent output (
%n for output on line
n)
?x — information on symbol
