Unit 2a Function Types

Robert Batzinger
8 Jan 2019

Common functions

Type Examples
Math \( \min(x) \), \( \max(x) \), \( \hbox{abs}(x) \), \( \log(x) \), \( \sqrt{x} \)
Trig \( \sin(x) \), \( \cos(x) \), \( \tan(x) \)
String \( \hbox{length}(x) \), \( \hbox{upcase}(x) \), \( \hbox{reverse}(x) \), \( \hbox{chr}(x) \)
Logic \( \neg X \), \( |X| \), \( X\cap T \), \( X\cup T \)

Function

defines the relationship between the range and domain values

\[ \begin{eqnarray} x \in X_{range}, y \in Y_{domain}\\ \\ y = F(x)\\ \end{eqnarray} \]

Function example

Discrete function

plot of chunk unnamed-chunk-1

  • Range: \[ x \in \{0,1,2,3,\cdots,\infty\} \]

  • Domain \[ y \in \{0, 1\} \]

Continuous function

plot of chunk unnamed-chunk-2

  • Range: \[ 0 \le x\le \infty \]

  • Domain: \[ 0 \le y \le 1 \]

Key relationships

plot of chunk unnamed-chunk-3

plot of chunk unnamed-chunk-4

Injection

the function results of all members of range is a member of the domain

\[ \forall x \in X_{Range}, \exists y \in Y_{Domain}: y = F(x) \]

Surjection

every member of the domain was the result of the function applied to a member of the range

\[ \begin{eqnarray} \forall y \in Y_{Domain},\\ \ \exists x\in X_{Range}:\\ \ \ y = F(x)\\ \end{eqnarray} \]

Bijection

one to one correspondence between unique pairs of elements linking Range and Domain values

\[ \begin{eqnarray} \left(\forall y \in Y_{Domain}, \exists x\in X_{Range}\right) \cap\\ \left(\forall x \in X_{Range}, \exists y\in Y_{Domain}\right):\\ y = F(x)\\ \end{eqnarray} \]