# Develop a user-friendly program in either a high-level or macro language of your choice to obtain a solution for a tridiagonal system with the Thomas algorithm (Fig. 11.2). Test your program by duplicating the results of

Book : Chapra, S. C., & Canale, R. P. (2015). Numerical Methods for Engineers (7th ed.). New York, NY: McGrawHill. ISBN: 007339792X.

Download From Here: http://mechfamilyhu.net/download/uploads/mech144232415981.pdf

Assignment: Problem Set 1 (20 points) Complete the following problems from the textbook. Show all your work. If you write code, include screenshots of your code and any test runs that you perform.

• 5.15 – pretend this experiment is set up on the moon (where g = 1.625m/s2) instead of Earth

· As depicted in Fig. P5.15, the velocity of water, y (m/s), discharged from a cylindrical tank through a long pipe can be computed as y 5 12gH tanh a12gH 2L tb where g = 1.625m/s2, H 5 initial head (m), L 5 pipe length (m), and t 5 elapsed time (s). Determine the head needed to achieve y 5 5 m/s in 2.5 s for a 4-m-long pipe (a) graphically, (b) by bisection, and (c) with false position. Employ initial guesses of xl 5 0 and xu 5 2 m with a stopping criterion of es 5 1%. Check you results.

• 6.19 – write a computer program and use the Newton-Raphson method to answer this question

You are designing a spherical tank (Fig. P6.19) to hold water for a small village in a developing country. The volume of liquid it can hold can be computed as

where V 5 volume (m3), h 5 depth of water in tank (m), and R 5 the tank radius (m). If R 5 3 m, what depth must the tank be fi lled to so that it holds 30 m3? Use three iterations of the NewtonRaphson method to determine your answer. Determine the approximate relative error after each iteration. Note that an initial guess of R will always converge.

• 7.6 Develop a program to implement Müller’s method. Test it by duplicating (Divide a polynomial f(x) 5 x5 2 5×4 1 x3 2 6×2 2 7x 1 10 by the monomial factor x 2 2.)

• 7.8 Develop a program to implement Bairstow’s method. Test it by duplicating Example 7.3.

• 8.1 – use chlorine (a = 6.579, b = 0.5622) at 1atm and 291.5K

Perform the same computation as in Sec. 8.1, but for ethyl alcohol (a = 6.579, b = 0.5622) at a temperature of 291.5 K and p of 1.0 atm. Compare your results with the ideal gas law. Use any of the numerical methods discussed in Chaps. 5 and 6 to perform the computation. Justify your choice of technique • 9.20 Develop, debug, and test a program in either a high-level language or macro language of your choice to solve a system of n simultaneous nonlinear equations based on Sec. 9.6. Test the program by solving Prob. 7.12.

• 10.19 Develop a user-friendly program for LU decomposition, including the capability to evaluate the matrix inverse. Base the program on Figs. 10.2 [] and 10.5.

• 11.24 Develop a user-friendly program in either a high-level or macro language of your choice to obtain a solution for a tridiagonal system with the Thomas algorithm (Fig. 11.2). Test your program by duplicating the results of Example 11.1.

• 11.25 Develop a user-friendly program in either a high-level or macro language of your choice for Cholesky decomposition based on Fig. 11.3. Test your program by duplicating the results of Example 11.2.

• 11.26 Develop a user-friendly program in either a high-level or macro language of your choice for the Gauss-Seidel method based on Fig. 11.6. Test your program by duplicating the results of Example 11.3.

• 12.20

• 13.14 Develop a program using a programming or macro language to implement the parabolic interpolation algorithm. Design the program so that it is expressly designed to locate a maximum and selects new points as in Example 13.2. The subroutine should have the following features:

1. Base it on two initial guesses, and have the program generate the third initial value at the midpoint of the interval.

2. Check whether the guesses bracket a maximum. If not, the subroutine should not implement the algorithm, but should return an error message.

3. Iterate until the relative error falls below a stopping criterion or exceeds a maximum number of iterations.

4. Return both the optimal x and f(x).

5. Minimize the number of function evaluations.

• 13.15 Develop a program using a programming or macro language to implement Newton’s method. The subroutine should have the following features: • Iterate until the relative error falls below a stopping criterion or exceeds a maximum number of iterations. • Returns both the optimal x and f(x). Test your program with the same problem as Example 13.3.

• 14.9 Develop a program using a programming or macro language to implement the random search method. Design the subprogram so that it is expressly designed to locate a maximum. Test the program with f(x, y) from Prob. 14.7. Use a range of 22 to 2 for both x and y.

• 15.1 A company makes two types of products, A and B. These products are produced during a 40-hr work week and then shipped out at the end of the week. They require 20 and 5 kg of raw material per kg of product, respectively, and the company has access to 9500 kg of raw material per week. Only one product can be created at a time with production times for each of 0.04 and 0.12 hr, respectively. The plant can only store 550 kg of total product per week. Finally, the company makes profi ts of $45 and $20 on each unit of A and B, respectively. Each unit of product is equivalent to a kg.

(a) Set up the linear programming problem to maximize profi t.

(b) Solve the linear programming problem graphically.

(c) Solve the linear programming problem with the simplex method.

(d) Solve the problem with a software package.

(e) Evaluate which of the following options will raise profi ts the most: increasing raw material, storage, or production time.

• 16.24