Idoc - Pub - Ccodechamp Com C Program of Newton Raphson Method C Code Cha PDF
Idoc - Pub - Ccodechamp Com C Program of Newton Raphson Method C Code Cha PDF
x = a1 – f(a1)/f’(a1)
Ccodechamp on Facebook
and is adopted as the new value a2 of the root. By repeating this process as necessary, we can obtain Like
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
increasingly accurate approximations a2, a3, … of the root provided that the derivative f’(x) is monotonic and
55 people like Ccodechamp.
preserves its sign on the segment containing root.
Consider an example : f(x) = x^2 - 4 as our polynomial equation. We want to calculate its root and say
first approximation =6. Then maximum power of X = 2, coefficients of x^0 = -4, x^1 = 0, x^2 = 1 & first
approximation =6. Now C program of Newton Raphson Method will display the iterations and root of the
polynomial as output.
Fac ebook s oc ial plugin
int main()
{ Categories
printf("-----------------------------------------------------------\n");
printf("----------------------Made by C code champ-----------------\n");
printf("-----------------------------------------------------------\n\n"); Select Category
printf("\n\n\t C PROGRAM FOR NEWTON RAPHSON METHOD");
for(i=0;i<=max_power;i++)
Sitemap
{
printf("\n\t x^%d = ",i);
scanf("%d",&coef[i]); August 2012 (51)
}
printf("\n");
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
printf("\n\n\tFirst approximation x1 ----> ");
scanf("%f",&x1);
printf("\n\n-----------------------------------------------------------\n");
printf("\n ITERATION \t x1 \t F(x1) \t \tF'(x1) ");
printf("\n-----------------------------------------------------------\n");
do
{
cnt++;
fx1=fdx1=0;
for(i=max_power;i>=1;i--)
{
fx1+=coef[i] * (pow(x1,i)) ;
}
fx1+=coef[0];
for(i=max_power;i>=0;i--)
{
fdx1+=coef[i]* (i*pow(x1,(i-1)));
}
t=x2;
x2=(x1-(fx1/fdx1));
x1=x2;
}while((fabs(t - x1))>=0.0001);
printf("\n\n\n\t THE ROOT OF EQUATION IS = %f",x2);
getch();
}
We hope that you all have enjoyed the C program of Newton Raphson Method. If you have any doubts
related to the program ask us in form of comments.
TAGS » algorithms in C, C code of New ton Raphson Method, C program of New ton Raphson Method, C programs, New ton
Raphson in C, New ton Raphson Method in C
POSTED IN » Algorithms, C Programs, Equations, Mathematics
Well, I am application developer in Tata Consultancy Services and love to code. My hobbies is to do
Hacking, Coding, Blogging, Web Designing and playing online games. Feel free to contact me at
[email protected] or [email protected]
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Related Articles»
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
4 Comments »
testing…
thanks!
Leave A Response »
Name (required)
Email (required)
Website
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Comment
Post Comment
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Copyright © 2011 -CCodeChamp. All rights reserved. Powered by C code champ Back to Top
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com