1991 ACM East Central Regional Programming Contest

Problem 2: Numerical Summation of a Series

Source file: table.pas or table.c
Input file: table.in
Output file: table.out

Produce a table of the values of the series


Equation 1

for the 21 values of x, x= 0.0, 0.1, 0.2, ..., 2.0. All entries of the table must have a relative error less than 1.0e-10 (10 digits of precision). This problem is based on a problem from Hamming (1962), when mainframes were very slow by today's microcomputer standards.

Input

This problem has no input file.

Output

The output is to be written into a file "TABLE.OUT". The output is to be formatted as two columns with the values of x and y(x) printed as in the C printf or the Pascal writeln.

printf("%4.2f %16.12f\n", x, psix )		writeln(x:4:2, psix:16:2)

As an example, here are 4 acceptable lines out of 21, which might appear in TABLE.OUT

0.00   1.644934066842
0.10   1.534607244899
...
1.00   1.000000000000
...
2.00   0.750000000002

The values of x should start at 0.00 and increase by 0.1 until the line with x=2.00 is output.

Process

The problem with summing the sequence in equation 1 is that too many terms may be required to complete the summation in the given time. Additionally, if enough terms were to be summed, roundoff would render any typical double precision computation useless for the desired precision.

To improve the convergence of the summation process note that


Equation 2

which implies y(1)=1.0. One can then produce a series for y(x) - y(1) which converges faster than the original series. This series not only converges much faster, it also reduces roundoff loss.

This process of finding a faster converging series may be repeated again on the second series to produce a third sequence, which converges even more rapidly than the second.

The following equation is helpful in determing how may items are required in summing the series above.


Equation 3

Sample

See the Output section for a partial example of "TABLE.OUT".