Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Newton's Method for Root Finding - Infinite Loop

  1. Sep 29, 2011 #1
    1. Construct a function f (x) so that Newton's method gets 'hanging' in an infinite cycle xn = (-1)n x0 , no matter how the
    start value x0 is chosen.




    2. Relevant Equations:
    xn+1 = xn - f(xn) / f'(xn)



    3. The attempt at a solution
    xn+1 = xn - f(xn) / f'(xn) = (-1)n+1x0 = (-1)nx0 - f(xn) / f'(xn) [itex]\Rightarrow[/itex] f(xn) / f'(xn) = 2(-1)nx0
    But, I don't know if that's what I wanna do or what to do with it.

    Any ideas?
     
  2. jcsd
  3. Sep 29, 2011 #2

    Dick

    User Avatar
    Science Advisor
    Homework Helper

    If you apply Newtons iteration to any value of x, you want to wind up with -x. Try solving the differential equation -x=x-f(x)/f'(x).
     
  4. Sep 30, 2011 #3
    Ah, so you would get f(x) / f'(x) = 1/2x [itex]\Rightarrow[/itex] f'(x) = 1/2x * f(x) [itex]\Rightarrow[/itex] f(x) = e[itex]\int[/itex] 1/2x[itex]\Rightarrow[/itex] f(x) = [itex]\sqrt{x}[/itex] ?
     
    Last edited: Sep 30, 2011
  5. Sep 30, 2011 #4
    Dick, you're right that worked perfectly. I had it wrong at first since I had f(x) = e-[itex]\int 1/2x[/itex] but we get the double negative and thus get f(x) = e[itex]\int 1/2x[/itex]

    Thank you!
     
  6. Sep 30, 2011 #5

    Dick

    User Avatar
    Science Advisor
    Homework Helper

    Good! You'll also need to think a little about how to define f(x) for x<0. But drawing a picture should make that pretty clear.
     
  7. Sep 30, 2011 #6
    Would sqrt(|x|) work?
     
  8. Sep 30, 2011 #7

    Dick

    User Avatar
    Science Advisor
    Homework Helper

    Try it. I had been thinking about a different choice, but that works too.
     
  9. Sep 30, 2011 #8
    Hmm, if you don't mind, what were you thinking of?
     
  10. Sep 30, 2011 #9

    Dick

    User Avatar
    Science Advisor
    Homework Helper

    sqrt(x) for x>=0, -sqrt(-x) for x<0. The graph looks a little 'smoother'. But I don't think there's anything wrong with sqrt(|x|) either.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook