Number pi/Cosine/Zeroes/Computation/Pseudocode/Exercise

From Wikiversity
Jump to navigation Jump to search

We want to determine approximately as the smallest zero of cosine with the help of the cosine series

and the interval bisection method of the intermediate value theorem (in the sense of fact). Here, we encounter the problem that we can not compute the cosine exactly, as it involves infinitely many summands. Therefore we apply the following idea: as the -th approximation for , we use the lower bound of the -th interval coming from the interval bisection (with the initial interval ) for the zero of the truncated cosine series (so we are using finer nested intervals of better approximations of the cosine function).

Design a computer program (pseudocode) that computes the values and prints them, under the following conditions.

    • The computer has as many memory units as needed. They can store rational numbers.
    • The natural numbers are in some data base
    (it is not necessary to generate them).
    • The computer can write the content of a memory unit into another memory unit.
    • The computer can do arithmetic operations with rational numbers
    (addition, subtraction, multiplication, division by a number ) and store the result in a memory unit.
    • The computer can compare the content of two memory units and can jump, depending on the outcome, to program lines.
    • The computer can print the content of a memory unit and stored texts.