High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
Programming exercisesn NUMERICAL ANALYSIS
1. Programming Exercises
Write a computer program in C++/ Matlab.
Refresher Exercises:
1) Find the arithmetic mean, median, mode and standard deviation of 𝑥1, 𝑥2, … , 𝑥 𝑛.
(Remember in median you have to first sort the data in ascending or descending order and then
median is middle most value in case of odd number values and median is average of two middle
values in case of even number of values)
2) Find the sum
1
10
+
1
10
+ ⋯ +
1
10
up to1000, 10000, 100000, 1000000 times.
3) Find the sum of the series 1 +
1
2
+
1
3
+ ⋯ +
1
𝑛
(Input different values of 𝑛 preferable large 𝑛 and check whether the sum of the series converges or
not)
4) Find the sum of the series 1 +
1
2!
+
1
3!
+ ⋯ +
1
𝑛!
(Input different values of 𝑛 preferable large 𝑛 and check the sum of the series converges or not)
5) Numerically compute the following series
1 −
1
3
+
1
5
−
1
7
+
1
9
…
Hint: First find the general term of the series and then input different values of 𝑛 to investigate the
sum of the series.
6) Assuming that sin(x) and cos(x) are not available in your programming language compiler.
Develop your own sin (x) and cos(x) using
sin 𝑥 = 𝑥 −
𝑥3
3!
+
𝑥5
5!
−
𝑥7
7!
+
𝑥9
9!
… + (−1)2𝑛+1
𝑥2𝑛+1
(2𝑛 + 1)!
cos 𝑥 = 1 −
𝑥2
2!
+
𝑥4
4!
−
𝑥6
7!
+
𝑥8
8!
… + (−1) 𝑛
𝑥2𝑛
(2𝑛)!
(You should decide number of term i.e. 𝑛 to be evaluate by your choice or you may ask from the
user and 𝑥 should be decided by user. )
For example sin 1 ≈ 1 −
1
3!
+
1
5!
−
1
7!
+
1
9!
(Choosing 𝑛 = 4)
7) Find the GCD i.e. greatest common divisor and LCM i.e. least common multiple of two
numbers 𝑎 and 𝑏. Hence generalize it to find the GCD and LCM of 𝑛 numbers.
8) Solve the 2𝑥2 system of linear equations by eliminating one of variable and Gaussian
Elimination method
𝑎11 𝑥1 + 𝑎12 𝑥2 = 𝑏1
𝑎21 𝑥1 + 𝑎22 𝑥2 = 𝑏2