 Today we will see programs based on mathematical functions. These are the learning outcomes. The student will be able to execute the programs regarding mathematical functions. Contents, first we will see what we have discussed in the third session, after that we will see the programs based on the mathematical functions. So in the third session we have discussed what are the different mathematical functions. So these are the mathematical functions. So this is very simple question, enlist the mathematical functions regarding the trigonometric geometry. Just think about this question. Now in the last session we have discussed the program regarding how to use the different mathematical functions in the program. Now the second program, write the program to calculate the area of a triangle by following formula. We are having the formula that is capital A is equal to under root s into s minus a s minus b s minus c, where s is the semi perimeter, capital A is the area of the triangle we have to calculate. First we have to calculate the semi perimeter of the triangle with the help of this particular formula that is s is equal to a plus b plus c divided by 2. Now we will go to the particular program for the area of triangle with the help of this particular formula. So class is tier, you can provide any class name here. So public static voidment string ARGS is a main statement. You can take any values for the ABC, ABC are the variables which are the size of the triangle, a is equal to 10, b is equal to 25 and c is equal to 27. These are the values for the size of the triangle that is ABC. S is the semi perimeter and capital A is the variable for the area of triangle. So now here the declaration of the values into the variable, storing of the values in the variable, now I have to print these values that is a is equal to 10, b is equal to 25 and c is equal to 27. So system.out.println, this is the statement with the help of which you can print the particular statement and also the value. So in the double inverted commas, a is equal to plus a, with the help of plus a you can recall the particular stored values that is a is equal to 10 means a is equal to 10, with the help of plus a you can recall the particular value that is 10. For the recording you have to store it first of all after that. System.out.println, b is equal to plus b with the help of a, b is equal to 25 means b is equal to 25 that will be the statement that will be printed on the screen. System.out.println, this is the statement after the c is equal to that is plus c, plus c what is the value of c that is 27. So c is equal to 27, this will be stored and that will be printed on the screen. So up to this we can say that this is very simple part. First provide the value to the variable, just declare it, store it after that just print it with the help of system.out.println to the next slide. Now provide the formula that is for the semi-perimeter that is s is equal to a plus c, b plus c divided by 2, whole divided by 2. Here there will be the providing the values of a, b, c in the formula here, there will be the calculation and the particular value whatever it is that will be stored in the variable s that is semi-perimeter. Now we have stored the value here, we have stored the value here now I have to print it. So system.out.println that is the statement or the code to print the value, system.out.println semi-perimeter is equal to plus s, what is member plus s we have calculated here that is s is equal to a plus b plus c divided by 2. Now why to calculate because we are having the formula that is under root s into s minus a, s minus b, s minus c. Because first we have to calculate we cannot go directly to the capital A that is area of triangle. First we have to calculate the sub-variable that is semi-perimeter. So first we have calculated semi-perimeter with the help of formula a plus b plus c divided by 2. Here there will be the calculation and the printing of the value that is semi-perimeter is equal to plus s after that. After getting the value of semi-perimeter we will go to the directly to the formula of the capital A that is area of triangle. Capital A is equal to mat dot sqrt in the bracket s into s minus a into the bracket s minus b into the bracket s minus c. Mat dot sqrt is the mathematical function to achieve the square root of the particular value. So this is the particular formula that is under root s into s minus a, s minus b, s minus c and we can put this formula into the particular mathematical function mat dot sqrt. Here there will be the calculation and the storing of the particular value of the area of triangle that is capital A. Now I have to print it. So system dot of dot print l n area of triangle is plus a that is capital A. Here the small a is for the side of the triangle, one side of the triangle. The capital A is for the area of the triangle. Now our class name is tr, our file name is tr. Now we will execute this program. So java c space, java c is the compiler, java c space the name of the file that is tr dot java, tr dot java is the name of the file. So java space, java c space name of the file enter. So this is the compilation process. After that there will be the creation of the class file. After that we have to execute it. So java space, java is the java interpreter, java space name of the class that is tr. Here the name of the class and the name of the file is same. You can provide the different names for the name of the class and the name of the file during the execution and the compilation process. So after execution of the program with the help of java interpreter that is java space name of the class. So a is equal to b is equal to c is equal to these are the particular values. The semi-parameter is 31 and the area of triangle is 124.99. So with the help of these two code we can execute the code. Java is always the two step process. Now we will move to the second program, our second program. Here also we have to use the mathematical function. What is the problem statement? Write a program to calculate the roots of the given quadratic equation. Because we are having may be the particular quadratic equation that is ax square plus bx plus c is equal to 0. Here we have to calculate the value of x. What is the formula? Minus b plus or minus under root b square minus 4ac divided by 2a. So plus or minus. For example x1 is equal to minus b plus under root b square minus 4ac divided by 2a. And x2 is equal to minus b minus under root b square minus 4ac divided by 2a. So how to write the program for this to calculate the root of quadratic equation? We will go to the particular program here. The roots is the name of the class. Public static white man is the main statement. Now suppose my equation is quadratic equation is 3x square plus 20x plus 5 is equal to 0. So first we will declare that 3x square plus 20x plus 5 is equal to 0 is our given quadratic equation. So I have to print this. System.out.println quadratic equation is 3x square plus 2x 20x plus 5 is equal to 0. So there will be printing of this particular equation after that. What are the values of a, b, c? The coefficient of x square is 3, the coefficient of x is 20 and the constant is 5. So that means so a is equal to 3 after that b is equal to 20 and c is equal to 5. x1 and x2 are the roots. So with the help of these variables x1 and x2 we can store these values in x1 and x2. After that d we will require. So first we will print these the particular values that is a, b, c. So a is equal to plus a, b is equal to plus b and c is equal to plus c in the system.out.println. We have discussed after that. We are having the particular formula that is minus b plus or minus b square minus 4ac. First we will calculate what is the value of b square minus 4ac and we will store this particular value in the particular variable that is d is equal to b square minus 4ac. So d is equal to b square minus 4ac that will be stored in the variable d after that. x1 is equal to minus b plus under root b square minus 4ac divided by 2a that is b square minus 4ac means d. So minus b plus mat.sqrt variable d divided by 2a. Here there will be the calculation and that will be stored in the x1 that is the first root of the quadratic equation. The system.out.println root 1 is equal to x1. This will be our first root of the quadratic equation, the given quadratic equation. Similarly x2 is equal to minus b minus mat.sqrt d divided by 2a. So system.out.println root 2 is equal to x2. Here in the x2 we have calculated the second root of the equation and for this we required the mat.sqrt mathematical function. How to execute it so javac roots.java this is my filename roots.java so javac sorry java this is my java interpreter javaspace roots that is my class name. So here there will be the printing of abc value first after that directly you will get the root 1 and root 2 of the particular quadratic equation. So in this session we have discussed with the help of mathematical functions how we can write the programs. For example we have seen the area of triangle after that we have seen how to calculate the roots of quadratic equation. These are the references. Thank you.