473,385 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

c program to implement newton raphson method for finding roots of a polynomial

c program for newton raphson algorithm for finding roots of a polynomial
Oct 9 '06 #1
6 29284
r035198x
13,262 8TB
c program for newton raphson algorithm for finding roots of a polynomial
Why won't you try to write it yourself and then post at a more specific problem?
Oct 9 '06 #2
how can i implement a c progran for newton raphson algorithm using a for loop?
Oct 9 '06 #3
Banfa
9,065 Expert Mod 8TB
how can i implement a c progran for newton raphson algorithm using a for loop?
Please dont double post.

Please do have an attempt yourself first.



Do you know how the newton raphson method works?
Oct 9 '06 #4
#include<stdio.h>
/Calculate j(10) from j(0)
int main()
{
int n;
double j=0.6;
printf("forward iterations\n");
printf("initial estimate:j(0)=%g\n",j);
for(n=1,n<=10,n++)
j=1-(j*n);
printf("j(%d)=%g\n",n,j);
}
return 0;
}
this code is not helping me find roots of( x*x-2).What do I need to change?
Oct 10 '06 #5
Ok, let me see if I understand your code.

I'm a numerical methods and modeling engineer so I should understand the Newton-Raphson Method to be:

j( i+1 ) = j( i ) - [ j( i )^2 - 2 ] / [ 2*j( i ) ] for the function f( j ) = (j*j - 2).

So, you should step i forward until f( j ) is within your tolerance of 0. Then your answer should be your last j.

Here's some pseudocode:

i = 0

while( absoluteValue( f( j ) ) > toleranceValue)
{
j = j - [ f( j ) ] / [ df( j ) ];
i++;
}
printOut("Root of Function is at %g After %d Iterations" j, i );

When you write this out in whatever language you want, should work.

- Miles
Oct 10 '06 #6
Banfa
9,065 Expert Mod 8TB
Please DON'T double post (hmmm I seem to be repeating myself here)

Read This
Oct 10 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: kartikegarg | last post by:
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...
1
by: dynamo | last post by:
Hi guys,i was wondering if anyone knows the code to solve equations using the newton raphson method in matlab.Or at least the algorithm.
2
by: thiofdelux | last post by:
I need a c++ program that uses newton raphson method to find the rooys of a function. The program would prompt to put in the degree of the ploynomial, the error bound 10^(n), and the first...
1
by: lionkng | last post by:
I need a simple code for finding roots in c programme using Newton-raphson method
1
by: ripal ruparelia | last post by:
how to solve x-e^-x=0 by newton raphson method
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.