Sheet 2 (Programming) : A. Flowcharts
Sheet 2 (Programming) : A. Flowcharts
Sheet 2 (Programming)
A. Flowcharts
x
1. Draw a flowchart to calculate e for a given x using a Taylor polynomial of degree 2.
2. Draw a flowchart to calculate sinhx for a given x using a Taylor polynomial of degree 3.
3. Draw a flowchart to calculate ln(1+x) for a given x using a Taylor polynomial of degree 4.
4. Draw a flowchart to calculate: (a) the area of a rectangle, (b) the sum of two numbers.
6. Draw a flowchart to determine the largest of: (a) two numbers, (b) three numbers.
10. You are solving a problem using an iterative numerical method with some initial guess. The
solution will be acceptable when the absolute relative approximate error does not exceed 1%.
Draw a flowchart to display the results.
11. In problem 10, the number of iterations should not exceed 1000. Draw a flowchart.
12. The result of an exam is either ‘Fail’ with a score less than 50% or ‘Pass’ otherwise. Draw a
flowchart to display the result for:
(a) one student, (b) 90 students,
(c) variable number of students, (d) unknown number of students.
13. An exam is given to a class of 60 students. Draw a flowchart to calculate the class average and
the number of students who scored below the average.
B. MatLab Programs
Write MatLab programs for problems 1 – 10.
Run the programs, assuming needed data, and give results.