# Non-standard calculus

## Limit

$$\newcommand\fLim{\textsf{lim}}$$For a real function $$f : \mathbb{R} \to \mathbb{R}$$, $$\fLim_-~a~f$$ (the limit of $$f$$ as its input approaches $$a$$ from left) and $$\fLim_+~a~f$$ (the limit of $$f$$ as its input approaches $$a$$ from right) are: \newcommand\fSt{\textsf{st}} \newcommand\tVec{\textsf{Vec}} \newcommand\mbR{\mathbb{R}} \begin{align*} \fLim_-~a~f &= \fSt~(f~(a-\delta)) \\ \fLim_+~a~f &= \fSt~(f~(a+\delta)) \end{align*} where $$\delta$$ is the unit hyperreal infinitesimal. The limit of of $$f$$ as its input approaches $$a$$ exists and is equal to both limits iff both limits exist and are equal: $\frac{\fLim_-~a~f = b \qquad \fLim_+~a~f = b}{\fLim~a~f = b}.$

The limit as input grows unbounded positively is: $\newcommand\fLimgub{\textsf{limgub}} \fLimgub = \fLim_-~\omega$ where $$\omega$$ is the unit hypernatural infinite: $\delta \cdot \omega = 1.$

### Example

Find the limit of the following $$f$$ as $$x$$ approaches $$1$$ from the right: $f~x = \frac{x^2-1}{x-1}.$ First, we compute $$f~(x+\delta)$$ with $$x=1$$: \begin{align*} f~(1+\delta) &= \frac{(1+\delta)^2-1}{(1+\delta)-1} \\ &= \frac{1+2 \delta + \delta^2-1}{1+\delta-1} \\ &= \frac{2 \delta + \delta^2}{\delta} \\ &= 2+\delta. \end{align*} Then, we take the standard part: \begin{align*} \fLim_+~1~f &= \fSt~(f~(1+\delta)) \\ &= \fSt~(2+\delta) \\ &= 2. \end{align*}

## Derivative

The derivative of $$f$$ at $$x$$: $\newcommand\fDer{\textsf{der}} \fDer~f~x = \fSt \left( \frac{f~(x+\delta)-f~x}{\delta} \right).$

## Partial derivative

The partial derivative of vector-to-real function $$f$$ at $$x$$ with respect to the input component at index $$k$$ is: $\newcommand\fPd{\textsf{pd}} \\ \fPd~k~f~x = \fSt\left(\frac{f~(x+\delta \cdot e_k)-f~x}{\delta}\right)$ where $$e_k$$ is the vector whose element at index $$k$$ is one and others zero. The index begins at zero.

Partial derivation commutes in this way: $\fPd~m~(\fPd~n~f) = \fPd~n~(\fPd~m~f)$ which can also be written: $\fPd~m \circ \fPd~n = \fPd~n \circ \fPd~m.$

## Directional derivative

The directional derivative of a function $$f$$ along a vector $$d$$ generalizes the notion of partial derivative: \newcommand\fDd{\textsf{dd}} \begin{align*} \fDd~d~f~x &= \fSt\left(\frac{f~(x+\delta \cdot d) - f~x}{\delta}\right) \\ \fPd~k~f~x &= \fDd~e_k~f~x. \end{align*}

## Riemann integral

Let $$s = [a,b]$$ be a real line. Let $$\newcommand\fPart{\textsf{part}} \newcommand\fAint{\textsf{aint}} \newcommand\fInt{\textsf{int}} \newcommand\fSum{\textsf{sum}} \newcommand\fMap{\textsf{map}} \fPart~n~s$$ be the partitioning of $$s$$ into $$n$$ contiguous parts. Let $$\fAint~n~s~f$$ be the $$n$$-approximation of the integral of $$f$$ over $$s$$: $\fAint~n~s~f = \fSum~(\fMap~(\lambda~u.~f~(p~u)\cdot m~u)~(\fPart~n~s))$ where $$p~u$$ is any point in $$u$$ and $$m~u$$ is the measure of $$u$$. For simplicity, we can use the left point of $$u$$ as $$p~u$$, and we divide the parts into the same size. The Riemann integral is defined as: $\fInt = \fAint~\omega.$

## Other resources

Wikipedia has an article about non-standard calculus.