answersLogoWhite

0


Best Answer

#include<iostream>

#include<cmath>

#include<fstream>

using namespace std;

double f(double x);

int main()

{

double dX0, dX1, dX2, dInterations = 0, dTolerance;

cout << "What is the first root guess? ";

cin >> dX0;

cout << "What is the second root guess";

cin >> dX1;

do {

dX2 = dX1 - ((f(dX1) * (dX1 -dX0)) / (f(dX1) - f(dX0)));

dX0 = dX1;

dX1 = dX2;

dTolerance = fabs(dX2 - dX1);

dInterations++;

}

while (dInterations <= 100 dTolerance >= .000001);

cout << "One of the roots is " << dX2 << endl;

}

double f(double x)

{

double dReturn;

dReturn = (3 * x * x) + (2 * x) -2;

return dReturn;

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can we write program in c on secant method explain with example?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How to write program for secant method in mathematica?

How to write a program for secant method by mathematica


What is an secant in math?

Secant is a trignometric function. In a right triangle, the secant of an angle is the hypotenuse over the adjacent side. It is also the inverse of cosine. For example secant(x) = 1/cos(x)


Code for Secant method please in visual basic 2008?

855193


Is the diameter an example of an secant?

I am almost positive that it isn't because a secant is an extended chord so it goes out of circle. So no it is not.


How do you find sec on TI-83 Plus?

There isn't a sec key on the TI-83 Plus. Secant is 1/cosine, which is what is used to find secant on a TI-83 Plus. For example, to find the secant of 4, enter 1/sec(4).


What are the values of theta of which secant theta is undefined?

Since secant theta is the same as 1 / cosine theta, the answer is any values for which cosine theta is zero, for example, pi/2.


Does trignometry secant relate to circles secant?

yes


How do you spell secant?

That is the correct spelling of the geometric term "secant."


Is a secant-secant angle is a central angle of a circle?

Sometimes


What is a secant of a circle?

a secant is a line containing a chord. A secant is a line that intersects the circle twice(or passes through a circle)


Where is the tangent secant angle on a circle?

The tangent secant angle is the angle between the tangent to a circle and the secant, when the latter is extended.


What is the advantages of secant method?

Advantages of secant method: 1. It converges at faster than a linear rate, so that it is more rapidly convergent than the bisection method. 2. It does not require use of the derivative of the function, something that is not available in a number of applications. 3. It requires only one function evaluation per iteration, as compared with Newton's method which requires two. Disadvantages of secant method: 1. It may not converge. 2. There is no guaranteed error bound for the computed iterates. 3. It is likely to have difficulty if f 0(&alpha;) = 0. This means the x-axis is tangent to the graph of y = f (x) at x = &alpha;. 4. Newton's method generalizes more easily to new methods for solving simultaneous systems of nonlinear equations.