Calculate the error bound for the rounding errors of an expression

157 Views Asked by At

I need to calculate the error bounds for the following expression when computed under the IEEE 64-bit standard for $x\in[0,\pi/2] $:

$$ f(x)=2*\cos(x)^2-1-\cos(2x) $$

I understand that I need to decompose the equation into several such that each rounding operation is captured independently. Therefore:

$$ u_1=(1+\delta_1)*x $$

$$ u_2=cos(u_1)(1+\delta_2) $$

$$ u_3=(u_2)^2 (1+\delta_3) $$

$$ u_4=(2u_3-1)(1+\delta_4) $$

$$ u_5=(u_4-cos(2u_1))(1+\delta_5) $$

Is this correct? How do I proceed from here onwards?

2

There are 2 best solutions below

1
On

Hint

A way to compute the error $\Delta f$ is to use differentiation and $f^\prime(x) =\frac{\Delta f}{\Delta x}$.

Based on a given $\Delta x$, you can compute the induced error on the function $\Delta f$:

$$f^\prime(x)=-4x \sin(x^2)+2\sin(2x)$$

Therefore for $x \in [-M,M]$ with $M >0$

$$\vert f^\prime(x) \vert \le 4M+2$$

and $$\vert \Delta f \vert \le (4M+2) \vert \Delta x \vert$$

0
On

In binary based formats, multiplication with $2$ is exact. One can also assume that the input is exactly as given. Then the evaluation in floating point gives a result $$ (\{2[\cos(x)(1+δ_1)]^2-1\}(1+δ_2)-\{\cos(2x)(1+δ_3)\})((1+δ_4) $$ Retaining only the terms linear in $δ_j$ gives $$ =4δ_1·\cos^2x+δ_2·(2\cos^2x-1)-δ_3·\cos(2x)+δ_4·0+... $$ Using $|δ_1|\le\bar δ$, this gives for the leading error terms a bound of $$ (4\cos^2x+2|\cos(2x)|)\barδ=(2+4\max(0,\cos(2x))\barδ\le 6\barδ $$

enter image description here