424,831 Members | 1,024 Online
Need help? Post your question and get tips & solutions from a community of 424,831 IT Pros & Developers. It's quick & easy.

# newton raphson method

 P: 3 can you help me please with this problem.. i want a c program using newton raphson method for solving 18 equations... the equations are not of degree greater than 1... i need the program to input my 18 equations and give me the result May 3 '07 #1
11 Replies

 P: 24 Where are you stuck? May 3 '07 #2

 P: 6 can you help me please with this problem.. i want a c program using newton raphson method for solving 18 equations... the equations are not of degree greater than 1... i need the program to input my 18 equations and give me the result Ok here is the program for you. I am providing you the whole source code. But mind you, the correct way of learning things is by making mistakes. I would have liked it much, if you would have put whatever source code you could develop for the problem, on your own, but.. never mind. Take care in future. Learning is the process which should start from self. Expand|Select|Wrap|Line Numbers #include #include #define LB -1 #define UB 1 using namespace std; class Newton {       double a,b,x0,x1,tolerance;     double Fa,Fb,Fx0,h,root[100],dFx0,Fx1,cv,pv,Fcv;     int rootIndex;       public:         Newton()         {             tolerance = 10E-4;             rootIndex = -1;         }           double fun_value(int,double);         void find_root(int);         bool   validInterval(double);         double deriv_fun(int,double);   }; bool   Newton::validInterval(double z) {     if(z<0)         return true;     else         return false;     } void Newton::find_root(int degree) {     int count = 1;     char ch;     double diff;     h = (UB-LB)/(double)degree;     while(rootIndex < degree)     {         if(rootIndex != -1)             h = h /2;         rootIndex = 0;                 for(int i = 0;i\n";     for(int i = 0;i>degree;     N.find_root(degree);//calculates the root     return 0; }   Cheers! -Sandy May 3 '07 #3

 Expert 100+ P: 181 Ok here is the program for you. I am providing you the whole source code. But mind you, the correct way of learning things is by making mistakes. I would have liked it much, if you would have put whatever source code you could develop for the problem, on your own, but.. never mind. Take care in future. Learning is the process which should start from self. Expand|Select|Wrap|Line Numbers #include #include #define LB -1 #define UB 1 using namespace std; class Newton {       double a,b,x0,x1,tolerance;     double Fa,Fb,Fx0,h,root[100],dFx0,Fx1,cv,pv,Fcv;     int rootIndex;       public:         Newton()         {             tolerance = 10E-4;             rootIndex = -1;         }           double fun_value(int,double);         void find_root(int);         bool validInterval(double);         double deriv_fun(int,double);   }; bool Newton::validInterval(double z) {     if(z<0)         return true;     else         return false;     } void Newton::find_root(int degree) {     int count = 1;     char ch;     double diff;     h = (UB-LB)/(double)degree;     while(rootIndex < degree)     {         if(rootIndex != -1)             h = h /2;         rootIndex = 0;                 for(int i = 0;i\n";     for(int i = 0;i>degree;     N.find_root(degree);//calculates the root     return 0; }   Cheers! -Sandy Sandy if u give code, it would definitely stop him from thinking, and this would stop his programming ability. The world might loose one good programmer. May 3 '07 #4

 P: 6 Sandy if u give code, it would definitely stop him from thinking, and this would stop his programming ability. The world might loose one good programmer. Hey svlsr2000, U r right buddy. I'll take care in future. Cheers! -Sandy May 3 '07 #5

 P: 3 hey sandy ur code is giving errors...i am not a comp programmer but need the program for my major project..pls help May 3 '07 #6

 P: 3 hey i am not a comp programmer...i am a mechanical engg. student and need the program for my final yr project...pls help me out..i dont know how to remove errors...pls help me out with a program that has no errors May 3 '07 #7

 Expert 100+ P: 1,251 'k, please abide by the posting guidelines, no posting of complete source code. If you need an equation solver and it is not an assignment, why not use Maple? MathCad or other prebuild equation solver? Adrian May 16 '07 #10

 P: 15 'k, please abide by the posting guidelines, no posting of complete source code. If you need an equation solver and it is not an assignment, why not use Maple? MathCad or other prebuild equation solver? Adrian That's a good idea. But I cannot see how I can integrate it inside the code that I allready have. Can you give me an hint? May 16 '07 #11

 Expert 100+ P: 1,251 That's a good idea. But I cannot see how I can integrate it inside the code that I allready have. Can you give me an hint? You have one of these on hand? Maple is easy because there is a termanl based version so you can pipe in your commands from there. I'm not sure about MathCad though. Adrian May 16 '07 #12