Pages

Showing posts with label numerical techniques. Show all posts
Showing posts with label numerical techniques. Show all posts

Thursday, May 8, 2014

Method of differences

There are many occurrences when we have certain numbers and we have to find relation between them. The relation is usually in form of expressions. The expression can contain log function, exponential function and algebraic functions.The simplest among them is to find polynomial expressions.In this post I will describe how to find functions when we know a series which has its terms separated by certain constant. The method is similar to differentiation but a lot different from them.

Suppose we have the numbers (from a function) like given in the following table

161528456691
We find the difference of successive term
5913172125
We again find the difference of successive term
44444
We find the differences till we get a constant term for all

As we got the constant term so we can create a table of possible polynomials for all. We start from the bottom.

c''44444
a'x+b'5913172125
ax2+bx+c161528456691

We got a quadratic because we had three rows in the table.
Now we have
f(x) =ax2+bx+c
f(0) = c = 1
f(1) = a + b + c = 6
f(2) = 4a + 2b + c = 15
from f(0): c =1
from f(1): a + b = 5
from f(2): 4a + 2b = 14
so solving the simultaneous equations a = 2 and b = 3 hence the function is f(x) = 2x2 + 3x + 1.
Above it must be known from where the values start for x and what is their differences in each step.

Monday, April 28, 2014

Bisection Method

There are many methods to find the roots by approximation and one of it is bisection method. This method uses the intermediate value theorem which states that if a continuous curve changes sign then it must have taken zero at some point.

We take the given function f(x) and two values a and b such that f(a)·f(b) < 0. Then we bisect the values a and b. Let it be c. c = (b-a)/2. If f(c)=0 then c is the root else if f(a)·f(c)<0 then b=c else a=c. We continue the same procedure again. This method converges very slowly.

The property of this method is that it does not use the value of f(x) as the formula to compute the root.

Saturday, March 29, 2014

Finding roots by approximations

On looking at the graph of a polynomial, we find that the graph cuts the x axis at certain points if it has real roots. We can use derivatives to find the roots of the equation formed from the polynomial.

In this method we first take a equation (f(x) = 0) whose root we have to find. Then we take a value x1. For that value of x we find the value (y1) of the corresponding expression. We find the derivative of the expression (f'(x)). Then we find the value of the slope (m1)at that point . We find the equation of a line
[(y − y1) = m (x − x1)].
Then we find the abscissa (x2) of intersection of the x-axis and the curve. We follow the same process again for the x2.

This method works very well for quadratic equation. It can work well for cubic equation and may work well for others. The problem which arises in this case is the value of x found. If the value of x found approaches the root then the method works well. There are many cases which arises when we find root by this method. The most favorable case is when we approach the root continuously i.e. every x with odd subscript moves in one direction only i.e. each successive odd term either becomes greater or either it becomes less of its previous. Each term with even subscript becomes greater if its corresponding even term is less and vice-verse. Then we will certainly approach the root.

Let us find the roots for a quadratic equation:

Enter a quadratic Equation:
x2 + x + = 0.
Input a value to start:

Input the number of iterations: