Linear Approximation

Let's say want to computer the value of a function \(f(x)\) at \( x = 1\) but all we know about this function is this:

\[ f(x) = f'(x)\]

and

\[f(0) = 1\]

One way to do this to use linear approximation repeatedly with a defined step size (say h). The lesser will be the value of step, the better approximation we can have.

Let's take an example,

Let's use the step size of \(0.5\)

Using, a step size of \(0.5\) or \(h = 0.5\), we can first compute the value at \(f(0.5)\) and then at f(1) which we ultimately require.

Generally, linear approximation states:

\[f(h) \approx f(0) + h.f'(0)\]

\[f(2h) \approx f(h) + h.f'(h)\]

\[f(3h) \approx f(2h) + h.f'(2h)\]

and this can go forever.

To approximate the value of f(1) using a step size of \(0.5\) that is for \(h = 0.5\), we can do it like this:

First, we compute value of \(f\) at \(0.5\) like this:

\(f(0.5)\approx f(0) + 0.5 \times f'( 0) = 1 + 0.5 \times 1 = 1.5 \)

Secondly, we can use the value of \(f\) at \(0.5\) to computer \(f(1)\) like this:

\(f(1) \approx f(0.5) + 0.5 \times f'(0.5) = 1.5 + 0.5 \times 1.5 = 2.25 \)

Now, write a program to find the value of \(f(1)\) using a step size of \(0.05\) or \(h = 0.05\) with repeated linear approximations.

The approximation of \(f(1)\) using this program is:

×

Problem Loading...

Note Loading...

Set Loading...