# Mathematica

Mathematica’s documentation is quite decent, so there’s not really any point in providing additional reference material.

For a general reference guide on basic Mathematica functions, see here.

Syntax is probably the most important thing to understand about using Mathematica. From Mathematica documentation on syntax:

## Basic Syntax

f[x,y] — function arguments go in square brackets
Exp, Do, … — built-in symbols have names beginning with capital letters
{…} (List) ▪ “…” (String) ▪ e[[i]] (Part) ▪ e[[i;;j]] (Span)

## Basic Operations

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”)

## Mathematics & Operators

+ ▪ – ▪ * ▪ / ▪ ^ (Power) ▪ && (And) ▪ || (Or) ▪ ! (Not) ▪ <> (StringJoin)
a b c — spaces stand for multiplication
nn*^ee — scientific notation
b^^nnnn — number in a base

## Patterns

x_ — any expression (“x blank”)
x__, x___ — sequences of arbitrary expressions (“x double blank”, …)
_, __, ___ — unnamed patterns
x:p — pattern name
p:d — pattern default
.. (Repeated) ▪ | (Alternatives) ▪ /; (Condition) ▪ ? (PatternTest)

## Pure Functions

expr& — a pure function
#, #2, etc. — arguments in a pure function

## Short Forms

f@expr — prefix function application
expr//f — postfix function application (“slash slash”)
/@ (Map — “slash at”) ▪ @@, @@@ (Apply) ▪ ~~ (StringExpression) ▪ === (SameQ)

## Program Syntax

expr;expr;expr — sequence of commands (CompoundExpression)
<>file, >>>file for outputting to a file)
(* … *) — comment
ccc`nnn — symbol in context ccc

## Mathematica Session Syntax

% — most recent output (%n for output on line n)
?x — information on symbol