Question

# a) Use base b = 10, precision k = 4, idealized, chopping floating-point arithmetic to show that fl(g(1.015)) is inaccurate, where

Polynomial arithmetic

a) Use base b = 10, precision k = 4, idealized, chopping floating-point arithmetic to show that fl(g(1.015)) is inaccurate, where $$\displaystyle{g{{\left({x}\right)}}}={\frac{{{x}^{{\frac{{1}}{{4}}}}-{1}}}{{{x}-{1}}}}$$ b) Derive the second order (n = 2) quadratic Taylor polynomial approximation for $$f(x)=x^{\frac{1}{4}}$$ expanded about a = 1, and use it to get an accurate approximation to g(x) in part (a). c) Verify that your approximation in (b) is more accurate.

2020-12-30

(a) Compute g(x) for $$x = 1.015.$$

$$g(1.015) = \frac{(1.015)1/4−1}{1.015−1} = 0.248605929$$

This is the exact value of g(x). In the ideal situation of chopping floating-point arithmetic, the operations are performed one at a time and the results are chopped after each operation. The floating-point number of the result with precision $$\displaystyle{k}={4}$$ is $$fl (g(1.015)) = \frac{fl((1.015)^{1/4})- 1}{fl(1.015 - 1)}$$

$$= \frac{1.004 - 1}{0.015}$$

$$= \frac{fl(1.004 - 1)}{0.015}$$

$$= fl (\frac{0.004}{0.015})$$

$$= 0.2667$$

The absolute value of $$\displaystyle{g{{\left({x}\right)}}}$$ is 0.248605929 and the floating-point value is 0.2667. The machine precision for $$\displaystyle{b}={10}$$ and $$\displaystyle{k}={4}$$ is $$\displaystyle\in_{{{m}{a}{c}{h}}}={\frac{{{1}}}{{{2}}}}{b}^{{{1}-{k}}}={\frac{{{1}}}{{{2}}}}{10}^{{{1}-{4}}}={5}\times{10}^{{-{4}}}$$ The absolute error is $$\displaystyle{\frac{{{\left|{f}{l}{\left({g{{\left({1.015}\right)}}}\right)}-{g{{\left({1.015}\right)}}}\right|}}}{{{\left|{g{{\left({1.015}\right)}}}\right|}}}}={\frac{{{\left|{0.2667}-{0.248605929}\right|}}}{{{\left|{0.248605929}\right|}}}}\approx{0.073}\approx{7.3}\%{>}{5}\times{10}^{{-{4}}}$$ Hence, $$\displaystyle{f}{l}{\left({g{{\left({1.015}\right)}}}\right)}$$ is inaccurate. (b) The Taylor's polynomial of order 2 of a function f(x) around a point x = a is $$\displaystyle{f{{\left({x}\right)}}}={f{{\left({a}\right)}}}+{f}'{\left({a}\right)}{\left({x}−{a}\right)}+{\frac{{{f}{''}{\left({a}\right)}}}{{{2}!}}}{\left({x}−{a}\right)}^{{2}}$$ Given $$f(x) = x^{1/4}$$  $$\Rightarrow f'(x) = \frac{1}{4x^{3/4}}$$ and $$\displaystyle{f}'{\left({x}\right)}=-{\frac{{{3}}}{{{16}{x}^{{\frac{{7}}{{4}}}}}}}$$ We shall take an expansion around the point x = 1. After substituting and simplifying, we get the Taylor's quadratic polynomial as follows: $$\displaystyle{f{{\left({x}\right)}}}={x}^{{\frac{{1}}{{4}}}}={1}+{\frac{{{1}}}{{{4}}}}{\left({x}−{1}\right)}−{\frac{{{3}}}{{{32}}}}{\left({x}−{1}\right)}^{{2}}$$ Now, approximate g(x) by using the Taylor`s polynomial f(x). $$fl(g(x)) = fl (\frac{f(x)- 1}{x - 1})$$

$$= fl(\frac{1 + \frac{1}{4} (x - 1) - \frac{3}{32} (x - 1)^2 - 1}{x - 1})$$

$$=fl(\frac{\frac{1}{4}(x - 1)- \frac{3}{32}(x - 1)^2}{x - 1})$$

Substitute values and use idealized, chopping floating-point arithmetic. $$fl(g(1.015)) = fl(\frac{\frac{1}{4}(1.015 - 1) - \frac{3}{32}(1.015 - 1)^2}{1.015 - 1})$$

$$= fl(\frac{(0.25) \times 0.015 - (0.09375)(0.015)^2}{0.015})$$

$$=fl[\frac{fl \left\{ fl((0.25)\times 0.015) - fl(fl(0.09375)fl(0.015)^2) \right\}}{0.015}]$$

$$=fl [\frac{fl \left\{ 3.75 \ times 10^{-3} - fl(9.375 \times 10^{2} \times 2.25 \times 10^{-4}) \right\}}{0.015}]$$

$$= fl \frac{ 3.75 \times 10^{-5}}{0.015} fl \frac{3.729 \times 10^{-3}}{0.015}= 0.2486$$

(c) From part (a), we have seen that the exact value of g(x) is 0.248605929. The absolute error is $$\displaystyle{\frac{{{\left|{f}{l}{\left({g{{\left({1.015}\right)}}}\right)}-{g{{\left({1.015}\right)}}}\right|}}}{{{\left|{g{{\left({1.015}\right)}}}\right|}}}}={\frac{{{\left|{0.2486}-{0.248605929}\right|}}}{{{\left|{0.248605929}\right|}}}}\approx{2.385}\times{10}^{{-{5}}}{<}{5}\times{10}^{{-{4}}}$$ The error is within the machine precision. Hence, this result is more accurate.