7 min read
Calculus
Prerequisites: Solving equations
Derivatives
D[x^3 + Sin[x], x]
D[Sin[x]^2, x]
D[x^n, x]
D[x^2 y^3, x, y]
D[f[x] g[x], x]
3 x^2 + Cos[x]
2 Cos[x] Sin[x]
n x^(-1 + n)
6 x y^2
g[x] f'[x] + f[x] g'[x]
D[expr, x]differentiates with respect tox; several variables give mixed partial derivatives.- Undefined functions stay symbolic — the last line is the product rule.
For functions you define, ' works too:
h[x_] := x^3 - 3 x
h'[x]
Solve[h'[x] == 0, x]
-3 + 3 x^2
{{x -> -1}, {x -> 1}}
Integrals
Integrate[x^2, x]
Integrate[x^2, {x, 0, 3}]
Integrate[1/x, x]
Integrate[Exp[-x^2], {x, -Infinity, Infinity}]
NIntegrate[Sin[x^2], {x, 0, 1}]
x^3/3
9
Log[x]
Sqrt[Pi]
0.310268
- Indefinite integrals leave out the constant of integration.
{x, a, b}gives a definite integral;Infinityworks as a limit.NIntegratecomputes numerically — use it when no formula exists or you only need a number.
Limits, series, and sums
Limit[Sin[x]/x, x -> 0]
Limit[(1 + 1/n)^n, n -> Infinity]
Series[Exp[x], {x, 0, 4}]
Sum[1/n^2, {n, 1, Infinity}]
Sum[k^2, {k, 1, n}]
1
E
1 + x + x^2/2 + x^3/6 + x^4/24 + O[x]^5
Pi^2/6
1/6 n (1 + n) (1 + 2 n)
Series[f, {x, x0, n}]expands aroundx0up to ordern;O[x]^5marks the omitted terms.Normal[series]removes it.Sumfinds closed forms for many infinite and symbolic sums.
Vector calculus
Grad[x^2 + y^2, {x, y}]
Div[{x, y}, {x, y}]
{2 x, 2 y}
2
Practice
Find the area between y = x and y = x^2 from 0 to 1.
Show solution
Integrate[x - x^2, {x, 0, 1}]
1/6