How to determine the following function at $x=0.1$ by four-digit rounding arithmetic?

1.2k Views Asked by At

$$f(x) = \frac{x\cos x - \sin x}{x - \sin x}$$

The answer from the back of the book is $-1.941$.

But I got $1$.

$\cos(0.1) ≈ 1$ by four-digit rounding arithmetic.

$\sin(0.1) ≈ 0.001571$

So,

$$\frac{(0.1)(1) - 0.001571}{0.1 - 0.001571} = 1$$

What did I do wrong?

2

There are 2 best solutions below

0
On

Your problem is degrees versus radians. $\sin 0.1 \approx 0.0998334$ when you use radians, which is what is expected in the problem. The next question is whether $x-\sin x$ is supposed to be $0.1 - 0.998334=0.0017$ to four digits or whether it should be the exact value and you only round to four digits at the end of the computation.

If I compute it with high accuracy I get $-1.999$ because we can write your fraction as $$ \frac{x\cos x - \sin x}{x - \sin x}= \frac{x - \sin x}{x - \sin x}+ \frac{x(\cos x -1)}{x - \sin x}\approx 1+\frac {-\frac {x^3}2+\frac{x^5}{24}}{\frac {x^3}6-\frac {x^5}{120}}\approx1-3+\frac {x^2}{10}$$

0
On

Evaluating the expression as it is gives the following algorithm with values and rounded values passed to the next step: \begin{array}{rl|l|l} &\text{operation}&\text{"exact" result}&\text{rounded result}\\\hline v_0&=x&+0.1&+0.100\\ v_1&=\cos v_0 & +0.995004165& +0.9950\\ v_2&=\sin v_0 & +0.0998334166 & +0.09983\\ v_3&=v_0v_1 & +0.0995004165 & +0.09950\\ v_4&=v_3-v_2&-0.0003300000 &-0.0003300\\ v_5&=v_0-v_2&+0.0001700000 &+0.0001700 \\ v_6&=v_4/v_5&-1.9411764706 &-1.9412 \end{array} which is exactly as the given result.


Plotting the rounded computation against a more exact result gives the following diagram, with the (more) exact graph in yellow and the results of the rounded computation as blue dots.

enter image description here