Holooly Plus Logo

Question 8.3: Comparing numerical and analytical differentiation. Consider......

Comparing numerical and analytical differentiation.

Consider the function f(x) = x³. Calculate the first derivative at point x = 3 numerically with the three-point forward difference formula, using:

(a) Points x = 3, x = 4, and x = 5.

(b) Points x = 3, x = 3.25, and x = 3.5.

Compare the results with the exact value of the derivative, obtained analytically.

Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

Analytical differentiation: The derivative of the function is f ‘(x)= 3  x², and the value of the derivative at x = 3 is f ‘(3) = 3 · 3² = 27.

Numerical differentiation

(a) The points used for numerical differentiation are:

\begin{array}{lccc}x: & 3 & 4 & 5 \\ f(x): & 27 & 64 & 125\end{array}

Using Eq. (8.24),

f^{\prime}\left(x_i\right)=\frac{-3 f\left(x_i\right)+4 f\left(x_{i+1}\right)-f\left(x_{i+2}\right)}{2 h}+O\left(h^2\right)        (8.24)

the derivative using the three-point forward difference formula is:

f^{\prime}(3)=\frac{-3 f(3)+4 f(4)-f(5)}{2 \cdot 1}=\frac{-3 \cdot 27+4 \cdot 64-125}{2}=25 \quad \text { error }=\left|\frac{25-27}{27}\right| \cdot 100=7.41 \%

(b) The points used for numerical differentiation are:

\begin{array}{lccc}x: & 3 & 3.25 & 3.5 \\f(x): & 27 & 3.25^{3} & 3.5^{3}\end{array}

Using Eq. (8.24), the derivative using the three points forward finite difference formula is:

\begin{gathered}f^{\prime}(3)=\frac{-3 f(3)+4 f(3.25)-f(3.5)}{2 \cdot 0.25}=\frac{-3 \cdot 27+4 \cdot 3.25^{3}-3.5^{3}}{0.5}=26.875 \\\text { error }=\left|\frac{26.875-27}{27}\right| \cdot 100=0.46 \%\end{gathered}

The results show that the three-point forward difference formula gives a much more accurate value for the first derivative than the two-point forward finite difference formula in Example 8-1. For h = 1 the error reduces from 37.04 % to [7.4 %, and for h = 0.25 the error reduces from 8.57% to 0.46 %.

Related Answered Questions