# newton method

#### ilikec

Code:
if (x2 - x1)/x2 < err
return
end
Is this terminating condition correct for newton raphson method?

#### CaptainBlack

MHF Hall of Fame
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

#### ilikec

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?

#### CaptainBlack

MHF Hall of Fame
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

#### ilikec

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?

#### CaptainBlack

MHF Hall of Fame
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

Similar Math Discussions Math Forum Date
Calculus
Calculus
Calculus
Calculus