(7 problems)
Microsoft Word - HW ^LN2 assignment v2 1 HW #2 Assignment (7 problems) Due: Monday, 10/19/2020 for both Sessions 002 and 003. Submission: the same way as HW #1 1. For a cubic equation, ax3 + bx2 + cx+ d = 0. The following formula gives its general solution is available (https://sciencing.com/solve-cubic- equations-8136094.html). where Write C code for this formula, and use it to solve two examples that you choose. Write C code for the following: 2. Solve x sin x = ex - x sin (x2), by the Newton-Raphson method in the interval, [-2, 2]. 3. Find all the roots ex - 3 x = 0, using the bisection method. 4. Solve the following 10 simultaneous equations by the Gauss-Jordan elimination method. a11 x1 + a12 x2 + a13 x3 + + a1 10x10 = c1 a21 x1 + a22 x2 + a23 x3 + + a2 10x10 = c2 a31 x1 + a32 x2 + a33 x3 + + a3 10x10 = c3 an1 x1 + an2 x2 + an3 x3 + + a10 10x10 = c10 (1) 2 where aij is given as a[10][10]={ {3.55618, 5.87317, 7.84934, 5.6951, 3.84642, 9.15038, -1.68539, 5.03067, 7.63384, -1.75626}, {-4.82893, 8.38177, -0.301221, 5.10182, -4.1169,-6.09145, -3.95675, -2.33365, 1.3969, 6.54555}, {-7.64196, 5.66605,3.20481, 1.55619, -1.19814, 9.79288, 5.35547, 5.86109, 4.95544, -9.35749}, {-2.95914, -9.16958,7.3216, 2.39876, -8.1302, -7.55135, -2.37718, 7.29694, 5.9867, 8.5401}, {-8.42043, -0.369407, -5.4102, -8.00545, 9.22153, 3.96454, 5.38499, 0.438365, 0.419677, 4.17166}, {6.02952, 4.57728, 5.46424, 3.52915, -1.01135, -3.74686,8.14264, -8.86961, -2.88114, 1.29821}, {0.519819, -6.16655, 1.13216, 2.75811, -1.05975, 4.20286, -3.45764, 0.763558, -0.281287, -9.76168}, {5.15737, -9.67481, 9.29904, -3.93334, 9.12785, -4.25208, -6.1652, 2.5375, 0.139195, 2.00106}, {-4.30784, 1.40711, -6.97966, -9.29715, 5.17234, 2.42634, 1.88818, -2.05526, -3.7679, 3.3708}, {-4.65418, 7.18118, 6.51338, 3.13249, 0.188456, -16.85599, 7.21435, -2.93417, 1.06061, 1.10807} }; and ci is given as c[10]={-1.92193, -2.35262, 2.27709, -2.67493, 1.84756, 4.154126, -0.93387, -1.28356, -3.46841, -2.61529}; 5. Solve the following set of nonlinear equations by the Gauss-Seidel method. 27 x + ex cos y 0.12 z = 3 0.2 x2 + 37 y + 3 x z = 6 x2 0.2 y sin x + 29 z = 4 (2) Start with an initial guess of x = y = z = 1. 3 6. The altitude (ft) from the sea level and the corresponding time (sec) for a fictitious rocket were measured as follows: Time 0 20 40 60 80 100 120 140 160 180 200 Altitude 370 9170 23835 45624 62065 87368 97355 103422 127892 149626 160095 Numerically compute the velocity from the table above using the central difference scheme. Use f(x) 3 f(x) 4 f(x h) + f(x 2 h) 2 h at t=200 and use f(x) ~ 4 f(x+h) - f(x+2 h) - 3 f(x) 2 h at t=0. Make sure that you attach example runs showing the results from the computer. 7. (a) Evaluate analytically 1 0 x ln x dx. (b) Write a C program to numerically integrate the above using the Simpson rule. Note that the graph of x ln x looks like Note also that ln x as x 0. So the challenge is how to handle the seemingly singular point of x = 0.