Fungsi-Fungsi Langkah

Before this, knowGrafik fungsi piecewise

Illustrated · 1 min

What is a step function?

A step function is a piecewise function over the real numbers that is made up from a finite number of constant functions. The name comes from the resemblance of the function to a set of steps.

Examples of step functions

f(x)={0x<010≤x<52x≥5f(x)=\begin{cases} 0 & x<0 \\ 1 & 0\leq x<5 \\ 2 & x\geq 5 \end{cases}
Graph of f(x).

Graph of f(x) made with Desmos.

g(x)={0x<−13−1≤x≤10x>1g(x)=\begin{cases} 0 & x<-1 \\ 3 & -1\leq x\leq 1 \\ 0 & x>1 \end{cases}
Graph of g(x).

Graph of g(x) made with Desmos.

h(x)={3x<11x=1−1x>1h(x)=\begin{cases} 3 & x<1\\ 1 & x=1 \\ -1 & x>1 \end{cases}
Graph of h(x).

Graph of h(x) made with Desmos.

What makes each of the above functions step functions?

  • They are discontinuous.
  • Each piece of the functions is a constant function.
  • They are all functions.

Check what you really know

If you can solve a contest problem with this idea, you know it well. If not, you know exactly what to review. These are real problems from the AMC 8, AMC 12 and AIME, the national math competitions for middle and high school students, each with a worked solution on LIVE by Po-Shen Loh.

Illustrated · 1 min

Examples of step functions\text{Examples of step functions}

Floor and ceiling functions

The floor function, f(x)=⌊x⌋f(x)=\lfloor x \rfloor (also written as floor(x)\text{floor}(x) or [x][x]), takes a real number xx and returns the greatest integer less than or equal to xx. ⌊2⌋=2⌊−1⌋=−1⌊2.5⌋=2⌊−1.5⌋=−2⌊2.9⌋=2⌊−1.1⌋=−2⌊2.99999999⌋=2⌊−1.00000001⌋=−2\begin{align} \lfloor 2 \rfloor=2 && \lfloor -1 \rfloor=-1\\ \lfloor 2.5 \rfloor=2 && \lfloor -1.5\rfloor=-2\\ \lfloor 2.9 \rfloor=2 && \lfloor -1.1 \rfloor=-2\\ \lfloor 2.99999999 \rfloor=2 && \lfloor -1.00000001 \rfloor=-2\\ \end{align}

The ceiling function, f(x)=⌈x⌉f(x)=\lceil x \rceil (also written as ceil(x)\text{ceil}(x)), takes a real number xx and returns the least integer greater than or equal to xx.

⌈3⌉=3⌈−4⌉=−4⌈3.5⌉=4⌈−4.5⌉=−4⌈3.1⌉=4⌈−4.9⌉=−4⌈3.00000001⌉=4⌈−4.99999999⌉=−4\begin{align} \lceil 3 \rceil=3 && \lceil -4 \rceil=-4\\ \lceil 3.5 \rceil=4 && \lceil -4.5 \rceil=-4\\ \lceil 3.1 \rceil=4 && \lceil -4.9 \rceil=-4\\ \lceil 3.00000001 \rceil=4 && \lceil -4.99999999 \rceil=-4\\ \end{align}
A graph of the floor function.

The floor function. Made using desmos

A graph of the ceiling function.

The ceiling function. Made using desmos

Sign function

The sign function takes a real number xx and returns 11 if xx is positive, −1-1 if xx is negative, and 00 if xx is 00. We can write it as a piecewise function like so: f(x)={1x>0−1x<00x=0f(x)=\begin{cases} 1 & x>0 \\ -1 & x<0 \\ 0 & x=0 \end{cases}

A graph of the sign function.

The sign function. Made using desmos

Nearest integer function

The nearest integer function takes a real number and returns the nearest integer. There are multiple different ways to address real numbers equidistant between integers such as 0.5,2.5,0.5, 2.5, and −1.5-1.5; within computer science, these numbers are usually rounded to the nearest even integer, although they are commonly rounded up as well.

A graph of the nearest integer function.

The nearest integer function. Made using desmos

Video

(Video) Heaviside Function

by PatrickJMT

This video by patrickJMT explores the Heaviside function, defined via:

H(x)={0x<01x≥0H(x)=\begin{cases} 0 & x<0 \\ 1 & x\geq 0 \\ \end{cases}

Illustrated · 1 min

Step Functions

Our next type of piecewise function is the step function! A step function looks exactly like it sounds: a series of steps!

Step function
A piecewise function that is:
-discontinuous
-a function
-each step is a constant function

Image source: by Anusha Rahman

The following is an example of a step function:

Step function on a graph

Made using Desmos

Type a concept, like “slope” or “photosynthesis”.

↑ ↓ to choose · Enter to openSearch explanations and problems