CM Experiments - Aug 2024
CM Experiments - Aug 2024
LIST OF EXPERIMENTS
Implementation to be done on C/C++
Introductory Program: Write a program to add, subtract, divide and multiply two
numbers.
2
1. Write a program to find a root of the equation 𝑥 𝑆𝑖𝑛 𝑥 = 1 using the Bisection
method. Run the program for the initial interval and the tolerance level provided
by the user.
2
2. Write a program to solve for a root of the equation 𝑥 𝑆𝑖𝑛 𝑥 = 1 using Newton
Raphson method. Run the program for the initial approximations 0, 1 and 2.
Compare the values obtained using N-R and Bisection methods of the
approximate root and no. of iterations obtained for different values of tolerance
level (0.1, 0.01, 0.001, 0.0001)
5 3
3. Write a program to solve for a root of the equation 𝑥 + 𝑥 + 3 = 0 using the
Secant method. Run the program for the initial approximations -1 and 1.
4. Write a program to predict this year's rainfall using the Lagrange Interpolation
method. Use the annual rainfall data for the last 10 years in your city. Is the
answer obtained reasonable?
5. Using 21 equally spaced nodes on the interval [-5 5], find the interpolating
1
polynomial 𝑝(𝑥) of degree 20 for the function 𝑓(𝑥) = 2 . Print the values of
1+𝑥
𝑝(𝑥) and 𝑓(𝑥) at 41 equally spaced points, including the nodes. What do you
observe?
1 2
−𝑥
6. Write a program to find the number of subintervals required to evaluate ∫ 𝑒 𝑑𝑥
0
1 −4
with utmost error of 2
* 10 for the composite Trapezoidal Rule.