Results 1 to 6 of 6

Math Help - newton method

  1. #1
    Junior Member
    Joined
    May 2010
    Posts
    39

    newton method

    Code:
    if (x2 - x1)/x2 < err
    return
    end
    Is this terminating condition correct for newton raphson method?
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by ilikec View Post
    Code:
     
    if (x2 - x1)/x2 < err
    return
    end
    Is this terminating condition correct for newton raphson method?
    No, it at least needs an abs() on the left of the inequality.

    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    May 2010
    Posts
    39
    cant i say

    if feval(fx,x) < err
    return
    end

    fx is the function
    x is the value of x at current iteration

    So fx(x) < err means x is very close to the root

    Am i correct in this case?
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by ilikec View Post
    cant i say

    if feval(fx,x) < err
    return
    end

    fx is the function
    x is the value of x at current iteration

    So fx(x) < err means x is very close to the root

    Am i correct in this case?
    suppose err=0.0001 and fx(x)=-200 ?

    CB
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Junior Member
    Joined
    May 2010
    Posts
    39
    oh yeah i forgot

    it should be

    abs(f(x) ) < err


    absolute value so -200 will be 200 in this case

    is it okay to use this technique?
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by ilikec View Post
    oh yeah i forgot

    it should be

    abs(f(x) ) < err


    absolute value so -200 will be 200 in this case

    is it okay to use this technique?
    Yes

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Newton's Method
    Posted in the Calculus Forum
    Replies: 1
    Last Post: December 6th 2009, 04:10 PM
  2. Newton's method
    Posted in the Advanced Math Topics Forum
    Replies: 0
    Last Post: October 17th 2009, 01:46 PM
  3. Newton's Method
    Posted in the Calculus Forum
    Replies: 1
    Last Post: October 15th 2009, 09:03 PM
  4. Newton's Method help!!
    Posted in the Calculus Forum
    Replies: 0
    Last Post: October 29th 2008, 06:27 PM
  5. Newton's Method
    Posted in the Calculus Forum
    Replies: 7
    Last Post: December 12th 2007, 09:53 AM

Search Tags


/mathhelpforum @mathhelpforum