PSEUDO-CODE
We present basic pseudo-code for some of the algorithms, discussed in the Steps. In our experience, students do benefit by studying the pseudo-code of a method at the same time as they learn it in a Step. If they are familiar with a programming language, they should attempt to convert at least some of the pseudo-codes into computer programs, and apply them to the set Exercises.Bisection Method
The equation is f (x ) = 0.Points for study:
- What is the input used for?
- Explain the purpose of Lines 8 - 12.
- Amend the speudo-code, so that the process will always stop after preset M iterations.
- Amend the pseudo-code so that the process will stop as soon as
- Write a computer program, based on this speudo-code.
- Use your program to solve Exercises 1 and 2 in the Applied Exercises.
Method of False position
The equation is f (x ) = 0.Points for study
- What are the input values used for?
- Under what circumstances may the process stop with a large error in x?
- Amend the pseudo-code so that the process will stop after M iterations, if the condition in Line 13 is not satisfied.
- Write a computer Program based on the pseudo-code.
- Use your program to solve Exercises 1 and 2 in the Applied Exercises.
Newton-Raphson iterative method
The equation is f (x ) = 0.Points for study
- 8
- How are the input values used?
- Why is M given in the output of Line 10?
- What happens if f'(a) is very small?
- Amend the pseudo-code to take suitable action if f'(a) is very small.
- Write a computer program based on the pseudo-code.
- Use your program to solve Exercises 1 and 2 in the Applied Exercises.
Gauss Elimination
The system is:
*
Points for study
- Explain what happens in Lines 2 - 10.
- What process is implemented in Lines 11 - 18`?
- Amend the pseudo-code so that the program terminates with an informative message when a zero pivot element is found.
- Write a program based on the pseudo-code.
- Use your program to solve Exercises 3 and 4 in the Applied Exercises.
Gauss-Seidel Iteration
The system is:Points for study
- What is the purpose of the number s?
- What are the y1, y2 1, . . ., yn used for?
- Why is it possible to replace the yj in Line 13 by xj?
- Amend the pseudo-code to allow a maximum of M iterations.
- Write a program based on the pseudo-code.
- Use thc computer program to solve the system:
- Use your program to solve Exercises 3 and 4 in the Applied Exercises
Newton divided difference formula
You are to calculate for given data x0, x1, . . . , xn, f(x0), f(x1), . . ., f(xn), and for given the interpolating polynomial Pn(x> of degree n. (The algorithm is based on divided differences.)Points for study
- Follow the pseudo-code through with the data n = 2, .x = 1.5, x0 = 0, f (.x0) = 2.5,.x1 = 1, f (x1) = 4.7, xSS2 = 3, and f x2) = 3.1. Verify that the values diicalculated are the divided differences f (x0, . . .,.xI).
- What quantity (in algebraic terms) is calculated in Lines 10 - 15?
- Amend the pseudo-code so that the values P1(x), P2(x)P&127;(x), . . ., Pn-1(x)are also printed out.
- Write a computer program based on the pseudo-code.
- Use your program to estimate f(2) for the data given in 1 above.
- For the data, given in Exercise 6 of the Applied Exercises, use the program to obtain an estimate of J0(0.25).
Trapezoidal Rule
The integral is:Points for study
- What are the input values used for?
- What value (in algebraic terms) does T have after Line 11?
- What is the purpose of Lines 12-17?
- Write a program based on the pseudo-code.
- Apply your program to Exercises 7 and 8 of the Applied Exercises.
Gauss integration formula
The integral is:Points for study
- What is the purpose of Lines 2 and 3?
- What changes are required to produce an algorithm based on the Gauss three-point formula?
- Write a computer program based on this pseudo-code.
- Use your program to solve Exercises 7 and 8 of the Applied Exercises.
Runge-Kutta method
Process the equation y' = f (x,y) and use the usual fourth-order method.
Points for study
- What are the input values used for?
- How many times is the function f evaluated between Lines 4 and 17?
- Amend the pseudo-code for use with the second-order Runge-Kutta method.
- Write a computer program based on the pseudo-code.
- Use the computer program to solve Exercises 9 and 10 of the Applied Exercises.
No comments:
Post a Comment