Active Members
TodayLast 7 Daysmore...


Resources » Articles/Knowledge Sharing » Computer & Technology

C program for finding the root of any equation using secant method


Posted Date:     Category: Computer & Technology    
Author: Member Level: Silver    Points: 2


Use the secant method for finding root of any equation by using c++ programming



 

#include
#include
#include
#define f(x) (x*x*x-3*x*x-x+9)
void main()
{ clrscr();
float x,xo,x1,x2,yo,y1;
cout <<" enter the initial values"<< endl;
cin >> xo >> x1;
yo = f(xo);
y1 = f(x1);
if(yo * y1 > 0)
{ cout<<" invalid internal "<< endl;
}
do
{yo = f(xo);
y1 = f(x1);
x2 = x1-((x1-xo)/(y1-yo))*y1;
xo = x1;
x1 = x2;}
while
(fabs(xo-x1)>0.001);
cout<< " the reqd root is = "<< x2 << endl;
getch();
}





Did you like this resource? Share it with your friends and show your love!





Responses to "C program for finding the root of any equation using secant method"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: C programming to find the root of any equation using Newton Raphson Method
    Previous Resource: Samsung Google Nexus S Features, Specs, Review, Release Date and Price in India
    Return to Resources
    Post New Resource
    Category: Computer & Technology


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Secant  .  Root  .  C programme  .  
    Awards & Gifts
    ISC Technologies, Kochi - India. Copyright © All Rights Reserved.