answersLogoWhite

0


Best Answer

#include[stdio.h]

#include[math.h]

#define epsilon 1e-6

void main()

{

double g1,g2,g,v,v1,v2,dx;

int found,converged,i;

found=0;

printf(" enter the first guess\n");

scanf("%lf",&g1);

v1=g1*g1*g1-15;

printf("value 1 is %lf\n",v1);

while (found==0)

{

printf("enter the second guess\n");

scanf("%lf",&g2);

v2=g2*g2*g2-15;

printf(" value 2 is %lf\n",v2);

if (v1*v2>0)

{found=0;}

else

found=1;

}

printf("right guess\n");

i=1;

while (converged==0)

{

printf("\n iteration=%d\n",i);

g=(g1+g2)/2;

printf("new guess is %lf\n",g);

v=g*g*g-15;

printf("new value is%lf\n",v);

if (v*v1>0)

{

g1=g;

printf("the next guess is %lf\n",g);

dx=(g1-g2)/g1;

}

else

{

g2=g;

printf("the next guess is %lf\n",g);

dx=(g1-g2)/g1;

}

if (fabs(dx)'less than' epsilon

{converged=1;}

i=i+1;

}

printf("\nth calculated value is %lf\n",v);

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

Locating Roots of Functions Using Bisection Method Let f(x) be a continuous function in the closed interval [a,b] such that f(a) and f(b) have opposite signs as shown graph below. Then there exists a root for the function f(x) in the interval (a,b). Method Set a0 = a and b0 = b Calculate p0 = (a0+b0)/2 If f(p0) = 0, then p0 is the root. STOP. If f(p0) not equal to 0, then f(p0) > 0 or f(p0)

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write an algorithm for bisection method?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Numerical method for solving can eqution bisection method?

A root-finding algorithm is a numerical method, or algorithm, for finding a value. Finding a root of f(x) − g(x) = 0 is the same as solving the equation f(x) = g(x).


Write a programm to implement the bisection method?

Please see the link for a code with an explanation.


Examples of algorithms?

bisection algorithm (see link)Euclid's algorithm (see link)Fibonacci search (see link)


What is advantages of bisection method?

In the absence of other information, it is the most efficient.


What is the advantages of using bisection method?

1. it is always convergent. 2. it is easy


What is the rate of convergence for the bisection method?

The rate of convergance for the bisection method is the same as it is for every other iteration method, please see the related question for more info. The actual specific 'rate' depends entirely on what your iteration equation is and will vary from problem to problem. As for the order of convergance for the bisection method, if I remember correctly it has linear convergence i.e. the convergence is of order 1. Anyway, please see the related question.


What is the Real root of 1-0.6x divided by x using bisection method?

The root of f(x)=(1-0.6x)/x is 1.6666... To see how the bisection method is used please see the related question below (link).


Disadvantages of the bisection method in numerical methods?

The main disadvantage of the bisection method for finding the root of an equation is that, compared to methods like the Newton-Raphson method and the Secant method, it requires a lot of work and a lot of iterations to get an answer with very small error, whilst a quarter of the same amount of work on the N-R method would give an answer with an error just as small.In other words compared to other methods, the bisection method takes a long time to get to a decent answer and this is it's biggest disadvantage.


What is anlgorithm in math?

An algorithm is a systematic method used to solve some problem.An algorithm is a systematic method used to solve some problem.An algorithm is a systematic method used to solve some problem.An algorithm is a systematic method used to solve some problem.


What is algorithm and what are its characteristics?

An "algorithm" is simply a method to solve a certain problem. For example, when you use the standard method you learned in school to write down two numbers, one beneath the other, then add them, you are using an algorithm - a method that is known to give correct results in this particular case.


How do you write algorith of C programs?

There is no specific Hard and Fast rule for writing algorithm. The normal method is the following: 1. get a problem 2. find or invent an algorithm to solve it 3. implement the algorithm in a programming language (C, for example)


What is algorithm to write algorithm to the program to access a pointer variable in structure?

Here is the algorithm of the algorithm to write an algorithm to access a pointer in a variable. Algorithmically.name_of_the_structure dot name_of_the _field,eg:mystruct.pointerfield