Thread: Newton Raphson method code

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    2

    Newton Raphson method code

    I need to use the Newton Raphson method in a program to find the roots of a polynomial. The polynomial is z^5 - z - 1. I'm not too sure how to deal with the complex roots. Does anyone know where I can find code that implements it. Thanks

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    I did a google search, and the first result was exactly what you are looking for.

  3. #3
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    715
    Well you have at least two approaches to this problem:

    1. Newton Raphson formulae is:
    z(k+1)=z(k)-f(z(k))/f'(z(k));
    In your case z is a complex number so question of multipling and dividing of complex number arises.
    You can declare strut complex and define functions which will handle this.
    I'm sure you can find a lot of examples of class complex here on this board.

    2. You know this: z=x+jy where X,y are Real numbers. So you can write soething like this:
    (x+jy)^5-(x+jy)-1=0; Now you apply the binomial formulae (not sure you call it that way). After that use this:
    Real(equation)=0
    Imag(equation)=0
    And basically you'll get a system of two equations with two unknown variables x,y. Now you can apply Newton Raphson method for systems. You'll get matrix... need to calculate inverese Jacobi matrix which is probably harder approach.

    Any please try not to post homework. We're simply not going to do it for you.
    Post your code where you having problems. That's OK

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Explain this C code in english
    By soadlink in forum C Programming
    Replies: 16
    Last Post: 08-31-2006, 12:48 AM
  2. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  3. Newton Raphson method code
    By taebin in forum C++ Programming
    Replies: 2
    Last Post: 10-16-2004, 03:07 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 4
    Last Post: 01-16-2002, 12:04 AM