Page 134 - CG_v2.1_flipBooks_class_6
P. 134
Mathematics helps improve Artificial Intelligence to achieve human level of artistic creativity and
innovation. All the AI models are constructed using solutions and ideas from Maths.
A mathematical formula can be used for an infinite number of problems by just changing the values
of the variables.
Common applications of Math in AI includes linear algebra, probability, multivariate calculus,
optimisation and few other topics.
In this chapter, we’ll learn how coding helps solve mathematical problems very easily. These
mathematical problems can be solved using block commands in AI Connect. The blocks are really
easy to use by anyone and can help students learn coding for AI.
Multiplication of Two Numbers
To create a program in AI Connect to calculate the multiplication of two numbers, create a project
in it. In this project, create a Basic Coding activity. Then, follow the given steps:
Step 1 Go to the Variables category and click on the Create variable... block.
Create three variables named a, b (to take input from the user) and c (for the output).
Step 2 Drag set ... to block from Variables category. Click on the arrow in it, to select a. Attach
int block from Conversion category inside this block. Then, drag the input prompt block
from the Input category and fix it inside the int block.
Step 3 Perform the step 2 for variable b also.
Step 4 Attach set ... to block from Variables category. Click on the arrow in it, to select c. Attach
the multiplication block from the Math category. Attach a and b variable blocks from the
Variables category inside the multiplication block.
Step 5 Attach print block from the Output category. Click on setting icon on it and add one more
item to it. Attach input block and c variable block inside it.
Step 6 Click on Run button. Enter any value of variable a and variable b in the given boxes and
click on Enter button. The result will be displayed as shown in the image.
In this program we used coding concepts to calculate the multiplication of two numbers. Similarly,
we can use coding concepts to solve various mathematical equations.
132 Computer Genius (V2.1)-VI

