Stepwise Function

Table of contents

Automate your business at $5/day with Engati

REQUEST A DEMO
Switch to Engati: Smarter choice for WhatsApp Campaigns 🚀
TRY NOW
Stepwise function

What is a stepwise function in math?

In Mathematics, a stepwise function (staircase function) is defined as a piecewise constant function or series of steps, that only has a finite number of pieces. In other words, a function on the real numbers can be described as a finite linear combination of indicator functions of given intervals. It is also called a floor function or greatest integer function. The step function is a discontinuous function. 

Essentially, a step function in mathematics is a function whose graph looks like a series of steps because it consists of a series of horizontal line segments with jumps in-between (which is why it is also known as a staircase function).

These functions have a constant value on given intervals, but the constant is different for every interval. The constant value on every interval creates a series of horizontal lines, and the fact that the constant is different for each interval creates the jumps in between each horizontal line segment, which causes the graph of a step function to look like a set of stairs.


How do you write a stepwise function?

We can also define it as the constant function on the real numbers. It is a piecewise constant function on the finite set. The other name for the set function is floor function or the greatest integer function which is the combination of the linear functions for a defined interval. However, in the case of mathematics, the definition for this function is entirely different.

To define a step function given by f: R→R, which is discontinuous, you can write it in the form of:

stepwise function formula

In the above equation, x is defined for the real numbers. 

α is the real number and A is defined for the interval with the condition n >= 0. 

If this condition is satisfied, then the indicator function A will be given by XA.

Get your WhatsApp chatbot at just $5 a day

What is an example of a step function?

Step Functions manages your application's components and logic, so you can write less code and focus on building and updating your application quickly. This section describes typical use cases for working with Stepwise Functions.

Example 1: Function orchestration

You create a workflow that runs a group of Lambda functions (steps) in a specific order. One Lambda function's output passes to the next Lambda function's input. The last step in your workflow gives a result. With Stepwise Functions, you can see how each step in your workflow interacts with one other, so you can make sure that each step performs its intended function.

Example 2: Branching

A customer requests a credit limit increase. Using a Choice state, you can have Step Functions make decisions based on the Choice state’s input. If the request is more than your customer’s pre-approved credit limit, you can have Step Functions send your customer's request to a manager for sign-off. If the request is less than your customer’s pre-approved credit limit, you can have Step Functions approve the request automatically.

Example 3: Error handling

In this example, a customer requests a username. The first time, your customer’s request is unsuccessful. Using a Retry statement, you can have Step Functions try your customer's request again. The second time, your customer’s request is successful.

In a similar use case, a customer requests an unavailable username. Using a Catch statement, you have Step Functions suggest an available username. If your customer takes the available username, you can have Step Functions go to the next step in your workflow, which is to send a confirmation email. If your customer doesn’t take the available username, you have Step Functions go to a different step in your workflow, which is to start the sign-up process over.

Example 4: Human in the loop

Using a banking app, one of your customers sends money to a friend. Your customer waits for a confirmation email. With a callback and a task token, you have Step Functions tell Lambda to send your customer’s money and report back when your customer’s friend receives it. After Lambda reports back that your customer’s friend received the money, you can have Step Functions go to the next step in your workflow, which is to send your customer a confirmation email.

Example 5: Parallel processing

A customer converts a video file into five different display resolutions, so viewers can watch the video on multiple devices. Using a Parallel state, Step Functions inputs the video file, so Lambda can process it into the five display resolutions at the same time.

Example 6: Dynamic parallelism

A customer orders three items, and you need to prepare each item for delivery. You check each item's availability, gather each item, and then package each item for delivery. Using a Map state, Step Functions has Lambda process each of your customer's items in parallel. Once all of your customer's items are packaged for delivery, Step Functions goes to the next step in your workflow, which is to send your customer a confirmation email with tracking information.

How does Manual Approval work in AWS Step Functions?

Source: AWS

How do you know if a function is a stepwise function?

A step function has a constant value on given intervals, but the constant is different for each interval. The constant value on each interval creates the series of horizontal lines, and the fact that the constant is different for each interval creates the jumps in between each horizontal line segment. This is why the graph of a step function looks like a set of stairs.

How are stepwise functions used in real life?

You can use Step Functions to create an automated security incident response workflow that includes a manual approval step. In this example, a Step Functions workflow is triggered when a policy is created. The workflow compares the policy action against a customizable list of restricted actions. The workflow rolls back the policy temporarily, then notifies an administrator and waits for them to approve or deny. You can extend this workflow to remediate automatically such as applying alternative actions. 

Close Icon
Request a Demo!
Get started on Engati with the help of a personalised demo.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
*only for sharing demo link on WhatsApp
Thanks for the information.
We will be shortly getting in touch with you.
Oops! something went wrong!
For any query reach out to us on contact@engati.com
Close Icon
Congratulations! Your demo is recorded.

Select an option on how Engati can help you.

I am looking for a conversational AI engagement solution for the web and other channels.

I would like for a conversational AI engagement solution for WhatsApp as the primary channel

I am an e-commerce store with Shopify. I am looking for a conversational AI engagement solution for my business

I am looking to partner with Engati to build conversational AI solutions for other businesses

continue
Finish
Close Icon
You're a step away from building your Al chatbot

How many customers do you expect to engage in a month?

Less Than 2000

2000-5000

More than 5000

Finish
Close Icon
Thanks for the information.

We will be shortly getting in touch with you.

Close Icon

Contact Us

Please fill in your details and we will contact you shortly.

This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
Thanks for the information.
We will be shortly getting in touch with you.
Oops! Looks like there is a problem.
Never mind, drop us a mail at contact@engati.com