2
$\begingroup$

For example, take $y = x$, but at $x \geq 5$, $y$ now equals $\sin x + 5$. So for all $x$ values $\lt 5$, $y$ has linear relationship, but at $\geq 5$, $y$ now has sinusoidal relationship. Is there a concise way to express this, perhaps a single equation?

$\endgroup$
5
$\begingroup$

A function like this is said to be a piecewise function. The typical way to notate them is to enumerate the subdomains and the functions defined on such:

$$f(x) = \left\{\begin{array}{ll} x, & \text{if }x<5\\ x+\sin x, & \text{if }x\geq 5\\\end{array}\right.$$

Since any real $x$ satisfies one of these two conditions, we could also write this as

$$f(x) = \left\{\begin{array}{ll} x+\sin x, & \text{if }x\geq 5\\ x, & \text{else }\end{array}\right.$$

Another, less common notation is that of the Iverson bracket. The Iverson bracket $[P]$ for a conditional $P$ is defined as $$[P]=\left\{\begin{array}{ll} 1, & \text{if }P\text{ is true}\\ 0, & \text{else }\end{array}\right.$$

This allows us to express piecewise functions with one-line notation, e.g., $$f(x)=x [x<5]+(x\sin x)[x\geq 5].$$ Since $x\leq 5$ is the negation of $x<5$, we may eliminate the first bracket as $[x<5]=1-[x\geq 5]$ and therefore also have \begin{align} f(x)&=x(1-[x\geq 5])+(x+\sin x)[x\geq 5]\\ &=x+(\sin x)[x\geq 5]. \end{align} This captures the intuition that, whether or not $x\geq 5$, we start "at minimum" with $f(x)=x$; if we $x\geq 5$, we add on $\sin x$ as well. Of course, we could also have done this with our original notation:

\begin{align} f(x) &= x+ \left\{\begin{array}{ll} \sin x, & \text{if }x\geq 5\\ 0, & \text{else }\end{array}\right.\\ &= x+ (\sin x)\left\{\begin{array}{ll} 1, & \text{if }x\geq 5\\ 0, & \text{else }\end{array}\right. \end{align}

So these are ultimately just variations in notation, all of which present the same concept.

$\endgroup$
1
$\begingroup$

This is called a PIECEWISE function. It is a function that behave differently depending on which parts of the domain you are on. It is basically made out of PIECES of other functions, and they are tied together by taking sections of them and combining them into one function. For example, $|x|$ is a piecewise function because it is equal to $x$ for $x \ge 0$, and it is equal to $-x$ for $x \le 0$. A piecewise function might look like this: $ f(n) = \begin{cases} n/2, & \text{if $n$ is even} \\ 3n+1, & \text{if $n$ is odd} \end{cases} $

You can read more about piecewise functions here: https://en.wikipedia.org/wiki/Piecewise

$\endgroup$
0
$\begingroup$

This question makes me think of a related but slightly different kind of function. A function which gradually/slowly changes behavior, instead of having this piecewise phenomenon.

The piecewise and discontinuous transition would be denoted as $$ h(x) = \begin{cases} f(x)\quad\text{if}\quad x \leq x_0\\ g(x)\quad\text{if}\quad x > x_0\\ \end{cases}$$ A gradual shift from $f$ to $g$ can be written as $(1-t)\cdot f + t\cdot g$ with $t\in[0,1]$. Therefore a function that gradually changes from $f$ after $x_0$ and becomes $g$ at $x_1 > x_0$ would be written $$ h_{\mathrm{grad}}(x) = \begin{cases} f(x)\quad\text{if}\quad x \leq x_0\\ \\ \left(1 - \dfrac{x-x_0}{x_1-x_0}\right)\cdot f(x) + \left(\dfrac{x-x_0}{x_1-x_0}\right)\cdot g(x) \quad\text{if}\quad x_0 < x \leq x_1\\ \\ g(x)\quad\text{if}\quad x > x_1\\ \end{cases}$$ As an exemple, let us take $f(x)=x$ and $g(x) = \sin(x) + 5$ on the domain $[-5, 10]$.

The piecewise transition is pictured below: piecewise transition

The continuous/gradual transition is in green below: gradual piecewise transition

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.