L13-quadraticApprox.mws

__Calculus I__

**Lesson 13: Quadratic Approximation**

We want to approximate a given function f(x) at x=a with a second degree polynomial.

Express the second degree polynomial as P(x) = A + B (x - a) + C

We want:

P(a) = f (a)

P'(a) = f ' (a)

P''(a) = f '' (a)

Hence, we want:

A = f (a)

B = f ' (a)

2 C = f '' (a)

Thus,

P(x) = f (a) + f ' (a) (x-a) + [ f '' (a) / 2 ]

Conclusion: The quadratic approximation to f(x) near x = a is given by:

P(x) = f (a) + f ' (a) (x-a) + [ f '' (a) / 2 ]

**Example**
**1**

Find the quadratic approximation to f(x) = sec (x) for a = 0.

Plot both f(x) and P(x) on the same axes near 0.

`> `
**restart: **

`> `
**f:= x -> sec(x);**

`> `
**f(0);**

`> `
**D(f)(0);**

`> `
**D(D(f))(0);**

`> `
**P:= x -> 1 + 0.5 * (x)^2;**

`> `
**plot({f(x),P(x)}, x = -1..1, color=[blue,brown]);**

**Example**
**2**

Find the quadratic approximation to f x) = sin (x) for a =
.

Plot both f(x) and P(x) on the same axes near
.

Then plot both functions on a larger domain; is P(x) a good estimate

for f (x) away from
? .

`> `
**f:= x -> sin(x);**

`> `
**f(Pi/6);**

`> `
**D(f)(Pi/6);**

`> `
**evalf(%);**

`> `
**D(D(f))(Pi/6);**

`> `
**P:= x -> 0.5 + .8660254040 * (x - Pi/6) - 0.25 *( x - Pi/6)^2;**

`> `
**evalf(Pi/6);**

`> `
**plot({f(x),P(x)}, x = 0..1, color=[brown,blue]);**

The graph below shows that P(x) is NOT a good approximation to f (x) for x far from
.

`> `
**plot({f(x),P(x)}, x = -2*Pi..2*Pi, color=[brown,blue]);**

3) Find the quadratic approxiamtion for f (x) =
near a = 1.

Plot both f (x) and P (x) on the same axes near 1.

Plot both f (x) and P (x) on the same axes for a larger domain; is P(x) a good estimate away from 1?

Determine the values of x for which the quadratic approximation is accurate to within 0.01.

Can you use a plot to help?

`> `
**f:= x -> 1/(1+x)^2;**

`> `
**f(1);**

`> `
**D(f)(1);**

`> `
**D(D(f))(1);**

`> `
**P:= x -> 0.25 - 0.25 * (x - 1) + (3/16) * ( x - 1)^2;**

`> `
**plot({f(x),P(x)}, x = 0..2, color=[blue,brown]);**

`> `
**plot({f(x),P(x)}, x = 0..10, color=[blue,brown]);**

From the above graph, we see that P (x) is NOT a good estimate for f (x) for x not near 1.

We are to find x values for which | f(x) - P (x) | < 0.01, i.e.,

we want:

-0.01 < f (x) - P (x) < 0.01

OR

f (x) - 0.01 < P (x) < f (x) + 0.01.

`> `
**g1:= x -> f(x) - 0.01;**

`> `
**g2:= x -> f(x) + 0.01;**

`> `
**plot({P(x), g1(x), g2(x)}, x = 0.5..3, color=[blue, brown, magenta]);**

`> `
**solve({-0.01 < f (x) - P (x), x > 0}, x ); **

`> `
**solve({f (x) - P (x) < 0.01, x > 0}, x);**

From the plot and solve, we see that | P (x) - f (x) | < 0.01 for

x in (
,
). Our answer is a numerical estimate.