# Mathematical Calculations in Conversations

EasySocial is thrilled to unveil a new feature that enables dynamic mathematical calculations to be performed seamlessly within conversations. This innovative addition enhances the versatility and functionality of our chatbot, providing users with real-time calculations without the need for external tools or manual calculations.

## Calculation Formula:

To perform the desired calculation, the chatbot employs the "calc" function, which processes a mathematical equation.

The function is used as follows:

**calc(***mathematical equations***)**

`calc(55+4*20)`

Customers can input their custom mathematical equations within the parentheses.

The mathematical equation can include a wide range of operations, such as addition, subtraction, multiplication, division, parentheses for grouping, and more.

The equation should follow standard mathematical conventions to ensure accurate calculations.

### Some Use Cases

- You are a cab service provider. The customer can input the distance in km and you can multiply it by a certain amount to show the fare of the ride.
- You are selling tickets online when the person selects the no. of tickets to be purchased you can multiply it with the price of each ticket and print the total amount payable
- You are a marble/tiles seller. If someone shares their flooring area in square feet you can calculate the number of tiles/marble slabs they would require.
- You are a stock market app. If your customer provides the amount he wants to invest your chatbot can suggest the number of share units he can purchase.

### Now, let us give you a practical example

Lets' say you want to calculate and give the total amount of few items

- Take a basic message node, and write in the message input box "Please enter the number of items you want to purchase"

- Lets' assume the customer entered wants 10 items
- Connect this node with another basic message node
- On this node write the message as "Dear customer, your total bill is Rs.
**calc(10*400)**."

In this case the message printed from the chatbot will look like as follows: "Dear customer, your total bill is Rs.**4000**."

You can also dynamically capture customers input value and use it for the calculation. Lets see how this can be achieved. -Take a basic message node write "Please enter the number of items you want to purchase"

- Go to Capture User Input portion from the node drawer and checkbox "Save User Input Value" then select the lead data field from the dropdown below or create a new one named "quantity"
- Connect this node with another basic message node
On this node write the message as "Dear customer, your total bill is calc([quantity]*400) rupees"

So the total amount will show on chat as "Dear customer, your total bill is 4000 rupees"

In general, the EasySocial chatbot incorporates mathematical principles to calculate outcomes dynamically within the conversation. By utilizing a calculation formula and mathematical operations, the chatbot can process the selected quantity or other relevant variables to generate the desired result. The specific calculation formula and operations employed are adaptable and can be tailored to the specific requirements and objectives of the chatbotĀ application.