fbpx
Header

Knowledge Base

< All Topics

Yes, You can.

Not only the basic calculations like addition, subtraction, multiplication, or division. You can build complex mathematical and scientific calculations (the functions are mentioned below) in the Botosynthesis platform. 

We’ll show you how it can be done with some examples. 

Follow the steps to know how to make calculations inside your chatbot.

Step 1: Choose the Flow you want to include calculation operations.

Step 2: Select Action on the block builder and choose Set Custom Field.

Step 3:  Select the “custom field” on the flow and set up the wizard by choosing the existing custom field (Which you stored the values as number) and choose to use a custom formula on the operation, then set the custom formula that you want on the Value field.

Step 4: Then save, that’s it.

We know that it might confuse you a bit, let me explain this procedure with one simple example.

Example1: Performing (A+B)*(A-B) calculation

Get the values of A & B from user input as numbers,

Now set the calculation formula on the flow. For that, choose action on the basic builder and select the set custom field. Then, setup the wizard by choosing the custom field (number) in which you want to store the calculated values (here, we created that as “calculation value”). 

Now, the interesting part. Set the formula on the Value field (here we used the formula ( {{{value a}}-{{{value b}} )*({{value a}}+{{value b}} ) to do the above said calculation.

That’s it, if you take A as 4 and B as 2, the result will be shown by a chatbot as 12 (as per the calculation).

Here are some basic math examples that you can do inside the SiFer Bots platform:

  • 1+2*3-4
  • 1 + 2 * 3 – 4
  • pi * 2
  • PI * 2
  • abs(1) + min(1,2) * max(1,2,3)
  • min(1+2, abs(-1))
  • 1 + ((2 – 3) * (5 – 7))
  • 2 * (-3)

Here is the example of formats with syntax:

  • 1         // A term can consist of just a number
  • (1+((2))) // Usage of obsolete brackets is allowed
  • 00001     // Prefixing a number with obsolete zero digits is possible
  • .1        // Omitting a zero digit before a period character is okay

Here are some awesome list to provide more value for this article:

Operators:

  • Addition (+)
  • Subtraction (-)
  • Multiplication (*) 
  • Division (/)

Functions:

  • abs
  • aCos
  • aCosH
  • aSin
  • aSinH
  • aTan
  • aTanH
  • aTanTwo
  • ceil
  • cos
  • cosH
  • degToRad
  • en
  • exp
  • expMOne
  • floor
  • fMod
  • hypot
  • log
  • logOneP
  • logTen
  • max
  • min
  • pow
  • radToDeg
  • round
  • sin
  • sinH
  • sqrt
  • tan
  • tanH

Constants:

  • e
  • euler
  • lnPi
  • lnTen
  • lnTwo
  • logTenE
  • logTwoE
  • onePi
  • pi
  • piFour
  • piTwo
  • sqrtOneTwo
  • sqrtPi
  • sqrtThree
  • sqrtTwo
  • twoPi
  • twoSqrtPi

Others:

( (right-faced brackets)

) (left-faced brackets)

, (comma)

. (dot)

Table of Contents