Let $f(x) = e^{2x}\cos3x$. Estimate the value of $f(0.5)$ using Lagrange's interpolating polynomial of degree $3$ over the nodes $x=0, x=0.3, x=0.6$ and $x=1$. Also compute the error bound over the interval $[0,1]$ and the actual error $E(0.5)$.

I am not sure whether we should use $x$ in radians or degrees.

  • $\begingroup$ The values of $x$ must be in radians, so ... $\endgroup$ – Nitin Uniyal Dec 24 '16 at 5:22
  • $\begingroup$ @Moo : Would it be possible for you to post the full solution? I am unable to figure out my mistake. $\endgroup$ – Pushpendra Pal Dec 24 '16 at 7:17
  • $\begingroup$ Default settings in my calculator was in degrees, hence the problem. Thank you @Moo $\endgroup$ – Pushpendra Pal Dec 24 '16 at 16:49
  • $\begingroup$ However, I am still unable to find the error bound. $\endgroup$ – Pushpendra Pal Dec 24 '16 at 16:51

We are given $$f(x) = e^{2x}\cos3x, x_0 = 0.0, x_1 = 0.3, x_2 = 0.6, x_3 = 1.0$$

We are asked to construct the interpolation polynomial of degree three, to approximate $f(0.5)$, to compute the error bound over the interval $[0,1]$ and the actual error $E(0.5)$.

The cubic polynomial passing through these points can be expressed as:

$$P_3(x) = y_0 L_0(x) + y_1 L_1(x) + y_2 L_2(x) + y_3 L_3(x)$$


  • $L_0(x) = \dfrac{(x − x_1)(x − x_2)(x-x_3)}{(x_0 − x_1)(x_0 − x_2)(x_0-x_3)} = -5.55556 (x-1) (x-0.6) (x-0.3)$
  • $L_1(x) = \dfrac{(x − x_0)(x − x_2)(x-x_3)}{(x_1 − x_0)(x_1 − x_2)(x_1-x_3)} = 15.873 (x-1.) (x-0.6) (x+0.) $
  • $L_2(x) = \dfrac{(x − x_0)(x − x_1)(x-x_3)}{(x_2 − x_0)(x_2 − x_1)(x_2-x_3)} = -13.8889 (x-1.) (x-0.3) (x+0.)$
  • $L_3(x) = \dfrac{(x − x_0)(x − x_1)(x-x_2)}{(x_3 − x_0)(x_3 − x_1)(x_3-x_2)} = 3.57143 (x-0.6) (x-0.3) (x+0.)$

The Lagrange Interpolating Polynomial is

$$P_3(x) = -3.22551 x^3-8.31722 x^2+3.22762 x+1.$$

The formula for the error bound is given by

$$E_n(x) = {f^{n+1}(\xi(x)) \over (n+1)!} \times (x-x_0)(x-x_1)...(x-x_n)$$

Since we do not know where $\xi(x)$ is, we will find each error over the range and multiply those together, so we have

$$\max_{(x \in 0, 1)} |f^{(4)}(x)| = \max_{(x \in 0,1)} |120 e^{2 x} \sin 3 x-119 e^{2 x} \cos 3 x| = 998.291$$

Next, we need to find

$$\max_{(x \in 0, 1)} |(x-0)(x-0.3)(x-0.6)(x-1.0)| = 0.0175456$$

Thus we have an error bound of

$$E_3(x) = \dfrac{998.291}{24} \times 0.0175456 \le 0.729816$$

If we compute the actual error, we have

$$\mbox{Actual Error}~ = |f(0.5) - P_3(0.5)| = 0.0609676$$

We can also plot the actual function versus the Lagrange Interpolating Polynomial over the range

enter image description here

  • $\begingroup$ Hi Moo, I am new to Langrange's interpolation. How did you find max(x∈0,1)|f(4)(x)|=max(x∈0,1)|120e2xsin3x−119e2xcos3x|=998.291 max(x∈0,1)|(x−0)(x−0.3)(x−0.6)(x−1.0)|=0.0175456 $\endgroup$ – Tortoise Jul 10 '17 at 10:35
  • $\begingroup$ @SurendraJ: For example, plot the function $(x-0)(x-0.3)(x-0.6)(x-1.)$ over $(x, 0, 1)$, find the critical points by taking the first derivative and setting it equal to zero - you will find three values of $x$ (see plot you just created), then recall we want the absolute value - so the max is clear. You will find the maximum as shown in the solution amongst those three values. Repeat this process for the other function $\endgroup$ – Moo Jul 10 '17 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.