## → Lab Session 1←

### 1) Write a program to obtain the value of e correct up to second decimal place using the series

Solution:

# include

# include

void main()

{

int i, n, exp;

float x, sum = 1, t = 1 ;

clrscr() ;

printf(“Enter the value for x : “) ;

scanf(“%f”, &x) ;

printf(“\nEnter the value for n : “) ;

scanf(“%d”, &n) ;

for(i = 1 ; i < n + 1 ; i++)

{

exp = i ;

t = t * x / exp ;

sum = sum + t ;

}

printf(“\nExponential Value of %f is : %8.4f”, x, sum) ;

getch() ;

}

Output:

### 2) Write program to calculate the approximate value of Sine of a value given in radians. Compare the value obtained by you with actual values. Explain, if you find the difference between the two. The Sine can be defined using the formula :

#### Solution: click to display solution

### 3) Write a program that accepts a decimal number and displays its floating point equivalent number. You may make assumptions to simplify the program, however, your representation of floating point number should be closer to IEEE 754 standard 32 bit representation.

**→ Lab Session 2←**

**→ Lab Session 2←**

### 1) Write a program to implement Gauss Elimination method for solving linear equations. Your method should check if a given pivot is zero or not. It should also minimise the floating point errors.

### 2) Write a program to implement Gauss Seidel method for finding the roots of linear equations.

### 3) Distance covered by an object can be represented by the equation:

s(t)=x_1+x_2 t+x_3 t^2

The object distance was observed in the time interval. The following table shows these observations:

Time (t) in seconds Distance (s) in meters

0 0

2 50

5 150

10 500

Create the system of linear equations using the data given in the table. Solve it using any program that you have created (in problem 1 or 2) for this purpose.

**→Lab Sessions 3←**

**→Lab Sessions 3←**

### 1) Write a program to implement Bisection method for finding positive root of the equation x^2-9x+21=0. You have to make suitable choice for the bounds.

###
2) Write a program to find one root of a non-linear equation using Newton-Raphson method. Compare the number of iterations taken by this method to that of Bisection Method.

Write a program to implement Regula-Falsi method.

### 3) Write a program to implement secant method.

###
4) Find the root of the following functions using any of the method given above.

f(x)=x^2

f(x)=1⁄x

Explain your answer.

Advertisements

please sir upload fully solved lab manual

LikeLike

why full mannual be solved??

LikeLiked by 1 person